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