% $Id: tex4ht-jsml-xtpipes.tex 740 2020-06-13 22:35:32Z karl $ % htlatex tex4ht-jsml-xtpipes "xhtml,next,3" "" "-d./" % % Copyright 2009-2020 TeX Users Group % Copyright 2002-2009 Eitan M. Gurari % Released under LPPL 1.3c+. % See tex4ht-cpright.tex for license text. \documentclass{article} \Configure{ProTex}{log,<<<>>>,title,list,`,[[]]} \begin{document} \input{common} \input{tex4ht-cpright} \input{tex4ht-dir} %%%%%%%%%%%%%%%%%% \part{Script for xtpipes} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%% \section{Outline} %%%%%%%%%%%%%%%%%% \AtEndDocument{\OutputCodE\} \Needs{"xmllint --valid --noout jsml.4xt"} \<<< ` ` ` ` ` ` ` ` ` ` ` ` ` `
`
>>> ` ` ` ` \<<< >>> \<<< >>> \<<< ` ` ` ` ` ` ` ` `<'minus' into 'negative'`> ` ` ` >>> \<<< ` ` ` ` >>> \AtEndDocument{\OutputCodE\} \ifdojava \Needs{" javac HtJsml.java -d \XTPIPES "} \fi \<<< package tex4ht; /* HtJsml.java (`version), generated from `jobname.tex Copyright (C) 2009-2010 TeX Users Group Copyright (C) `CopyYear.2002. Eitan M. Gurari ` */ import org.w3c.dom.*; public class HtJsml { ` ` ` ` ` } >>> %%%%%%%%%%%%%%%%%% \section{Numbers in Math} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{Group MN / MO-Punctuation} %%%%%%%%%%%%% \AtEndDocument{% \OutputCodE\ } \ifdojava \Needs{" javac GroupMn.java -d \XTPIPES "} \fi \<<< package tex4ht; /* GroupMn.java (`version), generated from `jobname.tex Copyright (C) 2009-2010 TeX Users Group Copyright (C) `CopyYear.2002. Eitan M. Gurari ` */ import org.xml.sax.helpers.*; import org.xml.sax.*; import java.io.PrintWriter; public class GroupMn extends XMLFilterImpl { PrintWriter out = null; boolean inMn = false; String ns; int level = -1; public GroupMn( PrintWriter out, PrintWriter log, boolean trace){ this.out = out; } public void startElement(String ns, String sName, String qName, Attributes attr) { level++; try{ if( inMn ){ if( level == 0 ){ ` } } else { ` } super.startElement(ns, sName, qName, attr); } catch( Exception e ){ System.out.println( "--- GroupMn Error 1 --- " + e); } } public void endElement(String ns, String sName, String qName){ try{ if( level < 0) { ` } super.endElement(ns, sName, qName); } catch( Exception e ){ System.out.println( "--- GroupMn Error 2 --- " + e); } level--; } public void characters(char[] ch, int start, int length){ try{ if ( inMn && (level < 0) ) { String s = new String(ch, start, length); if (!s.trim().equals("")) { inMn = false; super.endElement(ns, "mn-group", "mn-group"); } } super.characters(ch, start, length); } catch( Exception e ){ System.out.println( "--- GroupMn Error 3 --- " + e); } } } >>> \<<< if( qName.equals( "mn" ) ){ inMn = true; level = 0; Attributes att = new AttributesImpl(); super.startElement(ns, "mn-group", "mn-group", att); this.ns = ns; } else if( qName.equals( "mo" ) ){ String cls = attr.getValue( "class" ); if( (cls != null) && cls.equals("MathClass-punc") ){ inMn = true; level = 0; Attributes att = new AttributesImpl(); super.startElement(ns, "mn-group", "mn-group", att); this.ns = ns; } } >>> \<<< if( !qName.equals( "mn" ) ){ if( qName.equals( "mo" ) ){ String cls = attr.getValue( "class" ); if( (cls == null) || !cls.equals("MathClass-punc") ){ inMn = false; super.endElement(ns, "mn-group", "mn-group"); } } else { inMn = false; super.endElement(ns, "mn-group", "mn-group"); } } >>> \<<< if( inMn ){ inMn = false; super.endElement(ns, "mn-group", "mn-group"); } >>> %%%%%%%%%%%%% \subsection{Outline of Post Original Partition} %%%%%%%%%%%%% \<<< >>> \<<< ` >>> \<<< private static Document dom; public static void mnGroup(Node d) { dom = (Document) d; setMnGroup(dom.getFirstChild()); } private static void setMnGroup(Node node) { if( node.getNodeName().equals( "mn-group" ) ){ boolean bool = false; ` if( bool ){ ` ` ` ` ` } ` } else if (node.hasChildNodes()) { NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { setMnGroup(child); } } } } >>> %%%%%%%%%%%%% \subsection{Mark Partition of MN Group} %%%%%%%%%%%%% Consecutive digits and punctation characters are grouped together, and then ungrouped at characters that are marked by `x'. \<<< NodeList children = node.getChildNodes(); int n = children.getLength(); char [] digit = new char[n]; for (int i = 0; i < n; i++) { Node child = children.item(i).getFirstChild(); if( child == null ){ digit[i] = 'x'; } else if( child.getNodeType() != Node.TEXT_NODE ){ digit[i] = 'x'; } else { String s = child.getNodeValue(); if( s.length() != 1 ){ digit[i] = 'x'; } else { char ch = s.charAt(0); if( (ch >= '0') && (ch <= '9') ){ digit[i] = '0'; bool = true; } else if( (ch == '.') || (ch == ',') ){ digit[i] = ch; } else { digit[i] = 'x';} } } } >>> \<<< bool = false; for (int i = 0; i < n; i++) { if( digit[i] == '.' ){ for (; i < n; i++) { if( digit[i] == ',' ){ bool = true; break; } } break; } } >>> \<<< if( !bool ){ for (int i = 0; i < n; i++) { if( digit[i] == ',' ){ if( ( ((i+3) >= n) || (digit[i+1] != '0') || (digit[i+2] != '0') || (digit[i+3] != '0') ) || ( ((i+4) < n) && (digit[i+4] == '0') ) || ( (i>3) && (digit[i-4] == '0') ) ){ bool = true; break; } else { i += 3; } } } } >>> \<<< if( bool ){ for (int i = 0; i < n; i++) { if( digit[i] == ',' ){ digit[i] = 'x'; } } } >>> \<<< bool = false; for (int i = 0; i < n; i++) { if( (digit[i] == 'x') || (digit[i] == ',') ){ bool = false; } else if( digit[i] == '.' ){ if( bool ){ for (int j = 0; j < n; j++) { if( (digit[j] == '.') || (digit[j] == ',') ){ digit[j] = 'x'; } } break; } bool = true; } } >>> \<<< if( digit[n-1] == '.' ){ digit[n-1] = 'x'; } >>> %%%%%%%%%%%%% \subsection{Realize the Sub Partition} %%%%%%%%%%%%% \<<< Node parent = node.getParentNode(); Element g = dom.createElement( "mn-group-s" ); Element cur = dom.createElement( "mn-group" ); for(int i=0; i>> %%%%%%%%%%%%% \subsection{Reset MNs} %%%%%%%%%%%%% \<<< >>> \<<< >>> %%%%%%%%%%%%% \subsection{Pronounced Letters} %%%%%%%%%%%%% \<<< a >>> %%%%%%%%%%%%% \subsection{Pronounced Punctuation in math} %%%%%%%%%%%%% TTSs might ignore punctuation marks. We want these symbols in math. \<<< . , ; : ! ? >>> \<<< >>> \<<< ancestor::mover[ not( descendant::*[ (count( ` ) > 1) ]) and ( preceding-sibling::*[1][self::dot or self::mn-group-s] or following-sibling::*[1][self::dot or self::mn-group-s] ) ] >>> \<<< ancestor::munder[ not( descendant::*[ (count( ` ) > 1) ]) and ( preceding-sibling::*[1][self::dot or self::mn-group-s] or following-sibling::*[1][self::dot or self::mn-group-s] ) ] >>> %%%%%%%%%%%%%%%%%% \section{Process Characters} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{'minus' into 'negative'} %%%%%%%%%%%%% \<'minus' into 'negative'\><<< mo-unary >>> \<'minus' into 'negative'\><<< >>> \begin{verbatim} subscript minus 2 \end{verbatim} \<'minus' into 'negative'\><<< negative >>> %%%%%%%%%%%%%%%%%% \subsection{Capital Letters in Math} %%%%%%%%%%%%%%%%%% \<<< >>> \<<< capital >>> %%%%%%%%%%%%% \subsection{Right Apostrophes} %%%%%%%%%%%%% \<<< >>> \<<< ' >>> %%%%%%%%%%%%% \subsection{Delimiters on List Marks} %%%%%%%%%%%%% \<<< >>> %%%%%%%%%%%%%%%%%% \section{Clean Up} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{Extra Math Pauses} %%%%%%%%%%%%% Deletes pauses that are not separated by text from their immediate predecessors. An earlier XSLT-based approach was very slow, and died on nodes with large numbers of children. \<<< >>> \AtEndDocument{% \OutputCodE\ } \ifdojava \Needs{" javac -classpath \LIB xtpipes.jar JsmlMathBreak.java -d \XTPIPES . "} \fi \<<< package tex4ht; /* JsmlMathBreak.java (`version), generated from `jobname.tex Copyright (C) 2009-2010 TeX Users Group Copyright (C) `CopyYear.2002. Eitan M. Gurari ` */ import xtpipes.XtpipesUni; import org.xml.sax.*; import org.xml.sax.helpers.DefaultHandler; import java.io.*; import java.lang.reflect.*; import java.util.HashMap; public class JsmlMathBreak extends DefaultHandler { PrintWriter out = null; boolean delete = false; public JsmlMathBreak(PrintWriter out, HashMap scripts, Method method, PrintWriter log, boolean trace) { this.out = out; } public void characters(char[] ch, int start, int length) { String s = XtpipesUni.toUni(ch, start, length, "<>&"); out.print( s ); if( !s.trim().equals("") ){ delete = false; } } public void startElement(String ns, String sName, String qName, Attributes atts) { if( !( delete && qName.equals("BREAK") ) ){ String s = "<" + qName + "\n"; for (int i = 0; i < atts.getLength(); i++) { String name = atts.getQName(i); if (name != "xmlns") { s += (" " + name + "=\"" + XtpipesUni.toUni(atts.getValue(i), "<>&\"") + "\""); } } if( qName.equals( "BREAK" ) ){ s += "/"; delete = true; } s += ">"; out.print(s); } } public void endElement(String ns, String sName, String qName) { if( !qName.equals( "BREAK" ) ){ String s = ""; out.print(s); } } } >>> \begin{verbatim} end end root end math \end{verbatim} %%%%%%%%%%%%% \subsection{Line Breaks} %%%%%%%%%%%%% \
<<< >>> \<<< >>> >>> %%%%%%%%%%%%%%%%%% \subsection{Empty Elements} %%%%%%%%%%%%%%%%%% \marginpar{??????} Can we avoid empty non-empty representations without of the following(Example: \verb+\documentclass{article} \begin{document} \section{Section One} This is Section 1 \end{document} + ) \<<< >>> \<<< >>> %%%%%%%%%%%%% \subsection{Empty Array Cells} %%%%%%%%%%%%% Empty array celles at end of rows can make it more difficult to detect deletable baseline indicators. \<<< >>> \<<< >>> \<<< >>> %%%%%%%%%%%%% \subsection{Paragraphs (JsmlFilter.java)} %%%%%%%%%%%%% \<<< >>> The following adds PARA on `p' paragraphs, ul. \AtEndDocument{ % \OutputCodE\ } \ifdojava \Needs{" javac JsmlFilter.java -d \XTPIPES "} \fi \<<< package tex4ht; /* JsmlFilter.java (`version), generated from `jobname.tex Copyright (C) 2009-2010 TeX Users Group Copyright (C) `CopyYear.2002. Eitan M. Gurari ` */ import org.xml.sax.helpers.*; import org.xml.sax.*; import java.io.PrintWriter; public class JsmlFilter extends XMLFilterImpl { PrintWriter out = null; public JsmlFilter( PrintWriter out, PrintWriter log, boolean trace ){ this.out = out; } public void startElement(String ns, String sName, String qName, Attributes attr) { try{ if( ` ){ Attributes att = new AttributesImpl(); super.startElement(ns, "PARA", "PARA", att); } super.startElement(ns, sName, qName, attr); } catch( Exception e ){ System.out.println( "--- JsmlFilter Error 1 --- " + e); } } public void endElement(String ns, String sName, String qName){ try{ super.endElement(ns, sName, qName); if( ` ){ super.endElement(ns, "PARA", "PARA"); } } catch( Exception e ){ System.out.println( "--- JsmlFilter Error 2 --- " + e); } } } >>> \<<< qName.equals( "p" ) || qName.equals( "h2" ) || qName.equals( "h3" ) || qName.equals( "h4" ) || qName.equals( "ul" ) || qName.equals( "ol" ) || qName.equals( "li" ) || qName.equals( "dd" ) || qName.equals( "dl" ) >>> %%%%%%%%%%%%% \subsection{Remove Split Arrays} %%%%%%%%%%%%% \<<< >>> \<<< >>> %%%%%%%%%%%%% \section{Eliminate Inline Math Narrative} %%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{Core Content of One Element} %%%%%%%%%%%%% \<<< semi-math ` >>> \<<< ` ` ` >>> \<<< child::*[ not(@title = 'speech-extra') and not( self::BREAK ) ] >>> \<<< semi-math >>> \<<< semi-math >>> \<<< semi-math >>> \begin{verbatim} C i \end{verbatim} %%%%%%%%%%%%% \subsection{Unary Op} %%%%%%%%%%%%% The `mo-unary' is established in the first pass over inline-math, so we need to wait for the second pass with the following. \<<< ` ` >>> \<<< semi-math >>> \<<< semi-math >>> %%%%%%%%%%%%% \subsection{Shallow Expression} %%%%%%%%%%%%% \<<< ` >>> \<<< semi-math >>> %%%%%%%%%%%%% \subsection{Shallow Delimited Expression} %%%%%%%%%%%%% \<<< ` >>> \<<< semi-math >>> %%%%%%%%%%%%%%%%%% \section{Superscripts and Subscripts} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{Insert Sub-Levels Info} %%%%%%%%%%%%% \<<< ` >>> \<<< public static void scriptLevel(Node dom) { setScriptLevel(dom.getFirstChild(), ""); } private static void setScriptLevel(Node node, String prefix) { String clName = null; if (node.hasChildNodes()) { if (node.hasAttributes()) { Node cl = node.getAttributes().getNamedItem("class"); if (cl != null) { clName = cl.getNodeValue(); if( clName.equals("mrow-sub") || clName.equals("mrow-super") ){ ` } } } String ndName = node.getNodeName(); if( ndName.equals("msqrt") || ndName.equals("mroot") ){ prefix = ""; } ` >>> \<<< ` ` ` >>> \<<< ` ` ` ` >>> \<<< >>> \begin{verbatim} ......... superscript baseline \end{verbatim} %%%%%%%%%%%%% \section{Special Subscripts and Superscripts} %%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{Squared} %%%%%%%%%%%%% \<<< ` ` ` >>> \<<< >>> \<<< not( child::mrow[ @class = 'mrow-base' ] / child::span[ not( @title = 'speech-extra' ) ] [ position() = last() ] / self::* [ @class = 'mo-op' ] ) >>> \<<< squared >>> \begin{verbatim} cos superscript 2 baseline \end{verbatim} \<<< >>> \<<< cube >>> \<<< ` ` ` >>> \<<< msub >>> \<<< squared-super squared >>> \<<< msub >>> \<<< cube-super cube >>> %%%%%%%%%%%%% \subsection{Numeric Subscripts (Rule 77)} %%%%%%%%%%%%% \<<< ` ` ` >>> \<<< >>> \<<< (count( child::mrow[ @class = 'mrow-base' ] / child::* ) = 1 ) and child::mrow[ @class = 'mrow-base' ] / descendant::mi and not( ancestor::*[ self::msub or self::msup or self::msubsup ] ) >>> \<<< ( count( child::mrow[ @class = 'mrow-base' ] / child::* [ not(self::BREAK) ] ) = 2 ) and child::mrow[ @class = 'mrow-base' ] [ child::*[1][ self::mi ] and child::*[ (position() > 1) and (normalize-space(.) = normalize-space( descendant-or-self::span[ (@class = 'ch 2032') or (@class = 'ch 2033') or (@class = 'ch 2034') ] )) ] ] and not( ancestor::*[ self::msub or self::msup or self::msubsup ] ) >>> \begin{verbatim} x subscript 1 baseline \end{verbatim} \<<< >>> %%%%%%%%%%%%% \subsection{Primes} %%%%%%%%%%%%% \<<< >>> \<<< >>> \begin{verbatim} x superscript double prime baseline \end{verbatim} \<<< ` ` ` >>> \<<< >>> \begin{verbatim} x ...... superscript prime \end{verbatim} %%%%%%%%%%%%% \subsection{Degree} %%%%%%%%%%%%% \<<< >>> \<<< degree >>> %%%%%%%%%%%%% \subsection{Logarithms} %%%%%%%%%%%%% \<<< >>> \<<< of >>> \begin{verbatim} log ... 2 ... x \end{verbatim} %%%%%%%%%%%%%%%%%% \section{Fractions (Stage 1)} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{Outline} %%%%%%%%%%%%% \<<< >>> \<<< ` ` ` >>> %%%%%%%%%%%%% \subsection{Word Fractions} %%%%%%%%%%%%% Example: `\verb+1 \ove 2+' int `one half' \<<< ` word-frac ` ` >>> \<<< >>> \<<< one two three four five six seven eight nine >>> \<<< half third fourth fifth sixth seventh eighth nineth s >>> %%%%%%%%%%%%% \subsection{Mixed Fractions} %%%%%%%%%%%%% Examples: `\verb+2{3\over 4}+' into `2 and three forth', and `\verb+10{25\over 39}+' into `10 and 25 over 39'. \<<< and >>> %%%%%%%%%%%%% \subsection{Continued Fractions Conditions (Rule 69)} %%%%%%%%%%%%% \begin{verbatim} 1 1 + --------------------------------------- 1 2 + --------------------------------------- 1 2 + --------------------------------------- 2 + ... \end{verbatim} The fractions are processed recusrively from inside out. The `tail' is the one to discover the inner most part of a continued fraction (i.e., the bottom rows). Higher levels add to the nucleous built already under them. In Stage 1 the members of the continued fractions are marked as such. In the second stage they being are procesed. The minimum conditions here are three un-interrupted levels of fractions. \begin{verbatim} 1 ... begin fraction ... over ... end fraction \end{verbatim} \<<< >>> \<<< >>> %%%%%%%%%%%%% \subsection{Nucleous of Continued Fractions} %%%%%%%%%%%%% We are looking for the three most internal (bottom) fractions that belong to a continued fraction. \<<< ` >>> \<<< ( normalize-space( child::mrow[ @class = 'mrow-numerator' ]) and normalize-space( child::mrow[ @class = 'mrow-enumerator' ] / child::mfrac / child::mrow[ @class = 'mrow-numerator' ]) ) and ( normalize-space( child::mrow[ @class = 'mrow-enumerator' ] / child::mfrac / child::mrow[ @class = 'mrow-numerator' ]) and normalize-space( child::mrow[ @class = 'mrow-enumerator' ] / child::mfrac / child::mrow[ @class = 'mrow-enumerator' ] / child::mfrac / child::mrow[ @class = 'mrow-numerator' ]) ) >>> \<<< ( child::mrow[ @class = 'mrow-enumerator' ] / child::mfrac / preceding-sibling::*[1][@class = 'MathClass-bin'] ) and ( normalize-space( child::mrow[ @class = 'mrow-enumerator' ] / child::mfrac / preceding-sibling::*[1] ) = normalize-space( child::mrow[ @class = 'mrow-enumerator' ] / child::mfrac / child::mrow[ @class = 'mrow-enumerator' ] / child::mfrac / preceding-sibling::*[1] ) ) >>> %%%%%%%%%%%%% \subsection{Prepend Existing Continued Fractions} %%%%%%%%%%%%% \<<< ` >>> \<<< ( normalize-space( child::span[ @class = 'mrow-enumerator' ] / child::mfrac / preceding-sibling::*[1] ) = normalize-space( child::span[ @class = 'mrow-enumerator' ] / child::mfrac / child::span[ @class = 'mrow-enumerator' ] / child::span[ @class = 'continued-mfrac' ] / preceding-sibling::*[1] ) ) >>> \<<< >>> %%%%%%%%%%%%%%%%%% \section{Fractions (Stage 2)} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{Outline} %%%%%%%%%%%%% \<<< ` >>> \<<< public static void fracLevel(Node d) { dom = (Document) d; setFracLevel(dom.getFirstChild(), 0); } private static int setFracLevel(Node node, int cont) { int level = 0; if (node.hasChildNodes()) { String ndName = node.getNodeName(); int prevCont = cont; String clValue = null; if (ndName.equals("mfrac")) { ` ` } ` ` if (ndName.equals("mfrac")) { ` if( cont > 0 ){ if ( prevCont == 0 ){ ` } ` level = 0; } else if ( prevCont > 0 ){ ` level = 0; } else if( level > 0 ){ ` } level++; } } return level; } >>> %%%%%%%%%%%%%%%%%% \subsection{Level Indicators for Nesting (Hyper Complex Fractions)} %%%%%%%%%%%%%%%%%% \begin{verbatim} ${a\over b}\over c$ begin begin fraction begin fraction a over b end fraction over over c end end fraction \end{verbatim} \<<< for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { Node cls = child.getAttributes() .getNamedItem("class"); if (cls != null) { String clsName = cls.getNodeValue(); if (clsName.equals("begin-end")) { insertLevelPrefix(child, level); } } } } >>> \<<< private static void insertLevelPrefix(Node node, int level){ if( level == 0 ){ return; } if (node.getNodeType() == Node.ELEMENT_NODE) { if( node.getNodeName().equals( "level" ) ){ ` } else { NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); insertLevelPrefix(child, level); } } } } >>> \<<< Node attr = node.getAttributes().getNamedItem("prefix"); if( attr != null ){ String prefix = attr.getNodeValue(); String s = ""; for(int j=0; j>> \<<< NodeList children = node.getChildNodes(); int max = 0; for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { int d = setFracLevel(child, `); if (d > max) { max = d; } } } level += max; >>> %%%%%%%%%%%%% \subsection{Level Terminators: Scripts, Word Fracs} %%%%%%%%%%%%% \<<< if( ndName.equals("msub") || ndName.equals("msup") || ndName.equals("msubsup") ) { return 0; } >>> \<<< if( (clValue != null) && clValue.equals("word-frac") ) { return 0; } >>> %%%%%%%%%%%%% \subsection{Bookeeping for Continued Fractions} %%%%%%%%%%%%% \<<< cont >>> In the first phase, the mfrac elements in a group carry attributes as in \begin{verbatim} \end{verbatim} with the exception of the bottom (internal) most leveles. The `cont' parameter is for determining whether the parent and the grandparent are frac elements marked as continued. \<<< if (node.hasAttributes()) { Node cl = node.getAttributes().getNamedItem("class"); if (cl != null) { clValue = cl.getNodeValue(); } } >>> \<<< if( (clValue != null) && clValue.equals("continued-mfrac") ) { cont = 2; } else { cont--; } >>> %%%%%%%%%%%%% \subsection{Modifications for Continued Fractions} %%%%%%%%%%%%% \<<< Node child = node.getLastChild(); if (child.getNodeType() == Node.ELEMENT_NODE) { Node cls = child.getAttributes() .getNamedItem("class"); if (cls != null) { String clsName = cls.getNodeValue(); if ( clsName.equals("begin-end")) { node.removeChild( child ); } } } >>> \<<< Node child = node.getLastChild(); if (child.getNodeType() == Node.ELEMENT_NODE) { Node cls = child.getAttributes() .getNamedItem("class"); if (cls != null) { String clsName = cls.getNodeValue(); if ( clsName.equals("begin-end")) { setContinuedNote(child); } } } >>> \<<< Node child = node.getFirstChild(); if (child.getNodeType() == Node.ELEMENT_NODE) { Node cls = child.getAttributes() .getNamedItem("class"); if (cls != null) { String clsName = cls.getNodeValue(); if ( clsName.equals("begin-end")) { setContinuedNote(child); } } } >>> \<<< private static void setContinuedNote(Node node){ if (node.getNodeType() == Node.ELEMENT_NODE) { if( node.getNodeName().equals( "level" ) ){ ` } else { NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); setContinuedNote(child); } } } } >>> \<<< Node attr = node.getAttributes().getNamedItem("continued"); if (attr != null) { node = node.getFirstChild(); if( node != null ){ ((org.w3c.dom.Text) node).setData( attr.getNodeValue() ); } } >>> %%%%%%%%%%%%% \section{Set Levels on Roots} %%%%%%%%%%%%% \<<< ` >>> \<<< public static void rootLevel(Node d) { dom = (Document) d; setRootLevel(d.getFirstChild()); } private static int setRootLevel( Node node ){ int level = 0; // String clName = null; if (node.hasChildNodes()) { ` String ndName = node.getNodeName(); ` if( ndName.equals("msqrt") || ndName.equals("mroot") ){ ` level++; } } return level; } >>> \<<< NodeList children = node.getChildNodes(); int max = 0; for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { int d = setRootLevel(child); if( d > max ){ max = d; } } } level += max; >>> \<<< if( ndName.equals("msub") || ndName.equals("msup") || ndName.equals("msubsup") ) { return 0; } >>> \<<< for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { Node cls = child.getAttributes() .getNamedItem("class"); if (cls != null) { String clsName = cls.getNodeValue(); if( clsName.equals("begin-root") || clsName.equals("mid-root") || clsName.equals("end-root") ){ insertLevelPrefix(child, level); } } } } >>> %%%%%%%%%%%%% \section{Modifiers} %%%%%%%%%%%%% %%%%%%%%%%%%%%%%%% \subsection{Over and Under Limit Scripts} %%%%%%%%%%%%%%%%%% \<<< >>> \<<< >>> \<<< >>> \<<< >>> \<<< end scripts end script >>> \<<< >>> \<<< over >>> \<<< under >>> %%%%%%%%%%%%% \subsection{Short Cuts for Math Underline} %%%%%%%%%%%%% \<<< >>> \<<< under bar ` >>> The following code makes to push the munder's under the mover's. \<<< >>> \<<< ` >>> \<<< ` ` >>> \<<< >>> \<<< >>> \begin{verbatim} modified under x with bar \end{verbatim} %%%%%%%%%%%%% \subsection{Short Cuts for Math Overline} %%%%%%%%%%%%% \<<< >>> \<<< ` >>> The following code makes to push the mover's under the munder's. \<<< ` >>> \<<< ` >>> \<<< ` >>> \<<< over bar >>> \begin{verbatim} modified above bold capital Z with bar \end{verbatim} %%%%%%%%%%%%% \section{New Theorems} %%%%%%%%%%%%% \<<< >>> \<<<
>>> \<<< concat( normalize-space( string( descendant::*[ self::p ][1] / descendant::*[ self::span ][1] [ @class = 'theorem-head' ] ) ) , ' ' ) >>> %%%%%%%%%%%%%%%%%% \section{Shared} %%%%%%%%%%%%%%%%%% \<<< >>> \<<< ]]> >>> \<<< x >>> \marginpar{Can dom be prevented from creating an xml declaration in the output? The xslt part is there just to remove the undesirable declaration.} \<<< ` ` >>> \ifdojava \AtEndDocument{\Needs{% "pushd \XTPIPES ; jar cf tex4ht.jar * ; popd ; mv \XTPIPES tex4ht.jar \TEXMFTEXivBIN ; if [ ! -d \TEXMFTEXivXTPIPES\space]; then exit 1; fi ; cp \XTPIPES xtpipes/lib/* \TEXMFTEXivXTPIPES "}} \fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%% \section{Odd Ends} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% \subsection{Font Decorations} %%%%%%%%%%%%% \<<< >>> \<<< bold begin bold end bold >>> %%%%%%%%%%%%%%%%%% \section{Empty Elements} %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%% \section{Prose} %%%%%%%%%%%%%%%%%%