Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [asciidoc-lang-dev] Markup for nested blocks

On Thu, 11 Mar 2021 at 20:24, Dan Allen <dan@xxxxxxxxxxxxxx> wrote:
> Sylvain wrote:
So, when a parser encounters some metadata before a delimiter, it should
(must?) assume this is the start of a new block. But consider the
following example:

====
a
[example]
====
b
====
c
====

Admittedly, this is getting into some strange corners of AsciiDoc, but you're missing the actual explanation in your disambiguation scenarios (though it's a mix of the first and last one). If the AsciiDoc processor encounters an orphaned block attribute line at the bottom of a document, it just ignores it. Likewise, if it finds one at the bottom of a delimited block, it also ignores it there too. In order words, if an orphaned block attribute line or block anchor is found at the bottom of a leaf (meaning no more content at that nesting level), those lines of metadata are simply ignored.

So what the processor is seeing inside the first example block is:

a
[example]

Try that in a document by itself and you'll see what happens.

In essence, you're correct that the bottom of a leaf (which you could think of as "before a block closing delimiter") is not a valid location for block metadata.

So Asciidoctor's output is correct in this case.

Agreed, the syntax is defined by the markups which have to function without attribute lists, so length distinguishes grouping.  Changing the syntax rules when attribute lists are present can lead to all sorts of ambiguities and problems.

One thing that Dan has mentioned before on the Asciidoctor list is that some line level markup (like whole line attribute lists) is considered definitive, if a line has [stuff] on it its an attribute list, it never reverts to text, unlike inline markup where unmatched markup will be treated as text.  Same with block delimiters, if they are unmatched they consume all the input and then cause an error instead of being a line of equals.

A proper formal language definition should handle that fine.

Cheers
Lex
 

Best Regards,

-Dan

--
Dan Allen, Vice President | OpenDevise Inc.
Pronouns: he, him, his
Content ∙ Strategy ∙ Community
opendevise.com
_______________________________________________
asciidoc-lang-dev mailing list
asciidoc-lang-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/asciidoc-lang-dev

Back to the top