Added writers-lang-and-dir test, fixed ConTeXt writer test

The writers-lang-and-dir testGroup tests LaTeX and ConTeXt
writers' language and directionality output
This commit is contained in:
mb21 2015-10-17 14:48:42 +02:00
parent 9328f4cd3d
commit fa2b26ddcb
5 changed files with 309 additions and 0 deletions

View file

@ -165,6 +165,12 @@ tests = [ testGroup "markdown"
[ "opendocument" , "context" , "texinfo", "icml"
, "man" , "plain" , "rtf", "org", "asciidoc"
]
, testGroup "writers-lang-and-dir"
[ test "latex" ["-f", "native", "-t", "latex", "-s"]
"writers-lang-and-dir.native" "writers-lang-and-dir.latex"
, test "context" ["-f", "native", "-t", "context", "-s"]
"writers-lang-and-dir.native" "writers-lang-and-dir.context"
]
]
-- makes sure file is fully closed after reading

View file

@ -545,11 +545,13 @@ Blank line after term, indented marker, alternate markers:
Simple block on one line:
foo
And nested without indentation:
foo
bar
Interpreted markdown in a table:
This is {\em emphasized}
@ -575,6 +577,7 @@ As should this:
Now, nested:
foo
This should just be an HTML comment:
Multiline:

View file

@ -0,0 +1,111 @@
\startmode[*mkii]
\enableregime[utf-8]
\setupcolors[state=start]
\stopmode
% Enable hyperlinks
\setupinteraction[state=start, color=middleblue]
\setuppapersize [letter][letter]
\setuplayout [width=middle, backspace=1.5in, cutspace=1.5in,
height=middle, topspace=0.75in, bottomspace=0.75in]
\setuppagenumbering[location={footer,center}]
\setupbodyfont[11pt]
\setupwhitespace[medium]
\setuphead[chapter] [style=\tfd]
\setuphead[section] [style=\tfc]
\setuphead[subsection] [style=\tfb]
\setuphead[subsubsection][style=\bf]
\setuphead[chapter, section, subsection, subsubsection][number=no]
\definedescription
[description]
[headstyle=bold, style=normal, location=hanging, width=broad, margin=1cm, alternative=hanging]
\setupitemize[autointro] % prevent orphan list intro
\setupitemize[indentnext=no]
\setupfloat[figure][default={here,nonumber}]
\setupfloat[table][default={here,nonumber}]
\setupthinrules[width=15em] % width of horizontal rules
\setupdelimitedtext
[blockquote]
[before={\blank[medium]},
after={\blank[medium]},
indentnext=no,
]
\starttext
\section[empty-divs-and-spans]{Empty Divs and Spans}
Some text and
div contents
and more text.
Next paragraph with a span and a word-thatincludesaspanright?
\section[directionality]{Directionality}
Some text and
\startalignment[righttoleft]
rtl div contents
\stopalignment
and more text.
\startalignment[lefttoright]
and a ltr div. with a {\righttoleft rtl span}.
\stopalignment
Next paragraph with a {\righttoleft rtl span} and a
word-that-includesa{\lefttoright ltrspan}right?
\section[languages]{Languages}
Some text and
\start\language[de]
German div contents
\stop
and more text.
Next paragraph with a \start\language[en-gb]British span\stop and a
word-that-includesa\start\language[de-ch]Swiss German span\stop right?
Some \start\language[es]Spanish text\stop .
\section[combined]{Combined}
Some text and
\start\language[fr]
\startalignment[righttoleft]
French rtl div contents
\stopalignment
\stop
and more text.
Next paragraph with a \start\language[en-gb]{\lefttoright British ltr
span}\stop and a
word-that-includesa\start\language[de-ch]{\lefttoright Swiss German ltr
span}\stop right?
\stoptext

View file

@ -0,0 +1,166 @@
\documentclass[english,]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
\usepackage{mathspec}
\else
\usepackage{fontspec}
\fi
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\newcommand{\euro}{€}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifpackageloaded{hyperref}{}{%
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex
xetex]{hyperref}
\else
\usepackage[unicode=true]{hyperref}
\fi
}
\@ifpackageloaded{color}{
\PassOptionsToPackage{usenames,dvipsnames}{color}
}{%
\usepackage[usenames,dvipsnames]{color}
}
\makeatother
\hypersetup{breaklinks=true,
bookmarks=true,
pdfauthor={},
pdftitle={},
colorlinks=true,
citecolor=blue,
urlcolor=blue,
linkcolor=magenta,
pdfborder={0 0 0}
}
\urlstyle{same} % don't use monospace font for urls
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[shorthands=off,ngerman,british,ngerman,spanish,french,main=english]{babel}
\newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}}
\newenvironment{german}[1]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}
\newcommand{\textenglish}[2][]{\foreignlanguage{british}{#2}}
\newenvironment{english}[1]{\begin{otherlanguage}{british}}{\end{otherlanguage}}
\let\oritextspanish\textspanish
\AddBabelHook{spanish}{beforeextras}{\renewcommand{\textspanish}{\oritextspanish}}
\AddBabelHook{spanish}{afterextras}{\renewcommand{\textspanish}[2][]{\foreignlanguage{spanish}{##2}}}
\newcommand{\textfrench}[2][]{\foreignlanguage{french}{#2}}
\newenvironment{french}[1]{\begin{otherlanguage}{french}}{\end{otherlanguage}}
\else
\usepackage{polyglossia}
\setmainlanguage[]{english}
\setotherlanguage[]{german}
\setotherlanguage[variant=british]{english}
\setotherlanguage[variant=swiss]{german}
\setotherlanguage[]{spanish}
\setotherlanguage[]{french}
\fi
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
\ifxetex
% load bidi as late as possible as it modifies e.g. graphicx
\usepackage{bidi}
\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
\date{}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\begin{document}
\section{Empty Divs and Spans}\label{empty-divs-and-spans}
Some text and
div contents
and more text.
Next paragraph with a span and a word-thatincludesaspanright?
\section{Directionality}\label{directionality}
Some text and
\begin{RTL}
rtl div contents
\end{RTL}
and more text.
\begin{LTR}
and a ltr div. with a \RL{rtl span}.
\end{LTR}
Next paragraph with a \RL{rtl span} and a
word-that-includesa\LR{ltrspan}right?
\section{Languages}\label{languages}
Some text and
\begin{german}
German div contents
\end{german}
and more text.
Next paragraph with a \textenglish[variant=british]{British span} and a
word-that-includesa\textgerman[variant=swiss]{Swiss German span}right?
Some \textspanish{Spanish text}.
\section{Combined}\label{combined}
Some text and
\begin{RTL}
\begin{french}
French rtl div contents
\end{french}
\end{RTL}
and more text.
Next paragraph with a \LR{\textenglish[variant=british]{British ltr
span}} and a word-that-includesa\LR{\textgerman[variant=swiss]{Swiss
German ltr span}}right?
\end{document}

View file

@ -0,0 +1,23 @@
Pandoc (Meta {unMeta = fromList []})
[Header 1 ("empty-divs-and-spans",[],[]) [Str "Empty",Space,Str "Divs",Space,Str "and",Space,Str "Spans"]
,Plain [Str "Some",Space,Str "text",Space,Str "and"]
,Div ("",[],[]) [Para [Str "div",Space,Str "contents"]]
,Para [Str "and",Space,Str "more",Space,Str "text."]
,Para [Str "Next",Space,Str "paragraph",Space,Str "with",Space,Str "a",Space,Span ("",[],[]) [Str "span"],Space,Str "and",Space,Str "a",Space,Str "word-thatincludesa",Span ("",[],[]) [Str "span"],Str "right?"]
,Header 1 ("directionality",[],[]) [Str "Directionality"]
,Plain [Str "Some",Space,Str "text",Space,Str "and"]
,Div ("",[],[("dir","rtl")]) [Para [Str "rtl",Space,Str "div",Space,Str "contents"]]
,Para [Str "and",Space,Str "more",Space,Str "text."]
,Div ("",[],[("dir","ltr")]) [Para [Str "and",Space,Str "a",Space,Str "ltr",Space,Str "div.",Space,Str "with",Space,Str "a",Space,Span ("",[],[("dir","rtl")]) [Str "rtl",Space,Str "span"],Str "."]]
,Para [Str "Next",Space,Str "paragraph",Space,Str "with",Space,Str "a",Space,Span ("",[],[("dir","rtl")]) [Str "rtl",Space,Str "span"],Space,Str "and",Space,Str "a",Space,Str "word-that-includesa",Span ("",[],[("dir","ltr")]) [Str "ltrspan"],Str "right?"]
,Header 1 ("languages",[],[]) [Str "Languages"]
,Plain [Str "Some",Space,Str "text",Space,Str "and"]
,Div ("",[],[("lang","de")]) [Para [Str "German",Space,Str "div",Space,Str "contents"]]
,Para [Str "and",Space,Str "more",Space,Str "text."]
,Para [Str "Next",Space,Str "paragraph",Space,Str "with",Space,Str "a",Space,Span ("",[],[("lang","en-GB")]) [Str "British",Space,Str "span"],Space,Str "and",Space,Str "a",Space,Str "word-that-includesa",Span ("",[],[("lang","de-CH")]) [Str "Swiss",Space,Str "German",Space,Str "span"],Str "right?"]
,Para [Str "Some",Space,Span ("",[],[("lang","es")]) [Str "Spanish",Space,Str "text"],Str "."]
,Header 1 ("combined",[],[]) [Str "Combined"]
,Plain [Str "Some",Space,Str "text",Space,Str "and"]
,Div ("",[],[("lang","fr"),("dir","rtl")]) [Para [Str "French",Space,Str "rtl",Space,Str "div",Space,Str "contents"]]
,Para [Str "and",Space,Str "more",Space,Str "text."]
,Para [Str "Next",Space,Str "paragraph",Space,Str "with",Space,Str "a",Space,Span ("",[],[("lang","en-GB"),("dir","ltr")]) [Str "British",Space,Str "ltr",Space,Str "span"],Space,Str "and",Space,Str "a",Space,Str "word-that-includesa",Span ("",[],[("lang","de-CH"),("dir","ltr")]) [Str "Swiss",Space,Str "German",Space,Str "ltr",Space,Str "span"],Str "right?"]]