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

Bugfix/issu362 #363

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Bugfix/issu362 #363

wants to merge 5 commits into from

Conversation

Skeeve
Copy link
Contributor

@Skeeve Skeeve commented Sep 27, 2023

This is a fix for issue #362 I found today

@mrueg
Copy link
Collaborator

mrueg commented Oct 16, 2023

Could you add a test for this that shows that it's failing?
https://pkg.go.dev/text/template#Template.Delims shows that the default is "{{" and "}}", so no need to set this explicitly.

@Skeeve
Copy link
Contributor Author

Skeeve commented Oct 17, 2023

Could you add a test for this that shows that it's failing? https://pkg.go.dev/text/template#Template.Delims shows that the default is "{{" and "}}", so no need to set this explicitly.

Do you mean some testdata files? I'd love to, but it seems macros are not covered by tests at all since they are never expanded. See what the actual output of CompileMarkdown is when I put a simple

<!-- Macro: ::test::
     Template: #inline
     inline: |
          HiHo
     -->

::test::

as a testfile into testdata:

                                +<!-- Macro: ::test::
                                +     Template: #inline
                                +     inline: |
                                +          HiHo
                                +     -->
                                +<p>::test::</p>

So the macro was never touched it seemed.

@Skeeve
Copy link
Contributor Author

Skeeve commented Oct 17, 2023

So here is the test for you to reproduce:

% mark --compile-only -f issue362-without-include.md 
2023-10-17 09:57:39.009 INFO  processing issue362-without-include.md
2023-10-17 09:57:39.010 INFO  the leading H1 heading will be excluded from the Confluence output
<p>Hiho Manuel.</p>

So without the include it was fine.

% mark --compile-only -f issue362-with-include.md 
2023-10-17 09:58:14.339 INFO  processing issue362-with-include.md
2023-10-17 09:58:14.340 INFO  the leading H1 heading will be excluded from the Confluence output
<p>Hiho {{ .title }}</p>
<p>SELECT NOW()</p>

With the include, {{ .title }} is not expanded.

% mark2 --compile-only -f issue362-with-include.md
2023-10-17 09:58:50.245 INFO  processing issue362-with-include.md
2023-10-17 09:58:50.246 INFO  the leading H1 heading will be excluded from the Confluence output
<p>Hiho Manuel.</p>
<p>SELECT NOW()</p>

With my patched version (mark2) the expansion is done.

issue362-without-include.md
issue362-with-include.md
sql.txt

@Skeeve
Copy link
Contributor Author

Skeeve commented Oct 18, 2023

Do you have any clue, why include macros are not executed when running make test?

These files I have put into pkg/mark/testdata

Archiv.zip

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.

2 participants