Page 1 of 1

unwanted returns in <codeblock>

Posted: Wed Jul 25, 2018 9:08 pm
by bloodnok
I discovered a couple of unwanted carriage returns <codeblock> elements in my Chemistry output.

First is a return after "for" and "lastline" in this screenshot

Second is a return between "-" and ">" (which is supposed to be a prompt) in this screenshot

Is this a known issue? Is there a workaround I can try?


Re: unwanted returns in <codeblock>

Posted: Thu Jul 26, 2018 12:07 pm
by Costin
Hi bloodnok,

Unfortunately, we can not see the images to observe what happens.
You could send the images on our support email

However, please note that the <codeblock> elements are intentionally displayed as they appear in the source file.
Therefore, if you have carriage returns in your source file, they will be kept also in the output code block, as codeblocks keep all the white space characters unaltered.

If you double check and make sure the whitespaces or carriage returns are not present in your source file but appear in the codeblock, please send us a sample source file that you use and reproduce the issue with to the support email mentioned above, or as attachment using the tech-support form on our website.

Best Regards,

Re: unwanted returns in <codeblock>

Posted: Tue Jul 31, 2018 2:39 am
by bloodnok
the urls to the images are ... e.png?dl=0 and ... t.png?dl=0

i double-checked my codeblocks. the unwanted returns are not in the source. i even added extra elements to see if that would eliminate the unwanted returns but no dice. i previously sent you files wherein you solved an issue with pagination. this bug is in the same files.

Re: unwanted returns in <codeblock>

Posted: Wed Aug 01, 2018 3:59 pm
by Costin
I'm afraid that, as we are not aware of such issues, without looking into your source file, we can not investigate this.
Therefore, please send on our support email ( address a sample file that you could reproduce the issue with and we will see what goes wrong.


Re: unwanted returns in <codeblock>

Posted: Tue Aug 21, 2018 5:39 pm
by bloodnok
for anyone else experiencing this issue, the synchrosoft folks found a workaround was to disable the <code> tag that gets inserted into <pre> blocks. they provided some css that neutralises the <code>. another solution is to mangle the output html to delete the <code> tags (they serve no purpose that i can discern). here's the ant method i use:

Code: Select all

<!--remove the <code> tags from the <pre> blocks-->
<replaceregexp file="${pub.dir}/index.html" flags="gs" match="codeblock"><code>"
replace="codeblock">" byline="true"/>
<replaceregexp file="${pub.dir}/index.html" flags="gs" match="</code></pre>"
replace="</pre>" byline="true"/>
hope this helps.

Re: unwanted returns in <codeblock>

Posted: Tue May 14, 2019 1:21 pm
by bridget.rooney

This is an old thread but I am experiencing a similar issue.

I am creating PDF from DITA using CSS. My source file contains long lines of code that need to spill onto the next line in the rendered PDF, but they are being split into two lines with hard break. This means that the command fails when users copy it from the PDF to the command line (because it comes in as two commands).
Is there a way to keep this as a single line that wraps in the PDF?
(note that you cannot see this in the PDF so you copy the line and it's unclear why it fails when pasted to the CLI)

Thanks for any help!

# This is the actual shell cmd
$gist = invoke-blahblah -Method blahblah-Uri $URL -Body $JSON -blahblah application/json

Here is the text copied from the PDF.

# This is the actual shell cmd
$gist = invoke-blahblah -Method blahblah -Uri $URL -Body $JSON
blahblah application/json

Re: unwanted returns in <codeblock>

Posted: Tue May 14, 2019 3:43 pm
by Dan
Hello Bridget,

Please try different PDF Readers.
I see that the one from Chrome works completely different from the Acrobat Reader.
The first one sets newlines after each visual line, while Acrobat is putting the entire codeblock on a single line, that is bad also.

Many regards,

Re: unwanted returns in <codeblock>

Posted: Tue May 14, 2019 7:54 pm
by bridget.rooney
Thanks Dan.
But Chrome and Edge both render this as hard line breaks. This is on Windows 36bit
Looks like Acrobat Reader and Acrobat Pro both wrap without creating a hard break on a line feed (LF). Which is what we want.

I will try some others to see how they behave.
Thanks for the insight!

Re: unwanted returns in <codeblock>

Posted: Wed May 15, 2019 10:28 pm
by bloodnok
Hard returns in PDF aren't unique to Chemistry. We've had this issue since as long as we've provided PDF documentation. The workaround we used in my previous lives was to manually break the line and use the backslash character. So your source would be:

Code: Select all

# This is the actual shell cmd
$gist = invoke-blahblah -Method blahblah -Uri $URL -Body $JSON \
blahblah application/json
Hope this helps