Extra space added for <codeblock> and <codeph>
Having trouble installing Oxygen PDF Chemistry? Got a bug to report? Post it all here.
-
- Posts: 30
- Joined: Mon Jul 10, 2017 2:18 am
Extra space added for <codeblock> and <codeph>
Post by shanweizhong »
Hi everyone,
I'm using "DITA Map PDF - based on HTML5 & CSS" in XML Author 21 to generate PDF documents, and I found sometimes an extra space is inserted for the <codeblock> and <codeph> tags.
Thanks,
Michael
I'm using "DITA Map PDF - based on HTML5 & CSS" in XML Author 21 to generate PDF documents, and I found sometimes an extra space is inserted for the <codeblock> and <codeph> tags.
- For the following code, and extra space is inserted at the beginning of the code block:
Code: Select all
by removing the following two lines: <codeblock><extension module="org.jboss.as.jaxrs"/> <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/></codeblock>
- For the <codeph> tag, if a punctuation mark such as a comma or period is added right after it, an extra space is inserted before the punctuation mark. Like in the following code:
Code: Select all
...are also controlled in <codeph>customer.xml</codeph>.
Thanks,
Michael
Re: Extra space added for <codeblock> and <codeph>
Hello Michael,
The transformation add a code inside the pre element. This is an inline element, that has some padding set from the built-in CSS. You should remove its padding:
I fixed this in the default CSSs.
If you encounter more problems, please consider debugging the CSS as explained here:
https://www.oxygenxml.com/doc/versions/ ... e_css.html
Thank you for the feedback,
Dan
The transformation add a code inside the pre element. This is an inline element, that has some padding set from the built-in CSS. You should remove its padding:
Code: Select all
pre{
padding:2px 4px;
}
pre > code{
padding:0;
}
If you encounter more problems, please consider debugging the CSS as explained here:
https://www.oxygenxml.com/doc/versions/ ... e_css.html
Thank you for the feedback,
Dan
-
- Posts: 907
- Joined: Thu May 02, 2019 2:32 pm
Re: Extra space added for <codeblock> and <codeph>
Post by chrispitude »
Hi Michael,
After Oxygen XML Support guided me to open the merged HTML in Chrome and inspect styles there, I have been using it quite heavily to debug PDF formatting issues. I imagine you'll find it quite useful too!
Don't forget to set the rendering mode to "print":
https://www.oxygenxml.com/doc/versions/ ... gging.html
After Oxygen XML Support guided me to open the merged HTML in Chrome and inspect styles there, I have been using it quite heavily to debug PDF formatting issues. I imagine you'll find it quite useful too!
Don't forget to set the rendering mode to "print":
https://www.oxygenxml.com/doc/versions/ ... gging.html
-
- Posts: 30
- Joined: Mon Jul 10, 2017 2:18 am
Re: Extra space added for <codeblock> and <codeph>
Post by shanweizhong »
Thanks so much, guys. I will try to upgrade to Oxygen 21.1 then.
Cheers,
Michael
Cheers,
Michael
-
- Posts: 30
- Joined: Mon Jul 10, 2017 2:18 am
Re: Extra space added for <codeblock> and <codeph>
Post by shanweizhong »
Tried Oxygen 21.1 and found that the issue was not fixed. In addition, my document title goes up and overlaps with the company icon. I think the "margin-top" property does not work properly in the following code:
Guess I'd better revert to Oxygen 21 and fix the issue manually.
Code: Select all
/* Document title on cover page */
*[class~="front-page/front-page-title"] {
display: block;
text-align: center;
margin-top: 34%;
font-size: 2.6em;
font-weight: bold;
line-height: 105%;
}
-
- Posts: 30
- Joined: Mon Jul 10, 2017 2:18 am
Re: Extra space added for <codeblock> and <codeph>
Post by shanweizhong »
Hi Dan,
I tried your code and the issue was basically fixed. However, for the <codeph> before a punctuation mark, such as a comma or a period, an extra space is still inserted before the punctuation mark. I think it is not a padding issue because for <codeph> between two words, everything is okay. And I checked the generated HTML and found nothing was inserted there.
Do you have any idea how to fix that issue?
Cheers,
Michael
I tried your code and the issue was basically fixed. However, for the <codeph> before a punctuation mark, such as a comma or a period, an extra space is still inserted before the punctuation mark. I think it is not a padding issue because for <codeph> between two words, everything is okay. And I checked the generated HTML and found nothing was inserted there.
Do you have any idea how to fix that issue?
Cheers,
Michael
Dan wrote: ↑Thu May 16, 2019 10:16 am Hello Michael,
The transformation add a code inside the pre element. This is an inline element, that has some padding set from the built-in CSS. You should remove its padding:
I fixed this in the default CSSs.Code: Select all
pre{ padding:2px 4px; } pre > code{ padding:0; }
If you encounter more problems, please consider debugging the CSS as explained here:
https://www.oxygenxml.com/doc/versions/ ... e_css.html
Thank you for the feedback,
Dan
Re: Extra space added for <codeblock> and <codeph>
Hello Michael,
I tried to use the DITA sample:
and the standard HTML transformation using the 'ashes' template but I cannot reproduce the problem.
Please try to use a standard publishing template (the first tab in the transformation scenario), with no customization.
Open the FO file from the output folder and search for the codeph text. Check if there is a space in the text. You can take a look also into the .style.xml file.
If you do not detect the cause, please send us more details, like the full DITA fragment, and the FO fragment.
Many regards,
Dan
I tried to use the DITA sample:
Code: Select all
[Oxygen Install Dir]\samples\dita\it-book\taskbook.ditamap
Please try to use a standard publishing template (the first tab in the transformation scenario), with no customization.
Open the FO file from the output folder and search for the codeph text. Check if there is a space in the text. You can take a look also into the .style.xml file.
If you do not detect the cause, please send us more details, like the full DITA fragment, and the FO fragment.
Many regards,
Dan
-
- Posts: 30
- Joined: Mon Jul 10, 2017 2:18 am
Re: Extra space added for <codeblock> and <codeph>
Post by shanweizhong »
Hi Dan,
It is not that obvious in the generated PDF. If you copy the text into a text editor, you will see an extra space before the punctuation mark. I tested again and found that there is no extra space in the .fo file. Guess the issue might be related to the process that transforms the .fo and .html files into a single PDF.
My environment is as follows:
My test DITAMAP file is as follows:
The relevant code in the generated .fo file is as follows:
If I copy the text from the generated PDF and paste into a text editor, the result is as follows:
Note there is a space between the letter h and the period.
Let me know if you need more info.
Cheers,
Michael
It is not that obvious in the generated PDF. If you copy the text into a text editor, you will see an extra space before the punctuation mark. I tested again and found that there is no extra space in the .fo file. Guess the issue might be related to the process that transforms the .fo and .html files into a single PDF.
My environment is as follows:
- Version: Oxygen Author 21
- Transformation Scenario: DITA Map PDF - based on HTML5 & CSS
- Template: Ashes [tiles]
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="test">
<title>test</title>
<shortdesc></shortdesc>
<conbody>
<p>This is a test for <codeph>codeph</codeph>.</p>
</conbody>
</concept>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<title>test map</title>
<topicref href="test.dita"/>
</map>
Code: Select all
<fo:block-container margin-bottom="0.5em" margin-left="0" margin-right="0" margin-top="1em"><fo:block end-indent="0" start-indent="0">This is a test for <fo:inline font-family="monospace" font-size="smaller" role="Code" padding-bottom="2px" padding-left="4px" padding-right="4px" padding-top="2px">codeph</fo:inline>.</fo:block></fo:block-container>
Code: Select all
This is a test for codeph .
Let me know if you need more info.
Cheers,
Michael
Re: Extra space added for <codeblock> and <codeph>
Thank you for the details!
The problem is caused by the. This looks like either our fix from the built-in CSS is not working, or you have such padding set in the customization CSS.
Please open the merged HTML file in a browser (Chrome for instance), and using the developer tools inspect the element containing the codeph text. You will see what rules are applying and from what CSS.
More information about debugging the CSSs is here: https://www.oxygenxml.com/doc/versions/ ... ng_the_css
Many regards,
Dan
The problem is caused by the
Code: Select all
padding-right="4px"
Please open the merged HTML file in a browser (Chrome for instance), and using the developer tools inspect the element containing the codeph text. You will see what rules are applying and from what CSS.
More information about debugging the CSSs is here: https://www.oxygenxml.com/doc/versions/ ... ng_the_css
Many regards,
Dan
-
- Posts: 30
- Joined: Mon Jul 10, 2017 2:18 am
Re: Extra space added for <codeblock> and <codeph>
Post by shanweizhong »
You are quite right, Dan. I added the following code into my customization css and the problem was solved:
Thanks again!
Cheers,
Michael
Code: Select all
code{
padding:0 0 !important;
}
Cheers,
Michael
-
- Posts: 30
- Joined: Mon Jul 10, 2017 2:18 am
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service