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

Asciidoxy treats cmake source code as though it was asciidoxy directives #74

Open
mkschreder opened this issue Nov 30, 2022 · 3 comments
Labels
Improvement New feature or request
Milestone

Comments

@mkschreder
Copy link

mkschreder commented Nov 30, 2022

The following code generates error:

[source,cmake]
----
some_cmake_code(${CMAKE_VARIABLE})
----
ERROR: Error while processing AsciiDoc files:
Undefined
Traceback:
  File index.adoc, line 16, in AsciiDoc
    ${include("document.adoc", leveloffset="+1")}
  File document.adoc, line 7, in AsciiDoc
    ${include("document.adoc")}
  File document.adoc, line 96, in AsciiDoc
    some_cmake_stuff(${CMAKE_VARIABLE}) <- this is problematic

Asciidoxy also seems to ignore asciidoc comments where even lines prefixed with "//" are still processed.

This is a bug since:

  1. source blocks must not be treated as asciidoxy code
  2. Comment blocks must not be expanded as asciidoxy directives
@silvester747
Copy link
Collaborator

Sorry for the late response. This is currently a limitation of AsciiDoxy. It is however possible to suppress the parsing as directives:

[source,cmake]
----
${"""
some_cmake_code(${CMAKE_VARIABLE})
"""}
----

See also: https://asciidoxy.org/getting-started/using-python.html#_comments

But I will see if there is something I can do to improve this.

@silvester747 silvester747 added the Improvement New feature or request label Dec 30, 2022
@silvester747 silvester747 added this to the 1.0.x - ACE milestone Dec 30, 2022
@silvester747
Copy link
Collaborator

I have been thinking about this. My main challenge is that sometimes you may want to be able to execute python code to populate the example. E.g. in the AsciiDoxy documentation I use it to include the output of asciidoxy -h in the generated documentation.

But maybe I can improve the way AsciiDoxy handles it. Either by somehow ignoring it if fails to parse, or by giving a more clear error message with a recommendation on how to escape the code.

@mkschreder
Copy link
Author

I think the proper way would be to simply ignore it inside code blocks. Code blocks are after all expected to be treated as preformatted literals so I thimk they should never be modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants