doorstop-dev / doorstop

Requirements management using version control.
https://doorstop.readthedocs.io
Other
464 stars 127 forks source link

Jinja2 / Mustache syntax incompatibility #513

Open wojciechczerniak opened 3 years ago

wojciechczerniak commented 3 years ago

Markdown publisher generates attr_list without space after first curly bracket

ie. {#SRS-001 } instead { #SRS-001 }

This may create a problem when we want to render the output markdown documents in any system that uses those markup extensions ie. some documentation engines that are using markdown as content. They recognize {# as a starting block for various block types.

I think that here:

https://github.com/doorstop-dev/doorstop/blob/a770dc4566a43de87da0e5be61dfedf87a7ac57d/doorstop/core/publisher.py#L496-L498

a very small change will solve the issue:

-return " {{#{u} }}".format(u=item.uid) if linkify else ''
+return " {{ #{u} }}".format(u=item.uid) if linkify else ''
wojciechczerniak commented 3 years ago

⚠️ I found an issue #469 that suggest removing the spaces instead adding them. Should be examined carefully

neerdoc commented 2 years ago

I believe that the default functionality should be as in #469, i.e., no spaces. This is since Jinja2/Mustache syntax are markdown extensions.

If this is a requested feature (to use specific markdown extensions), it should be added as a flag, e.g., --mustache-compatible or similar.

wojciechczerniak commented 2 years ago

I second that that there should be no spaces as default. But instead introducing flags I would focus on #515 to allow the necessary customizations for even more extensions than we can think off. I didn't close this issue after creating #515 because I see it as a good use case for templating engine