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

(URGENT) yaml2text nesting fails #347

Closed
ronaldtse opened this issue Sep 23, 2020 · 2 comments
Closed

(URGENT) yaml2text nesting fails #347

ronaldtse opened this issue Sep 23, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ronaldtse
Copy link
Contributor

In metanorma/bipm-si-brochure#22 the file:
https://github.com/metanorma/bipm-si-brochure/pull/22/files#diff-8b5e7ad97ed1c17d3424c897e975f844

Uses nesting to define yaml2text within yaml2text. i.e.:

[yaml2text,sections-a1-yaml/resolutions.yml,paths]
----
{% for path in paths %}

[yaml2text,cgpm-resolutions/{{ path }},data]
--

== {{ data.metadata.title }}, {{ data.metadata.date | split: "-" | first }}

{% for resolution in data.resolutions %}

=== {{ resolution.title }}

[align=center]
*Resolution {{ resolution.identifier }}*

{% for approval in resolution.approvals %}
{{ approval.message }}
{% endfor %}

...

{% endfor %}
--

{% endfor %}
----

The output (if we switch to use :mn-document-class: iso) becomes:
Screen Shot 2020-09-23 at 9 43 20 AM

This means that the inner yaml2text didn't work at all. I noticed that yaml2text expects a source code block (----), but but this way we cannot enable nesting. We must allow any number of matching -- (from 2 - to n -);.

@ronaldtse ronaldtse added the bug Something isn't working label Sep 23, 2020
@w00lf
Copy link
Contributor

w00lf commented Sep 23, 2020

In metanorma/bipm-si-brochure#22 the file:
https://github.com/metanorma/bipm-si-brochure/pull/22/files#diff-8b5e7ad97ed1c17d3424c897e975f844

Uses nesting to define yaml2text within yaml2text. i.e.:

[yaml2text,sections-a1-yaml/resolutions.yml,paths]
----
{% for path in paths %}

[yaml2text,cgpm-resolutions/{{ path }},data]
--

== {{ data.metadata.title }}, {{ data.metadata.date | split: "-" | first }}

{% for resolution in data.resolutions %}

=== {{ resolution.title }}

[align=center]
*Resolution {{ resolution.identifier }}*

{% for approval in resolution.approvals %}
{{ approval.message }}
{% endfor %}

...

{% endfor %}
--

{% endfor %}
----

The output (if we switch to use :mn-document-class: iso) becomes:
Screen Shot 2020-09-23 at 9 43 20 AM

This means that the inner yaml2text didn't work at all. I noticed that yaml2text expects a source code block (----), but but this way we cannot enable nesting. We must allow any number of matching -- (from 2 - to n -);.

yaml2text and json2text support any delimiters supplied after the block definition. The problem here is implementation of nested yaml2text contexts. The snippet you put in the description is quite complex to implement, we cant render nested yaml2text blocks until we render root level block, because it consists of filenames and we cannot render nested blocks without root context. I tried to implement it but have not got any success so far. I need more time on this.

w00lf added a commit that referenced this issue Sep 25, 2020
…s: with_yaml_nested_context, with_json_nested_context, new specs for nested case.
w00lf added a commit that referenced this issue Sep 25, 2020
…s: with_yaml_nested_context, with_json_nested_context, new specs for nested case.
w00lf added a commit that referenced this issue Sep 27, 2020
w00lf added a commit that referenced this issue Sep 27, 2020
w00lf added a commit that referenced this issue Sep 27, 2020
@ronaldtse
Copy link
Contributor Author

Fixed in latest commits, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants