[latex3-commits] [git/LaTeX3-latex3-latex3] master: add experimental latexml driver for l3news (e527e32)

Will Robertson wspr81 at gmail.com
Wed Jan 31 14:20:07 CET 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/e527e326a600681fea4ebc11d7feda5e168f1c32

>---------------------------------------------------------------

commit e527e326a600681fea4ebc11d7feda5e168f1c32
Author: Will Robertson <wspr81 at gmail.com>
Date:   Wed Jan 31 23:50:07 2018 +1030

    add experimental latexml driver for l3news
    
    TODO: \maketitle :)


>---------------------------------------------------------------

e527e326a600681fea4ebc11d7feda5e168f1c32
 news/latexml/latexml.sh         |   11 +++++
 news/latexml/ltnews.cls.ltxml   |   91 +++++++++++++++++++++++++++++++++++++++
 news/latexml/ragged2e.sty.ltxml |   30 +++++++++++++
 3 files changed, 132 insertions(+)

diff --git a/news/latexml/latexml.sh b/news/latexml/latexml.sh
new file mode 100644
index 0000000..0653dba
--- /dev/null
+++ b/news/latexml/latexml.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+mkdir -p html
+
+FILENAME=l3news01
+
+latexml ../$FILENAME | latexmlpost - \
+  --xsltparameter=SIMPLIFY_HTML:true \
+  --format=html5 \
+  --destination=html/$FILENAME.html
+
diff --git a/news/latexml/ltnews.cls.ltxml b/news/latexml/ltnews.cls.ltxml
new file mode 100644
index 0000000..a9ca6f5
--- /dev/null
+++ b/news/latexml/ltnews.cls.ltxml
@@ -0,0 +1,91 @@
+# -*- mode: Perl -*-
+# /=====================================================================\ #
+# | Copied from article                                                 | #
+# | Implementation for LaTeXML                                          | #
+# \=========================================================ooo==U==ooo=/ #
+package LaTeXML::Package::Pool;
+use strict;
+use warnings;
+use LaTeXML::Package;
+
+LoadPool('LaTeX');
+#**********************************************************************
+# Option handling
+foreach my $option (qw(10pt 11pt 12pt
+  letterpaper legalpaper executivepaper a4paper a5paper b5paper
+  landscape
+  final draft
+  oneside twoside
+  onecolumn twocolumn
+  lw35fonts type1fonts
+  )) {
+  DeclareOption($option, undef); }
+
+ProcessOptions();
+
+#**********************************************************************
+# Document structure.
+RelaxNGSchema("LaTeXML");
+RequireResource('ltx-article.css');
+
+
+#**********************************************************************
+# ltnews specifics
+
+RequirePackage('url');
+DefMacro('\package{}','\textsf{#1}');
+
+DefMacro('\publicationmonth{}', '');
+DefMacro('\publicationyear{}',  '');
+DefMacro('\publicationissue{}', '');
+
+#**********************************************************************
+# The core sectioning commands are defined in LaTeX.pm
+# but the counter setup, etc, depends on article
+SetCounter('secnumdepth', Number(3));
+NewCounter('part',          'document',      idprefix => 'Pt',  nested => ['section']);
+NewCounter('section',       'document',      idprefix => 'S',   nested => ['subsection']);
+NewCounter('subsection',    'section',       idprefix => 'SS',  nested => ['subsubsection']);
+NewCounter('subsubsection', 'subsection',    idprefix => 'SSS', nested => ['paragraph']);
+NewCounter('paragraph',     'subsubsection', idprefix => 'P',   nested => ['subparagraph']);
+NewCounter('subparagraph', 'paragraph', idprefix => 'SP', nested => ['equation', 'figure', 'table']);
+
+DefMacro('\thepart',          '\Roman{part}');
+DefMacro('\thesection',       '\arabic{section}');
+DefMacro('\thesubsection',    '\thesection.\arabic{subsection}');
+DefMacro('\thesubsubsection', '\thesubsection.\arabic{subsubsection}');
+DefMacro('\theparagraph',     '');
+DefMacro('\thesubparagraph',  '');
+SetCounter(tocdepth => Number(3));
+
+NewCounter('equation',       'document', idprefix => 'E',  idwithin => 'section');
+NewCounter('@equationgroup', 'document', idprefix => 'EG', idwithin => 'section');
+NewCounter('figure',         'document', idprefix => 'F',  idwithin => 'section');
+NewCounter('table',          'document', idprefix => 'T',  idwithin => 'section');
+
+DefMacro('\theequation', '\arabic{equation}');
+DefMacro('\thefigure',   '\arabic{figure}');
+DefMacro('\thetable',    '\arabic{table}');
+
+NewCounter('@itemizei',   'document',    idprefix => 'I');
+NewCounter('@itemizeii',  '@itemizei',   idprefix => 'I');
+NewCounter('@itemizeiii', '@itemizeii',  idprefix => 'I');
+NewCounter('@itemizeiv',  '@itemizeiii', idprefix => 'I');
+NewCounter('@itemizev',   '@itemizeiv',  idprefix => 'I');
+NewCounter('@itemizevi',  '@itemizev',   idprefix => 'I');
+
+NewCounter('enumi',   '@itemizei',   idprefix => 'i');
+NewCounter('enumii',  '@itemizeii',  idprefix => 'i');
+NewCounter('enumiii', '@itemizeiii', idprefix => 'i');
+NewCounter('enumiv',  '@itemizeiv',  idprefix => 'i');
+# A couple of more levels, since we use these for ID's!
+NewCounter('enumv',  '@itemizev',  idprefix => 'i');
+NewCounter('enumvi', '@itemizevi', idprefix => 'i');
+
+DefMacro('\theenumi',   '\arabic{enumi}');
+DefMacro('\theenumii',  '\alph{enumii}');
+DefMacro('\theenumiii', '\roman{enumiii}');
+DefMacro('\theenumiv',  '\Alph{enumiv}');
+
+#**********************************************************************
+1;
diff --git a/news/latexml/ragged2e.sty.ltxml b/news/latexml/ragged2e.sty.ltxml
new file mode 100644
index 0000000..97627ac
--- /dev/null
+++ b/news/latexml/ragged2e.sty.ltxml
@@ -0,0 +1,30 @@
+# -*- mode: Perl -*-
+# /=====================================================================\ #
+# |  ragged2e                                                             | #
+# | Implementation for LaTeXML                                          | #
+# \=========================================================ooo==U==ooo=/ #
+package LaTeXML::Package::Pool;
+use strict;
+use warnings;
+use LaTeXML::Package;
+
+#======================================================================
+# Ignore them all, for the moment.
+foreach my $option (qw(OriginalCommands originalcommands
+    NewCommands newcommands
+    OriginalParameters originalparameters
+    NewParameters newparameters
+    raggedrightboxes footnotes document)) {
+  DeclareOption($option, undef); }
+
+ProcessOptions();
+
+#======================================================================
+
+DefMacro('\RaggedRight', '\raggedright');
+DefMacro('\RaggedLeft',  '\raggedleft');
+DefMacro('\Centering',   '\centering');
+
+#======================================================================
+
+1;





More information about the latex3-commits mailing list