Skip to content

Bugfix/issu362#363

Open
Skeeve wants to merge 5 commits intokovetskiy:masterfrom
Skeeve:bugfix/issu362
Open

Bugfix/issu362#363
Skeeve wants to merge 5 commits intokovetskiy:masterfrom
Skeeve:bugfix/issu362

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