right to left in docproj

Hello all,

As you may know, some languages are written from right to left. For example Persian, Hebrew and so on. How can I change the text direction to RTL? I'm unable to find something about this in the official documents.
 
Ok, thank you @cpu82.

Let me expand that a little more. Suppose that I have the following book.xml. Sorry for UTF-8 characters.

Code:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<book lang='fa'>
  <bookinfo>
    <title>یک کتاب نمونه</title>

    <author>
      <firstname>نام شما</firstname>
      <surname>نام خانوادگی شما</surname>
      <affiliation>
        <address><email>foo@example.com</email></address>
      </affiliation>
    </author>

    <copyright>
      <year>2013</year>
      <holder>اطلاعات حق تکثیر</holder>
    </copyright>

    <abstract>
      <para>اطلاعات مربوط به کتاب شما</para>
    </abstract>
  </bookinfo>

  <preface>
    <title>مقدمه</title>

    <para>اگر کتاب شما ک مقدمه دارد در این قسمت بنویسید.</para>
  </preface>

  <chapter>
    <title>فصل اول</title>

    <para>این اولین فصل کتاب است.</para>

    <sect1>
      <title>اولین قسمت.</title>

      <para>این اولین قسمت این کتاب است.</para>
    </sect1>
  </chapter>
</book>

I have some problems with this book.xml:

1. The build system simply rejects my book.xml and says that:
Code:
...
/usr/local/bin/openjade:/usr/doc/fa_IR.UTF-8/books/handbook/book.xml:10:16:E: non SGML character number 134
/usr/local/bin/openjade:/usr/doc/fa_IR.UTF-8/books/handbook/book.xml:10:20:E: non SGML character number 133
/usr/local/bin/openjade:/usr/doc/fa_IR.UTF-8/books/handbook/book.xml:10:27:E: non SGML character number 134
/usr/local/bin/openjade:/usr/doc/fa_IR.UTF-8/books/handbook/book.xml:10:29:E: non SGML character number 136
/usr/local/bin/openjade:/usr/doc/fa_IR.UTF-8/books/handbook/book.xml:10:37:E: non SGML character number 140
/usr/local/bin/openjade:/usr/doc/fa_IR.UTF-8/books/handbook/book.xml:10:42:E: non SGML character number 133
...

2. I need to change the text direction to Right-to-Left. So the readers can read it easily. In HTML, most of tags have an attribute named dir. But how about SGML DocBook?

Unfortunately, there's no FreeBSD Persian Documentation Project.
 
Last edited by a moderator:
In XML, the entire range of Unicode characters is available to you, but in SGML, the declaration indicates what characters are valid. The distributed DocBook declaration doesn't allow a bunch of fairly common 8-bit characters. You can fix this by converting them to character entities or by changing the SGML declaration.

If ISO-8859-1 doesn't contain valid characters, probably you have to set the file's encoding to UTF-8.

Add this line in the header of book.xml file.
Code:
[B]<?xml version="1.0" encoding="UTF-8"?>[/B]
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<book lang='fa'>
  <bookinfo>
    <title>یک کتاب نمونه</title>

<snip>

This post explains how to set text direction for any XML parameter.

bkouhi said:
Unfortunately, there's no FreeBSD Persian Documentation Project.

Contact them ;)

admin@freebsd.net.co
armin.rezayati@gmail.com
 
Back
Top