Groups
Groups
Sign in
Groups
Groups
sphinx-users
Conversations
About
Send feedback
Help
Rst syntax for inline text in another language
65 views
Skip to first unread message
Coderoo
unread,
Jan 9, 2020, 3:06:50 PM
1/9/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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:
https://stackoverflow.com/questions/59657752/how-do-i-specify-arabic-text-in-restructuredtext-for-sphinx-doc
Libor Jelinek
unread,
Jan 10, 2020, 2:29:33 AM
1/10/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sphinx...@googlegroups.com
One approach is to create custom role (
https://docutils.sourceforge.io/docs/ref/rst/directives.html#raw-directive
):
.. 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