Support bidirectional text output with XeLaTeX, ConTeXt and HTML

This commit is contained in:
mb21 2015-09-26 21:28:09 +02:00
parent 04bdf5a9b7
commit 0b80b7006f
3 changed files with 22 additions and 1 deletions

View file

@ -5,6 +5,10 @@
$if(context-lang)$ $if(context-lang)$
\mainlanguage[$context-lang$] \mainlanguage[$context-lang$]
$endif$ $endif$
$if(context-dir)$
\setupalign[$context-dir$]
\setupdirections[bidi=on,method=two]
$endif$
% Enable hyperlinks % Enable hyperlinks
\setupinteraction[state=start, color=middleblue] \setupinteraction[state=start, color=middleblue]

View file

@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$> <html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Style-Type" content="text/css" />

View file

@ -139,6 +139,23 @@ $endif$
$if(verbatim-in-note)$ $if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes \VerbatimFootnotes % allows verbatim text in footnotes
$endif$ $endif$
$if(dir)$
\ifxetex
% load bidi as late as possible as it modifies e.g. graphicx
$if(latex-dir-rtl)$
\usepackage[RTLdocument]{bidi}
$else$
\usepackage{bidi}
$endif$
\fi
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\TeXXeTstate=1
\newcommand{\RL}[1]{\beginR #1\endR}
\newcommand{\LR}[1]{\beginL #1\endL}
\newenvironment{RTL}{\beginR}{\endR}
\newenvironment{LTR}{\beginL}{\endL}
\fi
$endif$
$if(title)$ $if(title)$
\title{$title$$if(subtitle)$\\\vspace{0.5em}{\large $subtitle$}$endif$} \title{$title$$if(subtitle)$\\\vspace{0.5em}{\large $subtitle$}$endif$}