Reuse within codeblocks

Post here questions and problems related to editing and publishing DITA content.
tpopp
Posts: 6
Joined: Tue Jan 31, 2023 9:24 pm

Reuse within codeblocks

Post by tpopp »

I have a series of questions in a reuse file marked with unique IDs for reuse.
I'm trying to pull various questions from the reuse file into a codeblock in one of my topics. However, the formatting gets messed up. A line break and additional spaces are put in the middle of each reused question in the target file.
Is it possible to use reuse effectively within codeblocks? If not, is there a workaround to achieve the codeblock look with pieces reused from another file? If I put the reused questions as an unordered list in the target file instead of a codeblock, the questions are not broken midstream, but of course, it looks like a bulleted list instead of a code example.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Reuse within codeblocks

Post by Radu »

Hi,
Codeblocks are space preserve so probably what happens is that any content pulled in the codeblock by using conref will contain in the published output exactly the line breaks and formatting they had in the XML content.
This use case of using a codeblock to conref to a list seems kind of strange to me.
Maybe you could achieve what you want using CSS, maybe set an @outputclass attribute with a special value on the <ol> which does the conref:

Code: Select all

<ol outputclass="questions" conref=".....">
And then use a custom CSS stylesheet which matches ".questions" and adds specific styling to the ol, maybe a specific background color and a border...
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tpopp
Posts: 6
Joined: Tue Jan 31, 2023 9:24 pm

Re: Reuse within codeblocks

Post by tpopp »

The part I'm pulling in as reuse use has no formatting other than being enclosed in systemoutput elements. No line breaks. These are configuration questions in our software system. We have them in reuse because the wording could change, and we refer to these questions in multiple places in our docs. Sometimes, we have a series of them in a codeblock. Other times, we have just one in a paragraph.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Reuse within codeblocks

Post by Radu »

Hi,
I'm not sure if I understand how things are structured on your side. Maybe you can create a small sample project with a map and 1-2 topics, zip it and send it over (support@oxygenxml.com), then I could try to find some time to look at the samples.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply