Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mk-tex-a4.xsl 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="text" encoding="UTF-8"/>
  4. <xsl:param name="language"/>
  5. <xsl:param name="style"/>
  6. <xsl:template match="html">
  7. <xsl:apply-templates match="body"/>
  8. </xsl:template>
  9. <xsl:template match="head"/>
  10. <xsl:template match="body">
  11. <xsl:text>\documentclass[a4paper]{article}</xsl:text>
  12. <xsl:if test="$language='el'">\usepackage[english,greek]{babel}</xsl:if>
  13. <xsl:text>\usepackage{ucs}
  14. \usepackage[utf8x]{inputenc}
  15. \usepackage[T1]{fontenc}
  16. </xsl:text>
  17. <xsl:if test="$language='ru'">\usepackage[russian]{babel}
  18. </xsl:if>
  19. <xsl:if test="$language!='el'">\usepackage{helvet}</xsl:if><xsl:text>
  20. \usepackage{fancyhdr}
  21. \usepackage{multicol}
  22. </xsl:text><xsl:if test="$style='G'">\usepackage{graphics}
  23. \usepackage[absolute]{textpos}
  24. </xsl:if><xsl:text>
  25. % Page layout
  26. \setlength{\topmargin}{58pt}
  27. \setlength{\headheight}{12pt}
  28. \setlength{\headsep}{36pt}
  29. \setlength{\textheight}{530pt}
  30. \setlength{\footskip}{48pt}
  31. \setlength{\oddsidemargin}{-32pt}
  32. \setlength{\columnsep}{10pt}
  33. \setlength{\textwidth}{514pt}
  34. </xsl:text>
  35. <xsl:if test="$language!='ru'">
  36. \raggedright
  37. </xsl:if>
  38. <xsl:text>
  39. % Header and footer
  40. \chead{}
  41. \rhead{\fontseries{bc}\selectfont (</xsl:text>
  42. <xsl:value-of select="$language"/>
  43. <xsl:text>)}
  44. \cfoot{}
  45. \rfoot{}
  46. \renewcommand{\headrulewidth}{0pt}
  47. \renewcommand{\footrulewidth}{0pt}
  48. % No chapter numbering
  49. \setcounter{secnumdepth}{-2}
  50. \renewcommand{\familydefault}{\sfdefault}
  51. % Section and subsection formatting
  52. \makeatletter
  53. \renewcommand{\section}{\@startsection{section}{2}{\z@}%
  54. {-3.5ex \@plus -1ex \@minus -.2ex}%
  55. {2.3ex \@plus.2ex}%
  56. {\fontsize{12pt}{14.4pt}\selectfont\bfseries\itshape}}
  57. \renewcommand{\subsection}{\@startsection{section}{3}{\z@}%
  58. {-3ex \@plus -1ex \@minus -.2ex}%
  59. {3pt}%
  60. {\fontsize{11pt}{12pt}\selectfont\bfseries\itshape}}
  61. \makeatother
  62. </xsl:text>
  63. <xsl:apply-templates select="a[@id='moreinfo']"/>
  64. <xsl:apply-templates select="address"/>
  65. <xsl:text>\begin{document}</xsl:text>
  66. <xsl:text>\pagestyle{fancy}</xsl:text>
  67. <!-- Folders -->
  68. <xsl:apply-templates select="div[@id='fsfe']"/>
  69. <xsl:apply-templates select="div[@id='contribute']"/>
  70. <xsl:apply-templates select="div[@id='free_software']"/>
  71. <!-- Leaflets -->
  72. <xsl:apply-templates select="h1"/>
  73. <xsl:text>\begin{bfseries}</xsl:text>
  74. <xsl:apply-templates select="p[@class='background']"/>
  75. <xsl:text>\end{bfseries}</xsl:text>
  76. <xsl:text>\begin{multicols}{2}</xsl:text>
  77. <xsl:apply-templates select="h2|p[not(@class='background')]|ul"/>
  78. <xsl:text>\end{multicols}</xsl:text>
  79. <!-- End of document -->
  80. <xsl:text>\end{document}</xsl:text>
  81. </xsl:template>
  82. <xsl:template match="a[@id='moreinfo']">
  83. <xsl:text>\lhead{</xsl:text>
  84. <xsl:if test="$style='G'">
  85. <xsl:text>\begin{textblock*}{\paperwidth}(0pt,0pt)</xsl:text>
  86. <xsl:text>\includegraphics{background-a4.pdf}</xsl:text>
  87. <xsl:text>\end{textblock*}</xsl:text>
  88. </xsl:if>
  89. <xsl:text>\fontseries{bc}\selectfont </xsl:text>
  90. <xsl:value-of select="node()"/>
  91. <xsl:text>}</xsl:text>
  92. </xsl:template>
  93. <xsl:template match="address">
  94. <xsl:text>\lfoot{\fontsize{8pt}{9.5pt}\selectfont </xsl:text>
  95. <xsl:apply-templates select="node()"/>
  96. <!-- Disclaimer -->
  97. <xsl:if test="$language!='de' and $language!='en' and $language!='es' and $language!='it'">
  98. <xsl:if test="$language='el'">\selectlanguage{english}</xsl:if>
  99. <xsl:if test="$language!='ru'">
  100. <xsl:text>This is an unofficial translation. Please see </xsl:text>
  101. <xsl:text>http://www.fsfe.org/about/printable/printable.en.html</xsl:text>
  102. <xsl:text> for the original text.</xsl:text>
  103. </xsl:if>
  104. <xsl:if test="$language='ru'">
  105. <xsl:text>Это неофициальный перевод. </xsl:text>
  106. <xsl:text>Оригинальный текст см. на </xsl:text>
  107. <xsl:text>http://www.fsfe.org/about/printable/printable.en.html.</xsl:text>
  108. </xsl:if>
  109. </xsl:if>
  110. <xsl:text>}</xsl:text>
  111. </xsl:template>
  112. <xsl:template match="div">
  113. <xsl:if test="@id='free_software'">
  114. <xsl:text>\break</xsl:text>
  115. </xsl:if>
  116. <xsl:if test="not(@id='fsfe')">
  117. <xsl:apply-templates select="h1"/>
  118. </xsl:if>
  119. <xsl:text>\begin{bfseries}</xsl:text>
  120. <xsl:apply-templates select="p[@class='background']"/>
  121. <xsl:text>\end{bfseries}\smallskip</xsl:text>
  122. <xsl:apply-templates select="h2|p[not(@class='background')]|ul"/>
  123. </xsl:template>
  124. <xsl:template match="h1">
  125. <xsl:text>\section{</xsl:text>
  126. <xsl:apply-templates select="node()"/>
  127. <xsl:text>}</xsl:text>
  128. </xsl:template>
  129. <xsl:template match="h2">
  130. <xsl:text>\subsection{</xsl:text>
  131. <xsl:apply-templates select="node()"/>
  132. <xsl:text>}</xsl:text>
  133. </xsl:template>
  134. <xsl:template match="p">
  135. <xsl:apply-templates select="node()"/>
  136. <xsl:text>\par </xsl:text>
  137. </xsl:template>
  138. <xsl:template match="ul">
  139. <xsl:text>\begin{itemize}</xsl:text>
  140. <xsl:text>\itemsep 3pt</xsl:text>
  141. <xsl:apply-templates select="li"/>
  142. <xsl:text>\end{itemize}</xsl:text>
  143. </xsl:template>
  144. <xsl:template match="li">
  145. <xsl:text>\item </xsl:text>
  146. <xsl:apply-templates select="node()"/>
  147. </xsl:template>
  148. <xsl:template match="b">
  149. <xsl:text>{\bfseries </xsl:text>
  150. <xsl:apply-templates select="node()"/>
  151. <xsl:text>}</xsl:text>
  152. </xsl:template>
  153. <xsl:template match="latin">
  154. <xsl:text>{\selectlanguage{english}</xsl:text>
  155. <xsl:apply-templates select="node()"/>
  156. <xsl:text>}</xsl:text>
  157. </xsl:template>
  158. <xsl:template match="a">
  159. <xsl:apply-templates select="node()"/>
  160. </xsl:template>
  161. <xsl:template match="br">\\</xsl:template>
  162. <xsl:template match="timestamp"/>
  163. <xsl:template match="translator"/>
  164. </xsl:stylesheet>