unwanted returns in <codeblock>

bloodnok
Posts: 36
Joined: Mon Jun 27, 2011 10:51 pm

unwanted returns in <codeblock>

Post by bloodnok » Wed Jul 25, 2018 9:08 pm

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
Image

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

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

Thanks

Costin
Posts: 570
Joined: Mon Dec 05, 2011 6:04 pm

Re: unwanted returns in <codeblock>

Post by Costin » Thu Jul 26, 2018 12:07 pm

Hi bloodnok,

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

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,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

bloodnok
Posts: 36
Joined: Mon Jun 27, 2011 10:51 pm

Re: unwanted returns in <codeblock>

Post by bloodnok » Tue Jul 31, 2018 2:39 am

the urls to the images are https://www.dropbox.com/s/bfdunb1ymddoc ... e.png?dl=0 and https://www.dropbox.com/s/oijwvpzsm2hvv ... 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.

Costin
Posts: 570
Joined: Mon Dec 05, 2011 6:04 pm

Re: unwanted returns in <codeblock>

Post by Costin » Wed Aug 01, 2018 3:59 pm

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 (support@oxygenxml.com) address a sample file that you could reproduce the issue with and we will see what goes wrong.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

bloodnok
Posts: 36
Joined: Mon Jun 27, 2011 10:51 pm

Re: unwanted returns in <codeblock>

Post by bloodnok » Tue Aug 21, 2018 5:39 pm

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-->
<!--codeblock"><code>-->
<replaceregexp file="${pub.dir}/index.html" flags="gs" match="codeblock"><code>"
replace="codeblock">" byline="true"/>
<!--</code></pre>-->
<replaceregexp file="${pub.dir}/index.html" flags="gs" match="</code></pre>"
replace="</pre>" byline="true"/>
hope this helps.

bridget.rooney
Posts: 4
Joined: Thu Oct 02, 2014 7:35 pm

Re: unwanted returns in <codeblock>

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

Hi,

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!

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

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
Thank you kindly for your time

Dan
Posts: 395
Joined: Mon Feb 03, 2003 10:56 am

Re: unwanted returns in <codeblock>

Post by Dan » Tue May 14, 2019 3:43 pm

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,
Dan

bridget.rooney
Posts: 4
Joined: Thu Oct 02, 2014 7:35 pm

Re: unwanted returns in <codeblock>

Post by bridget.rooney » Tue May 14, 2019 7:54 pm

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!
Thank you kindly for your time

bloodnok
Posts: 36
Joined: Mon Jun 27, 2011 10:51 pm

Re: unwanted returns in <codeblock>

Post by bloodnok » Wed May 15, 2019 10:28 pm

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

Post Reply