tajmone / ST4-Asciidoctor

AsciiDoc Package for SublimeText 4
https://tajmone.github.io/ST4-Asciidoctor
MIT License
11 stars 6 forks source link

Superscript Temporarily Disabled #1

Closed tajmone closed 3 years ago

tajmone commented 3 years ago

The Superscript element works, but needs to be disabled until the following conditions are met:


Superscript was temporarily disabled (commit f7ab8323b) because it was breaking up documents where the caret ^ was used for links with blank target or tables alignments.

If a document contained, e.g.:

link:https://some-url.com[some text^]
                                   ^   i.e. "target_blank" link

or

[cols="3*^"]
|=====================
         ^   i.e. column alignment (center)

the ^ was parsed as an opening subscript delimiter, thus breaking up the whole document until another ^ was encountered.

To fix this, we need to implement the link: element and capture the [cols="<...>"] one-liner that precedes tables, and ensure that these elements always precede subscript in the syntax parsing order, so that the ^ will be properly handled in these contexts.

tajmone commented 3 years ago

Fixed!

OK, I've managed to fix the Superscript element now. The link element is also back, which was part of the original syntax, implemented together with the generic macro definition.

In order to prevent document disruption with tables options like [cols="3*^"], I had to introduce a new "dummy element" in order to consume the occurrence of similar table options, without providing any scope to them. In the future I might need to introduce a dedicated element for these table options (what are they called?), but for now the fix will do.

Also, it would be a good idea to create a separate element for handling links, for we could provide better semantics and cover more fine-grain details — e.g. title="" and ^ for target blank, and others — as well as to allow attributes in links (which are not uncommon).

Anyhow, now all tests are back, along with new ones checking for false positive Subscript matches, and they all pass.