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

Source code block with < and > not generated correctly #4253

Closed
fekir opened this issue Feb 4, 2022 · 2 comments
Closed

Source code block with < and > not generated correctly #4253

fekir opened this issue Feb 4, 2022 · 2 comments
Assignees
Milestone

Comments

@fekir
Copy link

fekir commented Feb 4, 2022

Consider following minimal document

= dummy
fekir

[source, cpp]
----
constexpr const node<4> tree
{
	node<4 >
	{
	}
};

constexpr const node<4> tree2
{
	node<4>
	{
	}
};
----

with Asciidoctor 2.0.16 [https://asciidoctor.org] Runtime Environment (ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

the generated HTML looks like (I can eventually attach the file)

dummy
fekir

constexpr const node<4> tree
{
	node<4 >
	{
	}
};

constexpr const node<4> tree2
{
	node(4)
	{
	}
};

Note that in the second code snippet, the last node<4> has been rewritten as node(4).
If I add some space, like in node<4 >, then <> are not replaced by ().

The offending HTML is

constexpr const node&lt;4&gt; tree2
{
	node<b class="[conum]()">(4)</b>
	{
	}
};

instead of

constexpr const node&lt;4&gt; tree
{
	node&lt;4&gt;
	{
	}
};
@elextr
Copy link

elextr commented Feb 4, 2022

It looks like the <4> at end of line is being detected as a callout

@mojavelinux
Copy link
Member

mojavelinux commented Feb 5, 2022

That's correct. You can disable callouts for a block using the -callouts incremental substitution.

[,cpp,subs=-callouts]
----
constexpr const node<4> tree
{
	node<4 >
	{
	}
};

constexpr const node<4> tree2
{
	node<4>
	{
	}
};
----

To learn more about incremental substitutions, see https://docs.asciidoctor.org/asciidoc/latest/subs/apply-subs-to-blocks/#incremental

@mojavelinux mojavelinux added this to the support milestone Feb 5, 2022
@mojavelinux mojavelinux self-assigned this Feb 5, 2022
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

No branches or pull requests

3 participants