Bug 475077 - fix rtl problems in docbook-xsl
Summary: fix rtl problems in docbook-xsl
Alias: None
Product: Fedora
Classification: Fedora
Component: docbook-style-xsl
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
Keywords: Reopened
Depends On:
TreeView+ depends on / blocked
Reported: 2008-12-07 14:28 UTC by Muayyad Alsadi
Modified: 2009-02-02 15:13 UTC (History)
2 users (show)

Clone Of:
Last Closed: 2009-02-02 14:39:57 UTC

Attachments (Terms of Use)

Description Muayyad Alsadi 2008-12-07 14:28:26 UTC
Description of problem:
some languages like Arabic are written from right to left

this mean that alignment should be mirrored for those languages

I made a patch to fix this

first apply the attached patch with -p1

then run this script

for i in html xhtml
perl -i -wpe 's/align="left"/align="{\$directions.align.start}"/g' ${i}/*
perl -i -wpe 's/align="right"/align="{\$directions.align.end}"/g' ${i}/*

Additional info:
up stream report

Comment 1 Ondrej Vasik 2008-12-07 22:12:45 UTC
Thanks for info and patch, I would like to have it accepted by upstream before adding to Fedora. Additionally there was some perl script cleanup in docbook-* packages to reduce perl build requires, so I would use sed for that if you don't mind - once the proposed patch will be accepted by upstream.

Comment 2 Ondrej Vasik 2009-01-29 14:40:13 UTC
Not only html/xhtml, fo branch has to be fixed as well ... anyway - fix was accepted by upstream and included to latest svn snapshot(although in a bit different way). I tried to backport it to 1.74.0, result built in rawhide as docbook-style-xsl-1.74.0-5.fc11 , please give it a try and let me know if it does work for you. Closing RAWHIDE.

Comment 3 Muayyad Alsadi 2009-01-29 17:13:40 UTC
sure, I'll try it

but the upstream did not set the default encoding to UTF-8

and setting it to UTF-8 with params works only for chunks (not single or main file)

Comment 4 Muayyad Alsadi 2009-01-31 01:06:46 UTC
it did not work
I tried
xsltproc /usr/share/sgml/docbook/xsl-stylesheets/html/docbook.xsl ghelp/ar/RELEASE-NOTES.xml > RELEASE-NOTES-ar.html

after installing the packages
then grep dir= RELEASE-NOTES-ar.html 

if you want to try it yourself just have a document that starts like this
<article id="article" lang="ar_JO">

note: the upstream snapshot works

Comment 5 Ondrej Vasik 2009-02-02 11:05:28 UTC
This seems to work for me:
xsltproc --stringparam writing.mode "rl" /usr/share/sgml/docbook/xsl-stylesheets/html/docbook.xsl arabic.xml >arabic.html

It seems that most of the patch is working, but the language setting from common/ar.xml is ignored (just l10n.xml is called according to xsltproc verbose log)... Will try to check more, please use that stringparam workaround meanwhile.

Comment 6 Muayyad Alsadi 2009-02-02 14:12:58 UTC
you should not pass --stringparam writing.mode "rl"

it should be autodetected with gettext

and while looking into the patch you missed the following lines in html/param.xsl
<xsl:param name="writing.mode">
  <xsl:call-template name="gentext">
    <xsl:with-param name="key">writing-mode</xsl:with-param>
    <xsl:with-param name="lang">
      <xsl:call-template name="l10n.language">
        <xsl:with-param name="target" select="/*[1]"/>

Comment 7 Ondrej Vasik 2009-02-02 14:39:57 UTC
Yep, I knew it should be autodetected, I just said it could be used as temporary workaround. 

Thanks for the fix for my patch, I simply missed that when backporting upstream fix to 1.74.0. It seems to work now correctly for my test arabic xml file, built as docbook-style-xsl-1.74.0-6.fc11 . Closing RAWHIDE again.

Comment 8 Muayyad Alsadi 2009-02-02 15:13:23 UTC
thank you very much
it works for me

Note You need to log in before you can comment on or make changes to this bug.