Duck table syntax

Shaun McCance <shaunm at gnome.org>
Mon Sep 1 22:53:04 EDT 2014

I have yet to find a table syntax I like. That said, I dislike what I'm
about to present somewhat less than other things.

Recall that one of the design goals of duck syntax is that it doesn't
restrict your ability to put things inside of things, like putting lists
inside of tables, for example.

Most lightweight languages try to mimic tables, so that your source text
looks kind of tableish. This is nice when you have narrow tables without
much markup inside them. That rarely happens to me.

Instead, I'm proposing doing tables as the next block-esque things that
they are. Something like this:

[table]
[tr]
  [td] Top left
  [td] Top right
[tr]
  [td] Bottom left
  [td] Bottom right

In fact, the [tr]s could have been indented. Or the [td]s could have
been not indented, because we know a thing or two about what to expect
in these contexts. This is the full form. I suppose if you want to get
pedantic, the full form is really:

[table]
  [tr]
    [td]
      Top left
    [td]
      Top right

Et cetera. Should be clear how we can still manage block nesting with
tables, and how it reuses the same syntax as blocks.

Recalls that lists get special syntax, so that list items don't have to
use "[item]" but can instead just use "* ". Let's let [td]s in on the
same syntactic sugar.

[table]
[tr]
* Top left
* Top right
[tr]
* Bottom left
* Bottom right

If you need to do colspan, rowspan, style, etc, then you need to use the
fuller syntax. But this abbreviated form makes it simple to do simple
tables with a list-like syntax.

I've attached a duckified page from the new HIG that shows various bits
of this.

--
Shaun


-------------- next part --------------
= Essentials
:credit:[type=author]
  :name:(Allan Day)
  :email:(aday at gnome.org)
:xi:include:[href=legal.xml]

This section of the Human Interface Guidelines covers essential themes.
It provides an initial starting point when designing an application, as
well as common design guidelines that are necessary when using all the
patterns and user interface elements found in later sections.

== Getting Started
   [#getting-started]

[table]
[tr]
  * &link[>design-principles](&em[.strong](Design principles))
  * General design guidelines and advice.
[tr]
  [td] &link[>application-basics](&em[.strong](Application basics))
  [td] Basic application behavior and characteristics.
[tr]
  [td] &link[>compatibility](&em[.strong](Compatibility))
  [td] Using the HIG for cross-platform or GNOME 2 style applications.


== Common guidelines
   [#common-guidelines]

[table]
[tr]
* &link[>visual-layout](&em[.strong](Visual layout))
* Arranging elements within user interfaces.
[tr]
  * &link[>writing-style](&em[.strong](Writing style))
  * Writing text for your user interface, including capitalization rules.
[tr]
  [td]
  &link[>icons-and-artwork](&em[.strong](Icons and artwork))
  [td]
  Guidelines on selecting and creating icons.
[tr]
  [td]
    &link[>typography](&em[.strong](Typography))
  [td]
    Advice on font sizes, weights and styles, as well as special characters.
[tr]
[td] &link[>pointer-and-touch-input](&em[.strong](Pointer and touch input))
[td] Mouse, touchpad and touchscreen interaction.
[tr]
  [td] &link[>keyboard-input](&em[.strong](Keyboard input))
  [td] Keyboard navigation, access and shortcut keys.