asciidoctor / atom-language-asciidoc

⚛ AsciiDoc language package for the Atom editor.
https://atom.io/packages/language-asciidoc
MIT License
42 stars 20 forks source link

refactor: paragraph and block attribute #127

Closed ldez closed 8 years ago

ldez commented 8 years ago

Whole changes of the capture for block attribute . Introducing paragraph patterns.

Support for:

Related to #125 #126

ldez commented 8 years ago

Complete rewrite of 'block attribute' pattern. Complete rewrite for 'source', 'quote', 'admonition' patterns. Delete explicit-paragraph-grammar.cson and section-grammar.cson

ldez commented 8 years ago

It's the first step to paragraph patterns. The full rewrite with paragraph patterns come in an another PR after this PR will be merged

ldez commented 8 years ago

quotes;

capture du 2016-05-15 21-47-02

ldez commented 8 years ago

source:

capture du 2016-05-15 21-49-18

ldez commented 8 years ago

admonition:

capture du 2016-05-15 21-46-11

ldez commented 8 years ago

@mojavelinux @nicorikken any remarks?

nicorikken commented 8 years ago

I spotted one comment left in the code changes, addressed with an inline comment (and you fixed while I was typing this message 😄 ) I've tried to break your features (based on the examples here), but failed to do so 😢 , so great work 👍. This level of nesting now introduced seems complicated, but I'm pretty sure I'll get the hang of it when I get into developing mode again. very nice work! 👏

nicorikken commented 8 years ago

Ready, check, so merge!

mojavelinux commented 8 years ago

This is really unbelievable, @ldez (but I totally believe it). This grammar goes so far beyond any grammar that is out there for AsciiDoc. I actually think this grammar is now going to play an important role in defining a specification for AsciiDoc and, eventually, UniDoc. In fact, I'd even say that together, we might be able to solve the inline parsing problem in Asciidoctor core (wink wink). https://github.com/asciidoctor/asciidoctor/issues/61

mojavelinux commented 8 years ago

I just played around with the new package and discovered a case that may have been missed. I can add an ID to a quote paragraph as follows:

[quote#someone-quote]
This is just a quote from someone.

However, I cannot assign only a role:

[quote.famous]
This is just a quote from someone.

However, I can add a role if I also add an ID:

[quote#someone-quote.famous]
This is just a quote from someone.

The following pattern should be allowed:

[quote#id]
[quote.role]
[quote%option]
[quote.role#id]
[quote#id.role]
[quote%option#id]
[quote.role%option]
etc...

Notice that order doesn't matter. ID can only be specified once, but role and option can be specified any number of times.

mojavelinux commented 8 years ago

To start, we may not have to worry about validating the content adjacent to the block name (e.g., quote) as long as #, . and % are allowed.

ldez commented 8 years ago

Open an issue, I will try to solve this.

ldez commented 8 years ago

this examples already works:

[quote#someone-quote]
This is just a quote from someone.
[quote#someone-quote.famous]
This is just a quote from someone.
ldez commented 8 years ago

Fixed!!