% $Id: tex4ht-xhtml-xtpipes.tex 740 2020-06-13 22:35:32Z karl $
% htlatex tex4ht-xhtml-xtpipes "xhtml,next,3" "" "-d./"
%
% Copyright 2009-2020 TeX Users Group
% Copyright 1996-2009 Eitan M. Gurari
% Released under LPPL 1.3c+.
% See tex4ht-cpright.tex for license text.
\documentclass{article}
\Configure{ProTex}{log,<<<>>>,title,list,`,[[]]}
\usepackage{url}
\input{common.tex}
\begin{document}
\input tex4ht-cpright.tex
\input tex4ht-dir
%%%%%%%%%%%%%%%%%%
\part{Post Processing for Html Output Mode}
%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%
\section{Outline}
%%%%%%%%%%%%%%%%%%
\AtEndDocument{\OutputCodE\}
\Needs{"xmllint --valid --noout xhtml.4xt"}
\<<<
`
`
`
`
>>>
%%%%%%%%%%%%%%%%%%
\section{email script}
%%%%%%%%%%%%%%%%%%
\<<<
>>>
`
`
`
\<<<
>>>
\<<<
>>>
\<<<
(`version)
>>>
\AtEndDocument{%
\OutputCodE\
}
\ifdojava
\Needs{"
javac -classpath \TEXMFTEXivBIN tex4ht.jar
XhtmlEmails.java
-d \XTPIPES
"}
\fi
\<<<
package tex4ht;
/* XhtmlEmails.java (`version), generated from `jobname.tex
Copyright (C) 2009-2010 TeX Users Group
Copyright (C) `CopyYear.2008. 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 XhtmlEmails extends DefaultHandler {
PrintWriter out = null;
String data = "";
public XhtmlEmails(PrintWriter out,
HashMap scripts,
Method method, PrintWriter log, boolean trace) {
this.out = out;
}
public void characters(char[] ch, int start, int length) {
data += new String(ch, start, length);
//XtpipesUni.toUni(ch, start, length, "<>&");
}
public void startElement(String ns, String sName,
String qName,
Attributes atts) {
String s = "<" + qName + "\n";
for (int i = 0; i < atts.getLength(); i++) {
String name = atts.getQName(i);
s += (" " + name + "=\""
+ XtpipesUni.toUni(atts.getValue(i), "<>&\"")
+ "\"");
}
s += ">";
`
out.print(XtpipesUni.toUni(data, "&") + s);
data = "";
}
public void endElement(String ns, String sName, String qName) {
String s = "" + qName + ">";
`
out.print( XtpipesUni.toUni(data, "&") + s);
data = "";
}
}
>>>
\<<<
while( data.indexOf('@') >0 ){
`
`
}
data = XtpipesUni.toUni(data, "<>&");
>>>
\<<<
String [] pre = data.split(
"[`]*@"
, 2);
if( pre[0].endsWith("}") ){
if( pre[0].indexOf("{") != -1 ){
pre[0] = pre[0].substring( 0, pre[0].lastIndexOf("{") );
} }
int len = pre[0] . length();
if( len > 0 ){
out.print( XtpipesUni.toUni(pre[0], "<>&") );
data = data.substring(len);
}
>>>
\<<<
String [] post = data.split(
"@[`]*"
, 2);
if( post[1] . length() > 0 ){
data = data.substring(0, data.length() - post[1] . length());
}
`
data = post[1];
>>>
\<<<
if( data.indexOf("{") == -1 ){
out.print(
""
+ XtpipesUni.toUni(data, "<>&")
+ ""
);
} else {
int idx = data.indexOf('@');
String ext = data.substring(idx);
data = data.substring(0,idx);
`
}
>>>
\<<<
while( true ){
pre = data.split(
"[`]+"
, 2);
if( pre.length < 2 ){
out.print( XtpipesUni.toUni(data + ext, "<>&") );
data = "";
break;
}
len = pre[0] . length();
if( len > 0 ){
out.print( XtpipesUni.toUni(pre[0], "<>&") );
data = data.substring(len);
}
data = data.substring(0, data.length() - pre[1].length());
out.print(
""
+ XtpipesUni.toUni(data, "<>&")
+ ""
);
data = pre[1];
}
>>>
\<<<
\\p{javaLowerCase}\\p{javaUpperCase}\\d\\-_\\./&>>>
\url{http://tools.ietf.org/html/rfc2368}
\begin{verbatim}
Alice Smith"
{alice, bob}@somewhere.com
alice@somewhere.com, bob@somewhere.com
\end{verbatim}
%%%%%%%%%%%%%%%%%%
\section{Long Tables}
%%%%%%%%%%%%%%%%%%
\<<<
>>>
\<<<
>>>
%%%%%%%%%%%%%%%%%%
\section{Tabular}
%%%%%%%%%%%%%%%%%%
\<<<
>>>
\<<<
OK 1
OK 2
>>>
\<<<
OK 1
OK 2
>>>
%%%%%%%%%%%%%%%%%%
\section{Empty HTML Element Script}
%%%%%%%%%%%%%%%%%%
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
>>>
\<<<
="
"
>>>
%%%%%%%%%%%%%%%%%%
\section{Shared}
%%%%%%%%%%%%%%%%%%
\<<<
>>>
\<<<
]]>
>>>
\ifdojava
\AtEndDocument{\Needs{%
"pushd \XTPIPES || exit 1
;
jar cf tex4ht.jar *
;
popd
;
if [ ! -d \TEXMFTEXivBIN\space]; then exit 1; fi
;
mv \XTPIPES tex4ht.jar \TEXMFTEXivBIN
;
if [ ! -d \TEXMFTEXivXTPIPES\space]; then exit 1; fi
;
cp \XTPIPES xtpipes/lib/*
\TEXMFTEXivXTPIPES
"}}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%