appendix implementation enabled + fixed
This commit is contained in:
@@ -24,9 +24,16 @@ import javax.swing.text.html.parser.ParserDelegator;
|
||||
import com.keypoint.PngEncoder;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class implements a <CODE>ParserCallback</CODE> that translates HTML to
|
||||
* the corresponding <TEX txt="\LaTeX{}">LaTeX</TEX>. Not all tags a processed
|
||||
* but the most common are.
|
||||
* <p>
|
||||
* HTML links to files located in the doc-files directory (<a
|
||||
* href="doc-files/appendix_a.html">appendix_a.html</a>, <a
|
||||
* href="doc-files/appendix_b.txt">appendix_b.txt</a>) are transformed to
|
||||
* references to the appendix, whereby the referenced files itself are included
|
||||
* in the appendix.
|
||||
*
|
||||
* @see javax.swing.text.html.parser.ParserDelegator
|
||||
* @author Soeren Caspersen
|
||||
@@ -250,23 +257,23 @@ public class HTMLtoLaTeXBackEnd extends HTMLEditorKit.ParserCallback {
|
||||
doPrintURL = (String) attrSet.getAttribute("doprinturl");
|
||||
if (refurl != null) {
|
||||
if (TeXDoclet.hyperref) {
|
||||
// if (refurl.toLowerCase().startsWith("doc-files")) {
|
||||
// File file = new File(TeXDoclet.packageDir, refurl);
|
||||
// if (file.exists()) {
|
||||
// if (TeXDoclet.appendencies.contains(file.getPath())) {
|
||||
// refurl = (String) TeXDoclet.appendencies
|
||||
// .get(file.getPath());
|
||||
// } else {
|
||||
// refurl = "appendix"
|
||||
// + new Integer(
|
||||
// TeXDoclet.appendencies.size() + 1);
|
||||
// TeXDoclet.appendencies.put(file.getPath(),
|
||||
// refurl);
|
||||
// }
|
||||
// ret.append("\\hyperref{}{" + refurl + "}{}{");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
if (refurl.toLowerCase().startsWith("doc-files")) {
|
||||
File file = new File(TeXDoclet.packageDir, refurl);
|
||||
if (file.exists()) {
|
||||
if (TeXDoclet.appendencies.contains(file.getPath())) {
|
||||
refurl = (String) TeXDoclet.appendencies
|
||||
.get(file.getPath());
|
||||
} else {
|
||||
refurl = "appendix"
|
||||
+ new Integer(
|
||||
TeXDoclet.appendencies.size() + 1);
|
||||
TeXDoclet.appendencies.put(file.getPath(),
|
||||
refurl);
|
||||
}
|
||||
ret.append("{");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
String sharp = "";
|
||||
if (refurl.indexOf("#") >= 0) {
|
||||
@@ -277,8 +284,10 @@ public class HTMLtoLaTeXBackEnd extends HTMLEditorKit.ParserCallback {
|
||||
}
|
||||
refurl = refurl.substring(0, refurl.indexOf("#"));
|
||||
}
|
||||
ret.append("\\hyperref{" + refurl + "}{" + sharp + "}{}{");
|
||||
ret.append("\\hyperref{" + refurl + "}{" + sharp
|
||||
+ "}{}{");
|
||||
// ret.append("\\href{" + refurl + "}{");
|
||||
}
|
||||
} else {
|
||||
ret.append("{\\bf ");
|
||||
}
|
||||
@@ -392,6 +401,15 @@ public class HTMLtoLaTeXBackEnd extends HTMLEditorKit.ParserCallback {
|
||||
ret.append("}");
|
||||
} else if (tag == HTML.Tag.A) {
|
||||
if (refurl != null) {
|
||||
|
||||
if (refurl.startsWith("appendix")) {
|
||||
|
||||
ret.append("\\refdefined{" + refurl + "}");
|
||||
ret.append("}");
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
ret.append("}");
|
||||
if (doPrintURL != null) {
|
||||
if (!refurl.equals("")) {
|
||||
@@ -400,6 +418,7 @@ public class HTMLtoLaTeXBackEnd extends HTMLEditorKit.ParserCallback {
|
||||
ret.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
} else if (refname != null) {
|
||||
ret.append("}");
|
||||
}
|
||||
|
||||
@@ -213,7 +213,8 @@ public class TeXDoclet extends Doclet {
|
||||
System.out.println("command to execute : " + "javadoc "
|
||||
+ argsString);
|
||||
|
||||
// TODO something goes wrong here. javadoc always prints help output
|
||||
// TODO something goes wrong here. javadoc always prints help
|
||||
// output.
|
||||
|
||||
Process p = Runtime.getRuntime().exec("javadoc", argsJd);
|
||||
p.waitFor();
|
||||
@@ -675,23 +676,25 @@ public class TeXDoclet extends Doclet {
|
||||
os.println("}");
|
||||
}
|
||||
|
||||
// if (appendencies.size() > 0) {
|
||||
// os.println("\\appendix");
|
||||
// Iterator it = appendencies.keySet().iterator();
|
||||
// while (it.hasNext()) {
|
||||
// os.println(" \\chapter{" + (char) ('A' + 1)
|
||||
// + "}\n\\hyperdef{appendix1}{}");
|
||||
// os.println(" \\hyperdef{appendix1}{}sdafafdasd");
|
||||
// String sfa = (String) it.next();
|
||||
if (appendencies.size() > 0) {
|
||||
os.println("\\appendix");
|
||||
Iterator it = appendencies.keySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
os.println("\\" + sectionLevels[0] + "{}{");
|
||||
os.println(" \\label{appendix" + (i + 1) + "}");
|
||||
String sfa = (String) it.next();
|
||||
// System.out.println(sfa);
|
||||
// addFile(os, sfa, true);
|
||||
// }
|
||||
// }
|
||||
addFile(os, sfa, true);
|
||||
os.println("}");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// os.println("\\markboth{}{}");
|
||||
// if (index) {
|
||||
// os.println("\\printindex");
|
||||
// }
|
||||
os.println("\\markboth{}{}");
|
||||
if (index) {
|
||||
os.println("\\printindex");
|
||||
}
|
||||
|
||||
addFile(os, finishFile, false);
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<h2>Appendix A content</h2>
|
||||
content of file doc-files/appendix_a.html
|
||||
@@ -0,0 +1 @@
|
||||
content of file doc-files/appendix_b.txt
|
||||
Reference in New Issue
Block a user