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

Remove DocumentAttributeDeclaration/Substitution/Reset elements in the document after parsing #444

Closed
xcoulon opened this issue Nov 23, 2019 · 0 comments · Fixed by #457
Closed

Comments

@xcoulon
Copy link
Member

xcoulon commented Nov 23, 2019

These DocumentAttributeDeclaration, DocumentAttributeSubstitution and DocumentAttributeReset must be in the DraftDocument but stripped of the "final' Document. If a document attribute cannot be substituted (because there is not such attribute defined), then the result should be a corresponding StringElement with a content set to {name} (where name is the name of the attribute to substitute).

Also, since the DocumentAttributeDeclaration elements will be removed from the "final document", we need to generate the element IDs during the parsing, not during the rendering.

@xcoulon xcoulon self-assigned this Nov 23, 2019
@xcoulon xcoulon added this to the v0.3.0 milestone Nov 23, 2019
@xcoulon xcoulon changed the title Remove DocumentAttributeSubstitution elements in the document after parsing Remove DocumentAttributeDeclaration/Substitution/Reset elements in the document after parsing Dec 22, 2019
xcoulon added a commit to xcoulon/libasciidoc that referenced this issue Dec 28, 2019
Once the draft document has been parsed, there should be no
DocumentAttributeSubstitution element left. If an attribute was not
declared, then it should have been replaced with its string equivalent
({name})

Fixes bytesparadise#444

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit to xcoulon/libasciidoc that referenced this issue Dec 28, 2019
DocumentAttributeDeclaration, Substitution and Reset
blocks are processed while preparing the final
document.
As a consequence, final document is simpler to render,
but more processing needs to take place beforehand,
including the section id generation, the implicit usage of
the  'imagesdir' attribute while generating the image
location and the marker for the table of contents.

fixes bytesparadise#444

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit to xcoulon/libasciidoc that referenced this issue Dec 28, 2019
DocumentAttributeDeclaration, Substitution and Reset
blocks are processed while preparing the final
document.
As a consequence, final document is simpler to render,
but more processing needs to take place beforehand,
including the section id generation, the implicit usage of
the  'imagesdir' attribute while generating the image
location and the marker for the table of contents.

If an attribute was not declared and could not be sustituted, then
it is replace with its name surrounded by curly brackets.

fixes bytesparadise#444

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit that referenced this issue Dec 28, 2019
* refactor(parser): apply attribute substitutions in final Document

DocumentAttributeDeclaration, Substitution and Reset
blocks are processed while preparing the final
document.
As a consequence, final document is simpler to render,
but more processing needs to take place beforehand,
including the section id generation, the implicit usage of
the  'imagesdir' attribute while generating the image
location and the marker for the table of contents.

If an attribute was not declared and could not be sustituted, then
it is replace with its name surrounded by curly brackets.

also, removed some unused funcs

fixes #444

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant