Accept attributes in inline image syntax
[multimarkdown] / XSLT / envelope.xslt
1 <?xml version='1.0' encoding='utf-8'?>
2
3 <!-- XHTML-to-Envelope converter by Fletcher Penney
4
5         specifically designed for use with MultiMarkdown created XHTML
6
7         Uses the LaTeX memoir class for output
8
9         Creates an envelope to go along with letterhead
10
11         *Requires that you use the mmd-envelope style package for LaTeX,
12                 which is available at http://fletcherpenney.net/XSLT_Files*
13
14         MultiMarkdown Version 2.0.b5
15         
16         $Id: envelope.xslt 470 2008-01-06 18:47:18Z fletcher $
17 -->
18
19 <!-- 
20 # Copyright (C) 2005-2008  Fletcher T. Penney <fletcher@fletcherpenney.net>
21 #
22 # This program is free software; you can redistribute it and/or modify
23 # it under the terms of the GNU General Public License as published by
24 # the Free Software Foundation; either version 2 of the License, or
25 # (at your option) any later version.
26 #
27 # This program is distributed in the hope that it will be useful,
28 # but WITHOUT ANY WARRANTY; without even the implied warranty of
29 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30 # GNU General Public License for more details.
31 #
32 # You should have received a copy of the GNU General Public License
33 # along with this program; if not, write to the
34 #    Free Software Foundation, Inc.
35 #    59 Temple Place, Suite 330
36 #    Boston, MA 02111-1307 USA
37 -->
38
39         
40 <xsl:stylesheet
41         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
42         xmlns:html="http://www.w3.org/1999/xhtml"
43         version="1.0">
44
45         <xsl:import href="memoir.xslt"/>
46         
47         <xsl:output method='text' encoding='utf-8'/>
48
49         <xsl:strip-space elements="*" />
50
51         <xsl:template match="/">
52                 <xsl:apply-templates select="html:html/html:head"/>
53                 <xsl:call-template name="latex-footer"/>
54         </xsl:template>
55
56         <!-- rely on the mmd-envelope style to set up paper size -->
57         <xsl:template name="latex-paper-size">
58         </xsl:template>
59         
60         <xsl:template name="latex-document-class">
61                 <xsl:text>\documentclass[oneside,article]{memoir}
62 \usepackage{layouts}[2001/04/29]
63
64
65 </xsl:text>
66         </xsl:template>
67
68         <xsl:template name="latex-header">
69                 <xsl:text>\usepackage{graphicx}                 % To include graphics in pdf's (jpg, gif, png, etc)
70 \usepackage[utf8]{inputenc}             % For UTF-8 support
71 \usepackage{xcolor}                             % Allow for color (annotations)
72
73 \def\myauthor{Author}                   % In case these were not included in metadata
74 \def\mytitle{Title}
75 \def\mykeywords{}
76 \def\myrecipient{}
77
78 </xsl:text>
79         </xsl:template>
80
81         <xsl:template name="latex-intro">
82                                 <xsl:text>
83
84 %
85 %       PDF Stuff
86 %
87
88 %\ifpdf                                                 % Removed for XeLaTeX compatibility
89 %  \pdfoutput=1                                 % Removed for XeLaTeX compatibility
90   \usepackage[
91         plainpages=false,
92         pdfpagelabels,
93         pdftitle={\mytitle},
94         pagebackref,
95         pdfauthor={\myauthor},
96         pdfkeywords={\mykeywords}
97         ]{hyperref}
98   \usepackage{memhfixc}
99 %\fi                                                    % Removed for XeLaTeX compatibility
100
101 \ifx\recipient\undefined
102 \else
103         \addtodef{\myrecipient}{}{\recipient \\}
104 \fi
105
106 \ifx\recipientaddress\undefined
107 \else
108         \addtodef{\myrecipient}{}{\recipientaddress}
109 \fi
110
111 \ifx\mydate\undefined
112         \def\mydate{\today}
113 \fi
114
115 </xsl:text>
116         </xsl:template>
117
118         <xsl:template name="return-address">
119                 <xsl:call-template name="return-address-defaults"/>
120                 <xsl:text>% Create return address
121 \def\returnaddress{\raggedright 
122 \normalsize
123 \renewcommand{\baselinestretch}{1.1}
124
125 \textbf{\myauthor} \\}
126
127 \ifx\position\undefined
128 \addtodef{\returnaddress}{}{\textit{\defaultposition}}
129 \else
130         \addtodef{\returnaddress}{}{\textit{\position} \\}
131 \fi
132
133
134 \ifx\department\undefined
135 \addtodef{\returnaddress}{}{\textbf{\defaultdepartment}}
136 \else
137         \addtodef{\returnaddress}{}{\textbf{\department} \\}
138 \fi
139
140 \ifx\address\undefined
141 \addtodef{\returnaddress}{}{\defaultaddress}
142 \else
143         \addtodef{\returnaddress}{}{\address \\}
144 \fi
145
146                 </xsl:text>
147         </xsl:template>
148         
149         <xsl:template name="return-address-defaults">
150                 <xsl:text>% Default info for return address
151 % These should include '\\' where appropriate for line endings
152
153 \def\defaultemail{}
154 \def\defaultposition{}
155 \def\defaultdepartment{}
156 \def\defaultaddress{}
157 \def\defaultphone{}
158 \def\defaultfax{}
159 \def\defaultweb{}
160
161 % Define height for logo and return address
162 \def\logoheight{1.5in}
163
164 % Define Logo or something for upper left corner
165 \def\coverlogo{}
166
167
168 </xsl:text>
169         </xsl:template>
170
171         <xsl:template name="latex-begin-body">
172                 <xsl:call-template name="return-address"/>
173                 <xsl:text>\usepackage{mmd-envelope}
174 \begin{document}
175
176 % Layout settings
177 \setlength{\parindent}{0pt}
178
179 \mainmatter
180 \thispagestyle{envelope}
181
182 % Insert return address
183
184 {\renewcommand{\baselinestretch}{1.1}
185 \color{returnaddress}\returnaddress}
186 \vspace*{\fill}
187
188 % Return to main settings
189 \large
190
191 \renewcommand{\baselinestretch}{1.2}
192 \setlength{\parskip}{12pt}
193
194 % Insert Recipient
195 \begin{adjustwidth}{3in}{0in}
196 \myrecipient
197 \vspace*{\fill}
198 \end{adjustwidth}
199 </xsl:text>
200 </xsl:template>
201
202         <xsl:template name="latex-title">
203         </xsl:template>
204
205         <xsl:template name="latex-copyright">
206         </xsl:template>
207
208         <xsl:template name="latex-footer">
209                 <xsl:text>
210 \end{document}
211 </xsl:text>
212         </xsl:template>
213
214
215 </xsl:stylesheet>