Is there any way to change the order and type of n

2019-08-15 05:03发布

问题:

Using restructured texts is an easy way for writing formatted texts. But there are some problems regarding to left to right languages. I appreciate any helpful comment to solve these problems or at least some helpful guidance. I usually use rst2html to convert rst files to htmls.

1- "section-numbering" always produces left to right numbering while in right to left languages like Farsi, Arabic, Urdu, and Hebrew the order of numbers must be reversed. The digits of numbers have the same position as in English. They are left to right. But the order of parts must be reversed For example:

English: (left to right) 2.4 Chapter two, section four

Farsi: (right to left) ‫ 2.4 chapter four, section two ‫ ۲.۴ فصل چهارم , بخش دوم

English: (left to right) 2.4.12 Chapter two, section four, subsection twelve

Farsi: (right to left) ‫ 2.4.12 chapter twelve, section four, subsection two ‫ ۲.۴.۱۲ فصل دوازدهم , بخش چهارم , زیربخش دوم

Section-numbering does their job well when we use only one level numbering:

English: (left to right) 12 Chapter twelve

Farsi: (right to left) ‫ 12 chapter twelve ‫ ۱۲ فصل دوازدهم

This link shows this problem. You can see the rst source of this page.

2- It seems that there is no way to change numbering from 0,1,2....9 to ۰,۱,۲,۳,...,۹

3- It may also be helpful if we can change prefix and suffix in "section-numbering", but there is no way to change middle character Dot or point ( . ). Adding "middle" tag to change middle character is helpful.

.. section-numbering:: :suffix: - :middle: -

2-4-1-

4- I wrote a ccs file to solve some right to left problems, but it was not helpful in this matter. Here is my yoosofan_farsi.css:

/* Use these two if the main document direction is RTL */
body { direction: rtl; text-align:justify;    font-family:'Nazli', Geneva, sans-serif; font-size: 1.1em;}
div.sidebar { float: left !important; }

/* The next 3 rules are very useful in documents containing pieces
of code in english */
/* Use this if you all your literal blocks (::) are LTR */
pre {direction: ltr; unicode-bidi: embed; }
/* Use this if you all your inline literals (``) are LTR */
tt {direction: ltr; unicode-bidi: embed; }
/* Use this if you all your interpretted text (`) is LTR */
cite {direction: ltr; unicode-bidi: embed; }

/* Allow manual direction override by class directive and roles */
.rtl { direction: rtl; }
.ltr { direction: ltr; }
.center {text-align: center;}
.toc-backref {     font-size: 1em;}
.section h1{    font-size: 1.3em;}
.section h2{    font-size: 1.3em;}

I use the following command to convert rst file to html

rst2html myFile.rst myFile.html --stylesheet=yoosofan_farsi.css,html4css1.css