Duck syntax

Shaun McCance <shaunm at gnome.org>
Fri Dec 5 15:03:22 EST 2014

On Thu, 2014-12-04 at 22:42 +0100, Frederic Peters wrote:
> Shaun McCance wrote:
> > Regarding the number of spaces, You can use however many you like to
> > start a block, and that's the number you need to stay in the block. You
> > can even use more in subsequent lines, but never less. The one caveat
> > here is that the shorthand syntaxes like "* " for list items implicitly
> > start you at a two-space indent. So if you like a one-space indent,
> > you're going to have a hard time. If you like four spaces, you can do
> > that. I like two spaces, personally.
> 
> The exact moment when number of spaces became an issue is when I was
> asked how to add attributes to the <page>, e.g.
> 
>   = My First Topic
>     [type="topic"]
>   @link[guide >index]
> 
> [type="topic"] has to be two spaces and I couldn't tell for sure
> without testing.  Honestly that's not an important matter, I just
> didn't have it clear when I was asked if the number of spaces was
> relevant ("well, I don't know, try something else? it fails? ok, you
> need to have two spaces").

Oh, there. That's actually a bit of an odd case. It's just an attribute
list, not a block declaration. It has to be indented some to distinguish
it from just starting a block. And actually, it currently has to be
indented based on the section depth.

= My First Topic
  [type="topic"]

== A Section
   [style="tip"]

===== A Subsubsubsection
      [style="way-too-deep"]

But it occurs to me that a single space is enough to be unambiguous for
any level of sections. I'll change it to not care how many spaces you
use. Aligning to the title text is still my preference stylistically,
but that doesn't have to be enforced.

--
Shaun