bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no-op brace command not starting a paragraph for mixing with raw out


From: Gavin Smith
Subject: Re: no-op brace command not starting a paragraph for mixing with raw output
Date: Tue, 20 Dec 2022 17:30:22 +0000

On Tue, Dec 20, 2022 at 12:02:30AM +0100, Patrice Dumas wrote:

> It is already the case that raw block commands do not start paragraphs.
> But then it is not possible to mix them with Texinfo code.
> 
> Here is the example that cannot work, based on Arnold case:
> 
> @c =======================================================
> @ifdocbook
> @macro cartouchetitle {title}
> @docbook
> <title>
> @end docbook
> \title\
> @docbook
> </title>
> @end docbook
> @end macro
> @end ifdocbook
> 
> @ifnotdocbook
> @macro cartouchetitle {title}
> @center @b{\title\}
> @end macro
> @end ifnotdocbook
> 
> 
> @cartouche
> @cartouchetitle Sidebar Title Here
> Cartouche text
> @end cartouche
> 
> @c =======================================================
> 
> 
> 
> For DocBook this expands to something like:
> 
> <sidebar><title>
> <para>Sidebar Title Here
> </title>
> Cartouche text</para>
> </sidebar>
> 
> The 'Sidebar' string starts a paragraph.  That's what I would like to
> avoid.  The issue is with mixing Texinfo and raw DocBook outside of a
> paragraph.

It can be done if there are no special characters in the title:

@ifdocbook
@macro cartouchetitle {title}
@docbook
<title>\title\</title>
@end docbook
@end macro
@end ifdocbook

This may break if any special characters occur in the title:

@cartouche
@cartouchetitle @}@{<start>@@
Cartouche text
@end cartouche

producing

<sidebar><title>}{<start>@</title>
<para>Cartouche text
</para></sidebar>

and the < and > are not protected.

This may not be a problem as long as the user avoids using characters
in titles that are special in any output format.  Otherwise the user
would have to take care of escaping the characters for each output format.

Adding a new @-command is a possibility here although I'm not sure if it
would be necessary or how well it could work.  What happens when the
character needs to be escaped in different ways depending on the context
in the output format?  For example, in LaTeX output, special characters
may be escaped differently in math mode, \ being \textbackslash{} in
text mode and \mathtt{\backslash{}} in math mode.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]