openSUSE / suse-xsl

DocBook XSL Stylesheets for SUSE branding
Other
11 stars 10 forks source link

Fix line break behavior of inline code/literals in PDF #427

Open ghost opened 3 years ago

ghost commented 3 years ago

ptinley made us aware of the things they undertake to fix display of tables in the AY Guide (for 15 SP2), we should try to see what we can do to make this work less necessary, e.g. add zero-width spaces within literals in PDF.

(This is probably a dupe but I guess it bears repeating.)

janajaeger commented 2 years ago

@jfaltenbacher Can you try to find out what Stefan meant by this? If we can't verify what's behind this report we'd have to close it.

janajaeger commented 2 years ago

Also, as we want to handle PDF generating differently in the future, we might not want to touch legacy PDF stylesheets at all.

jfaltenbacher commented 2 years ago

I will ask Patrick directly, if he can explain.

Will ask Padraig first, if he has some conversation on this

ptinley-vt commented 2 years ago

Hi all,

  1. There are more complete details on this issue in Issue #325

Stefan was suggesting running a S&R routine on the XML to replace occurrences of "</literal>、<literal>" (notice Chinese comma and no space separation) with "</literal>、&#x200b;<literal>" (adding a zero-width-space character which will fix PDF rendering and at the same time not make presentation of the Chinese HTML worse by using a normal space, which would look wrong in Chinese). This will allow the lines to break automatically where they need to.

So, the following: <para> 通过以下命令访问控制文件:<literal>autoyast=nfs://..</literal>、<literal>autoyast=ftp://..</literal>、<literal>autoyast=http://..</literal>、<literal>autoyast=https://..</literal>、<literal>autoyast=tftp://..</literal> 或 <literal>autoyast=cifs://..</literal>。需使用 linuxrc 中的引导选项定义网络访问。可以通过 DHCP 执行此操作:<command>netsetup=dhcp autoyast=http://<replaceable>163.122.3.5/autoyast.xml</replaceable></command> </para> would become: <para> 通过以下命令访问控制文件:<literal>autoyast=nfs://..</literal>、&#x200b;<literal>autoyast=ftp://..</literal>、&#x200b;<literal>autoyast=http://..</literal>、&#x200b;<literal>autoyast=https://..</literal>、&#x200b;<literal>autoyast=tftp://..</literal> 或 <literal>autoyast=cifs://..</literal>。需使用 linuxrc 中的引导选项定义网络访问。可以通过 DHCP 执行此操作:<command>netsetup=dhcp autoyast=http://<replaceable>163.122.3.5/autoyast.xml</replaceable></command> </para> See current file, which was manually edited to make this work (line 431): https://github.com/SUSE/doc-sle/blob/maintenance/SLE15SP4/l10n/sles/zh-cn/xml/ay_auto_installation.xml

  1. Chinese, and Japanese, which do not use spaces to break words, also produce long lines like:

    值:auto.master、ethers、group、hosts、netgrp、networks、passwd、protocols、rpc、services、shadow

I think we will have to rely on DTP QA to catch such occurrences, since these terms are not in <literal> elements.

  1. While #325 gives examples of tables, the title of this bug also mentions Code blocks.

An example of text overflow can also be seen in the AutoYaST book, English, page 160: https://documentation.suse.com/sles/15-SP4/pdf/book-autoyast_color_en.pdf This is a different issue. zero-width-spaces are not a solution here. This particular example was an issue in the source English which then appears in the localised book. Sometimes, I think with ZH_TW, which uses a percentage resize on the fonts, text in code blocks can get enlarged and the line-breaks need to be redone to make it work in the rendered PDF.

tomschr commented 1 year ago

It seems, for SLE15SP4 tables are replaced by lists. Lists don't have these problems that Patrick described above.

Need to investigate further.

jfaltenbacher commented 1 year ago

@ptinley-vt please check with current SLE 15 SP5 loc drop if the issue still occurs

ptinley-vt commented 1 year ago

@jfaltenbacher, in SLE 15 SP5 I have used the zero-width-space character (​) to improve layout of a number of issues in the SLES AutoYaST Guide and the SLES and SLED Security Guides by breaking lines. These issues were found by QAing the PDFs. ay_auto_installation.xml ay_erb_templates.xml ay_nis_server.xml ay_partitioning.xml ay_rules_classes.xml systemd.xml x11_fonts.xml apparmor_profiles.xml audit_setup.xml rmt_rmt-cli.xml user_management.xml