Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(parser): custom substitutions on paragraphs #749

Merged

Conversation

xcoulon
Copy link
Member

@xcoulon xcoulon commented Sep 5, 2020

Using multiple substitutions to parse the paragraph content
and support custom substitutions via the subs attribute.

Some grammar rules have been simplified. For example, the
content of a quoted text can only be other quoted texts or
plain chararacters.

Using "placeholder" elements to support parsing of complex
elements in which previously elements were identified. For
example, a link may contain quoted text as attributes, quoted
test may contain special characters, etc.

Also, introducing a new ElementRole type, since attributes
may contain special characters which would be rendered differently,
depending on the backend.

However, this may need more work in the future (expand to
other attributes with somethig generic?)

Sadly, all these changes also have an impact on the performances,
so further investigation may be required, to see if optimizations
can be found.

Fixes #597

Signed-off-by: Xavier Coulon [email protected]

WIP update tests after rebasing

Signed-off-by: Xavier Coulon [email protected]

WIP - with quotedtext placeholder

Signed-off-by: Xavier Coulon [email protected]

@codecov
Copy link

codecov bot commented Sep 5, 2020

Codecov Report

Merging #749 into master will decrease coverage by 1.26%.
The diff coverage is 70.48%.

@@            Coverage Diff             @@
##           master     #749      +/-   ##
==========================================
- Coverage   84.79%   83.53%   -1.27%     
==========================================
  Files          77       77              
  Lines        5296     5605     +309     
==========================================
+ Hits         4491     4682     +191     
- Misses        507      586      +79     
- Partials      298      337      +39     

@xcoulon xcoulon force-pushed the Issue597_custom_subs_paragraphs branch from 0881f41 to 5e2ed38 Compare September 5, 2020 16:20
Using multiple substitutions to parse the paragraph content
and support custom substitutions via the `subs` attribute.

Some grammar rules have been simplified. For example, the
content of a quoted text can only be other quoted texts or
plain chararacters.

Using "placeholder" elements to support parsing of complex
elements in which previously elements were identified. For
example, a link may contain quoted text as attributes, quoted
test may contain special characters, etc.

Also, introducing a new `ElementRole` type, since attributes
may contain special characters which would be rendered differently,
depending on the backend.

However, this may need more work in the future (expand to
other attributes with somethig generic?)

Sadly, all these changes also have an impact on the performances,
so further investigation may be required, to see if optimizations
can be found.

Fixes bytesparadise#597

Signed-off-by: Xavier Coulon <[email protected]>

WIP update tests after rebasing

Signed-off-by: Xavier Coulon <[email protected]>

WIP - with quotedtext placeholder

Signed-off-by: Xavier Coulon <[email protected]>
@xcoulon xcoulon force-pushed the Issue597_custom_subs_paragraphs branch from 5e2ed38 to b1e4bbb Compare September 5, 2020 16:22
@xcoulon xcoulon merged commit 7050c34 into bytesparadise:master Sep 6, 2020
@xcoulon xcoulon deleted the Issue597_custom_subs_paragraphs branch September 6, 2020 06:50
xcoulon added a commit to xcoulon/libasciidoc that referenced this pull request Sep 27, 2020
applying the same logic as with paragraphs to apply default and
custom substitutions on delimited blocks. This means that
delimited blocks are processed in multiple steps, but each step
has a much simpler grammar.

Also, quite a lot of refactoring and code reorganization for the
delimited block tests in `pkg/parser`.

See bytesparadise#749

Fixes bytesparadise#558

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit to xcoulon/libasciidoc that referenced this pull request Sep 28, 2020
applying the same logic as with paragraphs to apply default and
custom substitutions on delimited blocks. This means that
delimited blocks are processed in multiple steps, but each step
has a much simpler grammar.

Also, quite a lot of refactoring and code reorganization for the
delimited block tests in `pkg/parser`.

See bytesparadise#749

Fixes bytesparadise#558

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit to xcoulon/libasciidoc that referenced this pull request Sep 28, 2020
applying the same logic as with paragraphs to apply default and
custom substitutions on delimited blocks. This means that
delimited blocks are processed in multiple steps, but each step
has a much simpler grammar.

Also, quite a lot of refactoring and code reorganization for the
delimited block tests in `pkg/parser`.

See bytesparadise#749

Fixes bytesparadise#558

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit to xcoulon/libasciidoc that referenced this pull request Sep 28, 2020
applying the same logic as with paragraphs to apply default and
custom substitutions on delimited blocks. This means that
delimited blocks are processed in multiple steps, but each step
has a much simpler grammar.

Also, quite a lot of refactoring and code reorganization for the
delimited block tests in `pkg/parser`.

See bytesparadise#749

Fixes bytesparadise#558

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit that referenced this pull request Sep 28, 2020
applying the same logic as with paragraphs to apply default and
custom substitutions on delimited blocks. This means that
delimited blocks are processed in multiple steps, but each step
has a much simpler grammar.

Also, quite a lot of refactoring and code reorganization for the
delimited block tests in `pkg/parser`.

See #749

Fixes #558

Signed-off-by: Xavier Coulon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom substitutions on paragraphs
1 participant