Amaury / SkrivMarkup

Interpreter of the Skriv Markup Language.
GNU Lesser General Public License v2.1
25 stars 3 forks source link

Named parameters for extensions #22

Closed bohwaz closed 10 years ago

bohwaz commented 10 years ago

I suggest having named parameters for extensions, something like this:

<<<translate from="english" to="french"
danser, rêver, libérer
>>>

Or:

<<lipsum words=50>>
Amaury commented 10 years ago

Well, that would be the only tag with named parameters. It would set a bad precedent. There should be no need for this kind of syntax. Remember that «Lightweight markup languages should stay lightweight.» If a list of parameters is too long or not clear enough, it's a sign that the extension is no well designed, or it should be split into several extensions.

bohwaz commented 10 years ago

Nope, one example is an extension like this:

<<video|240|320|http://commons.wikimedia.org/...>>

Which one is the width and which one is the height? It's rather confusing.

Amaury commented 10 years ago

There is different possible answers.

For images and videos, the generally accepted convention is "widthxheight". So it would be easy to understand if it's <<<video|320|240|...>>>. You can also consider <<<video|320x240|...>>>.

But IMHO, it would be better if you focus on simplicity and meaningfulness, rather than asking the user to take care of design issues. Than you can let your CSS stylesheet manage the video's size, and use a syntax like <<<video|normal|...>>>, <<<video|big|...>>> or <<<video|mini|...>>>.

You may retort that some other parameters need to be specified. Like the video provider and the video identifier. But it's still possible to handle it elegantly:

The plugin should be able to detect if the provider/ID pair is given as an URL or as separate parameters.

My point of view is that named parameters are a slippery slope, and it will end in ugly syntax. Eventually, we'll get HTML-like tags. If your goal is to write <<<video width="320" height="240" src="file.ogg">>> instead of <video width="320" height="240"><source src="file.ogg" type="video/ogg"></video>, I don't see the point.