mbakeranalecta / sam

Semantic Authoring Markdown
Other
79 stars 8 forks source link

Codeblock annotations. #63

Closed mbakeranalecta closed 8 years ago

mbakeranalecta commented 8 years ago

The codeblock annotations need reviewing. Currently the format is:

(language "source" (namespace) ?condition #name *ref)

But source should be handled by a citation for consistency.

Not sure of the value of namespace.

That would leave:

(language ?condition #name *ref)

Another possibility would be to leave the block annotation structure the same and use the space after the annotation for the language tag:

```(?foo) sam
   code

or

 ``` sam
    code

This would make the format of the language string open and not dependent of the annotation parser.

It is quite consistent with the use of titles on blocks.

mbakeranalecta commented 8 years ago

I suppose we could also use the language annotation:


But that is a bit of a problem since ! is supposed to take a standard language or locale code.
mbakeranalecta commented 8 years ago

The issue with

``` sam

is that it is conceivable that you might want to give a codeblock a title, in which case this would be the natural position for it.

mbakeranalecta commented 8 years ago

An option is to overload ! such that its value is of a different type when applied to codeblocks

But a bigger issue here is that in any text that talks about code, the assignment of language to codeblocks will be much much more common that the assignment of language to anything else. So why use the obscure syntax for the common case?

mbakeranalecta commented 8 years ago

another option is to do this:

``` xml

and

```(?baz) xml

In other words, put the language in the title position.

But this seems counter intuitive. Language is an annotation and annotation go in parens.

mbakeranalecta commented 8 years ago

It is worth bearing in mind that most of the block metadata are shortcuts. You can always use fields to accomplish the same semantics.

foo:(?bar)

vs.

foo:
    if: bar

Similarly, you can do:

codeblock:
    language: xml
    | foo = 2
    | bar = 7

or

codesample:
    language: xml
    foo = 2
    bar = 7


There is therefore no need to make any of the shortcuts complete. They are a convenience feature and they diminish in value if they become obscure or difficult to learn and use.
mbakeranalecta commented 8 years ago

language and namespace attributes should be removed.

mbakeranalecta commented 8 years ago

Now that each block attribute must be in a separate annotation, the issues here are moot.