RTL languages in reStructredText (docutils)

Abdullah Al-hadab <[email protected]> Fri, 15 Jan 2021 22:16:09 +0000
Newsgroups gmane.text.docutils.user
Message-ID <AS8PR02MB65357A50CA1C77E89DF55DC6F1A70@AS8PR02MB6535.eurprd02.prod.outlook.com>
Hi ,

I have translated docutils to Arabic, and it is working fine, however, I am getting the direction wrong ( text is aligned to left)
[cid:[email protected]]

I saw these two scripts on Docutils FAQ (Frequently Asked Questions) (sourceforge.io)<https://docutils.sourceforge.io/FAQ.html#can-i-produce-documents-in-right-to-left-languages> , which should solve this issue.

I followed the instruction but when I run rst2html_bidi  I get the following error

AttributeError: 'Element' object has no attribute 'dir'
Exiting due to error.  Use "--traceback" to diagnose.
Please report errors to <[email protected]>.
Include "--traceback" output, Docutils version (0.17b.dev [release]),
Python version (3.7.9), your OS type & version, and the
command line used.


Traceback (most recent call last):
  File "./rst2html_hibidi.py", line 38, in <module>
    publish_cmdline(writer=HiBiDiWriter(), description=description)
  File "/home/geohadab/github/docutils/docutils/docutils/core.py", line 355, in publish_cmdline
    config_section=config_section, enable_exit_status=enable_exit_status)
  File "/home/geohadab/github/docutils/docutils/docutils/core.py", line 220, in publish
    output = self.writer.write(self.document, self.destination)
  File "/home/geohadab/github/docutils/docutils/docutils/writers/__init__.py", line 79, in write
    self.translate()
  File "./rst2html_hibidi.py", line 30, in translate
    self.output = hibidi.hibidi_unicode(self.output, encoding=self.destination.encoding)
  File "/home/geohadab/github/hibidi.py", line 34, in hibidi_unicode
    return hibidi_str(u.encode(encoding), root).decode(encoding)
  File "/home/geohadab/github/hibidi.py", line 39, in hibidi_str
    hibidi_dom(doc, root)
  File "/home/geohadab/github/hibidi.py", line 50, in hibidi_dom
    assign_dirs(node)
  File "/home/geohadab/github/hibidi.py", line 101, in assign_dirs
    assign_dirs(child, node.dir)
  File "/home/geohadab/github/hibidi.py", line 101, in assign_dirs
    assign_dirs(child, node.dir)
  File "/home/geohadab/github/hibidi.py", line 97, in assign_dirs
    if not node.dir:
AttributeError: 'Element' object has no attribute 'dir'


Could you please help


Thank you
image003.jpg (image/jpeg, 11.4 KB) - not displayed