Rst syntax for inline text in another language

65 views
Skip to first unread message

Coderoo

unread,
Jan 9, 2020, 3:06:50 PM1/9/20
to sphinx-users
I'm creating a document in English but with inline Arabic text. I would like to the output HTML to look like the following:

.html:

<span lang="ar" dir="rtl">عربي</span>

.tex (with polyglossia):

\textarabic{عربي}

Does restructured text and Sphinx support this?

Thanks.

Cross-posted here:

Libor Jelinek

unread,
Jan 10, 2020, 2:29:33 AM1/10/20
to sphinx...@googlegroups.com

.. role:: raw-html(raw)
   :format: html


And use it as:

Blaah blaah :raw-html:`<span lang="ar" dir="rtl">fooo</span>` blah.

(Similar for LaTeX.)

It's tedious. So if nobody else will suggest better answer, you should consider writing own role inherited from builtin literal role that adds your attributes. Usage in your RST will look simple like e.g. :literal-arabic:`fooo`.
Reply all
Reply to author
Forward
0 new messages