diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2008-12-16 00:00:33 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2008-12-16 00:00:33 +0000 |
| commit | 4d3396fa1f642d2891881a8bffdbe4802e55b736 (patch) | |
| tree | 7cd386fe50eaf127bd29b97e89f67dcdc82692ee /docutils/test | |
| parent | 3afb41c2587386d846d6fd83f35f7dc71793a0eb (diff) | |
| download | docutils-4d3396fa1f642d2891881a8bffdbe4802e55b736.tar.gz | |
Stylesheet handling for html and latex2e writer:
accept multiple stylesheets,
do not rewrite path if stylesheet is to be embedded,
load latex packages with \\usepackage;
fix custom role handling in latex2e: command definition was missing in output
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5823 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test')
8 files changed, 274 insertions, 0 deletions
diff --git a/docutils/test/data/ham.tex b/docutils/test/data/ham.tex new file mode 100644 index 000000000..35e483f99 --- /dev/null +++ b/docutils/test/data/ham.tex @@ -0,0 +1 @@ +\AtBeginDocument{ham ham wonderful ham\\} diff --git a/docutils/test/data/spam.sty b/docutils/test/data/spam.sty new file mode 100644 index 000000000..0be1fee13 --- /dev/null +++ b/docutils/test/data/spam.sty @@ -0,0 +1,4 @@ +\ProvidesPackage{spam} +[2008-12-09 v0.2 simple silly test package] +\RequirePackage{parskip} +\AtBeginDocument{\the\@ne{}\ spam spam wonderfull spam\\} diff --git a/docutils/test/functional/expected/multistyle_path_embed_rst_latex2e.tex b/docutils/test/functional/expected/multistyle_path_embed_rst_latex2e.tex new file mode 100644 index 000000000..85350953b --- /dev/null +++ b/docutils/test/functional/expected/multistyle_path_embed_rst_latex2e.tex @@ -0,0 +1,82 @@ +\documentclass[10pt,a4paper,english]{article} +\usepackage{babel} +\usepackage{ae} +\usepackage{aeguill} +\usepackage{shortvrb} +\usepackage[latin1]{inputenc} +\usepackage{tabularx} +\usepackage{longtable} +\setlength{\extrarowheight}{2pt} +\usepackage{amsmath} +\usepackage{graphicx} +\usepackage{color} +\usepackage{multirow} +\usepackage{ifthen} +\usepackage[DIV12]{typearea} +% generated by Docutils <http://docutils.sourceforge.net/> +\newlength{\admonitionwidth} +\setlength{\admonitionwidth}{0.9\textwidth} +\newlength{\docinfowidth} +\setlength{\docinfowidth}{0.9\textwidth} +\newlength{\locallinewidth} +\newcommand{\optionlistlabel}[1]{\bf #1 \hfill} +\newenvironment{optionlist}[1] +{\begin{list}{} + {\setlength{\labelwidth}{#1} + \setlength{\rightmargin}{1cm} + \setlength{\leftmargin}{\rightmargin} + \addtolength{\leftmargin}{\labelwidth} + \addtolength{\leftmargin}{\labelsep} + \renewcommand{\makelabel}{\optionlistlabel}} +}{\end{list}} +\newlength{\lineblockindentation} +\setlength{\lineblockindentation}{2.5em} +\newenvironment{lineblock}[1] +{\begin{list}{} + {\setlength{\partopsep}{\parskip} + \addtolength{\partopsep}{\baselineskip} + \topsep0pt\itemsep0.15\baselineskip\parsep0pt + \leftmargin#1} + \raggedright} +{\end{list}} +% begin: floats for footnotes tweaking. +\setlength{\floatsep}{0.5em} +\setlength{\textfloatsep}{\fill} +\addtolength{\textfloatsep}{3em} +\renewcommand{\textfraction}{0.5} +\renewcommand{\topfraction}{0.5} +\renewcommand{\bottomfraction}{0.5} +\setcounter{totalnumber}{50} +\setcounter{topnumber}{50} +\setcounter{bottomnumber}{50} +% end floats for footnotes +% some commands, that could be overwritten in the style file. +\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}} +\newcommand{\titlereference}[1]{\textsl{#1}} +% end of "some commands" +% user specified packages and stylesheets: +\makeatletter +% embedded stylesheet: data/spam.sty +\ProvidesPackage{spam} +[2008-12-09 v0.2 simple silly test package] +\RequirePackage{parskip} +\AtBeginDocument{\the\@ne{}\ spam spam wonderfull spam\\} + +\makeatother +% embedded stylesheet: data/ham.tex +\AtBeginDocument{ham ham wonderful ham\\} + +\ifthenelse{\isundefined{\hypersetup}}{ +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +}{} +\title{} +\author{} +\date{} +\raggedbottom +\begin{document} + +\setlength{\locallinewidth}{\linewidth} + +simple input + +\end{document} diff --git a/docutils/test/functional/expected/multistyle_path_rst_latex2e.tex b/docutils/test/functional/expected/multistyle_path_rst_latex2e.tex new file mode 100644 index 000000000..eda45ae53 --- /dev/null +++ b/docutils/test/functional/expected/multistyle_path_rst_latex2e.tex @@ -0,0 +1,73 @@ +\documentclass[10pt,a4paper,english]{article} +\usepackage{babel} +\usepackage{ae} +\usepackage{aeguill} +\usepackage{shortvrb} +\usepackage[latin1]{inputenc} +\usepackage{tabularx} +\usepackage{longtable} +\setlength{\extrarowheight}{2pt} +\usepackage{amsmath} +\usepackage{graphicx} +\usepackage{color} +\usepackage{multirow} +\usepackage{ifthen} +\usepackage[DIV12]{typearea} +% generated by Docutils <http://docutils.sourceforge.net/> +\newlength{\admonitionwidth} +\setlength{\admonitionwidth}{0.9\textwidth} +\newlength{\docinfowidth} +\setlength{\docinfowidth}{0.9\textwidth} +\newlength{\locallinewidth} +\newcommand{\optionlistlabel}[1]{\bf #1 \hfill} +\newenvironment{optionlist}[1] +{\begin{list}{} + {\setlength{\labelwidth}{#1} + \setlength{\rightmargin}{1cm} + \setlength{\leftmargin}{\rightmargin} + \addtolength{\leftmargin}{\labelwidth} + \addtolength{\leftmargin}{\labelsep} + \renewcommand{\makelabel}{\optionlistlabel}} +}{\end{list}} +\newlength{\lineblockindentation} +\setlength{\lineblockindentation}{2.5em} +\newenvironment{lineblock}[1] +{\begin{list}{} + {\setlength{\partopsep}{\parskip} + \addtolength{\partopsep}{\baselineskip} + \topsep0pt\itemsep0.15\baselineskip\parsep0pt + \leftmargin#1} + \raggedright} +{\end{list}} +% begin: floats for footnotes tweaking. +\setlength{\floatsep}{0.5em} +\setlength{\textfloatsep}{\fill} +\addtolength{\textfloatsep}{3em} +\renewcommand{\textfraction}{0.5} +\renewcommand{\topfraction}{0.5} +\renewcommand{\bottomfraction}{0.5} +\setcounter{totalnumber}{50} +\setcounter{topnumber}{50} +\setcounter{bottomnumber}{50} +% end floats for footnotes +% some commands, that could be overwritten in the style file. +\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}} +\newcommand{\titlereference}[1]{\textsl{#1}} +% end of "some commands" +% user specified packages and stylesheets: +\usepackage{../../data/spam} +\input{../../data/ham.tex} +\ifthenelse{\isundefined{\hypersetup}}{ +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +}{} +\title{} +\author{} +\date{} +\raggedbottom +\begin{document} + +\setlength{\locallinewidth}{\linewidth} + +simple input + +\end{document} diff --git a/docutils/test/functional/expected/multistyle_rst_latex2e.tex b/docutils/test/functional/expected/multistyle_rst_latex2e.tex new file mode 100644 index 000000000..8a0112bda --- /dev/null +++ b/docutils/test/functional/expected/multistyle_rst_latex2e.tex @@ -0,0 +1,74 @@ +\documentclass[10pt,a4paper,english]{article} +\usepackage{babel} +\usepackage{ae} +\usepackage{aeguill} +\usepackage{shortvrb} +\usepackage[latin1]{inputenc} +\usepackage{tabularx} +\usepackage{longtable} +\setlength{\extrarowheight}{2pt} +\usepackage{amsmath} +\usepackage{graphicx} +\usepackage{color} +\usepackage{multirow} +\usepackage{ifthen} +\usepackage[DIV12]{typearea} +% generated by Docutils <http://docutils.sourceforge.net/> +\newlength{\admonitionwidth} +\setlength{\admonitionwidth}{0.9\textwidth} +\newlength{\docinfowidth} +\setlength{\docinfowidth}{0.9\textwidth} +\newlength{\locallinewidth} +\newcommand{\optionlistlabel}[1]{\bf #1 \hfill} +\newenvironment{optionlist}[1] +{\begin{list}{} + {\setlength{\labelwidth}{#1} + \setlength{\rightmargin}{1cm} + \setlength{\leftmargin}{\rightmargin} + \addtolength{\leftmargin}{\labelwidth} + \addtolength{\leftmargin}{\labelsep} + \renewcommand{\makelabel}{\optionlistlabel}} +}{\end{list}} +\newlength{\lineblockindentation} +\setlength{\lineblockindentation}{2.5em} +\newenvironment{lineblock}[1] +{\begin{list}{} + {\setlength{\partopsep}{\parskip} + \addtolength{\partopsep}{\baselineskip} + \topsep0pt\itemsep0.15\baselineskip\parsep0pt + \leftmargin#1} + \raggedright} +{\end{list}} +% begin: floats for footnotes tweaking. +\setlength{\floatsep}{0.5em} +\setlength{\textfloatsep}{\fill} +\addtolength{\textfloatsep}{3em} +\renewcommand{\textfraction}{0.5} +\renewcommand{\topfraction}{0.5} +\renewcommand{\bottomfraction}{0.5} +\setcounter{totalnumber}{50} +\setcounter{topnumber}{50} +\setcounter{bottomnumber}{50} +% end floats for footnotes +% some commands, that could be overwritten in the style file. +\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}} +\newcommand{\titlereference}[1]{\textsl{#1}} +% end of "some commands" +% user specified packages and stylesheets: +\usepackage{../../data/spam} +\input{../../data/ham.tex} +\usepackage{mathpazo} +\ifthenelse{\isundefined{\hypersetup}}{ +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +}{} +\title{} +\author{} +\date{} +\raggedbottom +\begin{document} + +\setlength{\locallinewidth}{\linewidth} + +simple input + +\end{document} diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex index 5a9578faf..7b61d468d 100644 --- a/docutils/test/functional/expected/standalone_rst_latex.tex +++ b/docutils/test/functional/expected/standalone_rst_latex.tex @@ -57,6 +57,19 @@ \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} }{} + +\makeatletter +\providecommand{\DUspan}[2]{% + {% group ("span") to limit the scope of styling commands + \@for\node@class@name:=#1\do{% + \ifcsname docutilsrole\node@class@name\endcsname% + \csname docutilsrole\node@class@name\endcsname% + \fi% + }% + {#2}% node content + }% close "span" +} +\makeatother \title{reStructuredText Test Document\\ \large{Examples of Syntax Constructs} } diff --git a/docutils/test/functional/tests/multistyle_path_embedd_rst_latex2e.py b/docutils/test/functional/tests/multistyle_path_embedd_rst_latex2e.py new file mode 100644 index 000000000..8d6641ed0 --- /dev/null +++ b/docutils/test/functional/tests/multistyle_path_embedd_rst_latex2e.py @@ -0,0 +1,14 @@ +# Source and destination file names. +test_source = "simple.txt" +test_destination = "multistyle_path_embed_rst_latex2e.tex" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "latex2e" + +# Settings +# test for encoded attribute value: +settings_overrides['stylesheet'] = '' +settings_overrides['stylesheet_path'] = 'data/spam,data/ham.tex' +settings_overrides['embed_stylesheet'] = 1 diff --git a/docutils/test/functional/tests/multistyle_path_rst_latex2e.py b/docutils/test/functional/tests/multistyle_path_rst_latex2e.py new file mode 100644 index 000000000..4af822a67 --- /dev/null +++ b/docutils/test/functional/tests/multistyle_path_rst_latex2e.py @@ -0,0 +1,13 @@ +# Source and destination file names. +test_source = "simple.txt" +test_destination = "multistyle_path_rst_latex2e.tex" + +# Keyword parameters passed to publish_file. +reader_name = "standalone" +parser_name = "rst" +writer_name = "latex2e" + +# Settings +settings_overrides['stylesheet'] = '' +settings_overrides['stylesheet_path'] = 'data/spam,data/ham.tex' +settings_overrides['embed_stylesheet'] = 0 |
