import java.net.*; import java.io.*; import java.util.*; //-- import EndText; //-- import ReplaceText; /** * Provides a basic way to convert a minimal subset of * docbook to a minimal subset of lateX. The docbook * subset is that which is produced by the text document * transformation classes. * * If a more comprehensive transformation is required then * the standard docbook toolchain should probably be used. * * in a string. * * @author http://bumble.sf.net */ public class DocBookToLatex extends Object { //-------------------------------------------- private static String NEWLINE = System.getProperty("line.separator"); //-------------------------------------------- private String text; //-------------------------------------------- public DocBookToLatex() { this.text = ""; } //-------------------------------------------- public DocBookToLatex(String sText) { this.text = sText; } //-------------------------------------------- /** converts */ public static String convert(String sDocBookText) { StringBuffer sbReturn = new StringBuffer(""); //-- need to write a replace buffer class to replace //-- strings in a string buffer. sbReturn.append(ReplaceText.replaceString(); return sbReturn.toString(); } //-- method: convert //-------------------------------------------- /** a main method for testing */ public static void main(String[] args) throws Exception { StringBuffer sbUsageMessage = new StringBuffer(""); sbUsageMessage.append("test usage: java DocBookToLatex char string"); sbUsageMessage.append(NEWLINE); StringBuffer sbMessage = new StringBuffer(""); if (args.length < 2) { System.out.println(sbUsageMessage); System.exit(-1); } String sText = "This is the old text"; char cReplace = args[0].charAt(0); String sOld = args[0]; String sNew = args[1]; System.out.println("Using string:"); System.out.println(sText); System.out.println(""); System.out.print(".replace() >"); System.out.println(DocBookToLatex.replace(sText, cReplace, sNew)); System.out.print(".replaceString() >"); System.out.println(DocBookToLatex.replaceString(sText, sOld, sNew)); } //-- main() } //-- DocBookToLatex class