4 public class help2Website
\r
7 public static void main(String [] args)
\r
10 Hashtable targets = new Hashtable();
\r
12 File toc = new File("helpTOC.xml");
\r
13 File jhm = new File("help.jhm");
\r
15 BufferedReader in = new BufferedReader(new FileReader(jhm));
\r
17 PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
\r
18 out.println("<html><head></head><title>Jalview - Help </title></head>\n"
\r
19 +"<body bgcolor=#F1F1F1>\n"
\r
20 +"<p><center><strong>Contents</strong></center></p>\n");
\r
25 StringBuffer indent = new StringBuffer();
\r
26 String target, url, text;
\r
27 while( (line = in.readLine()) != null)
\r
29 if(line.indexOf("target")==-1)
\r
32 st = new StringTokenizer(line, "\"");
\r
33 st.nextToken(); //<mapID target="
\r
35 target = st.nextToken();
\r
36 st.nextToken(); //" url="
\r
38 url = st.nextToken();
\r
39 targets.put(target, url);
\r
42 in = new BufferedReader(new FileReader(toc));
\r
43 while( (line = in.readLine()) != null)
\r
45 if(line.indexOf("</tocitem>")!=-1)
\r
46 indent.setLength(indent.length()-18);
\r
48 if(line.indexOf("<tocitem")==-1)
\r
51 st = new StringTokenizer(line, "\"");
\r
54 text = st.nextToken();
\r
57 target = st.nextToken();
\r
59 if(targets.get(target)!=null)
\r
60 out.println("<br>"+indent+"<a href=\""
\r
61 + targets.get(target)
\r
62 +"\" target=bodyframe>"
\r
66 out.println("<br>"+indent+text);
\r
69 if(line.indexOf("/>")==-1)
\r
70 indent.append(" ");
\r
74 out.println("</body>\n</html>");
\r
83 ex.printStackTrace();
\r
85 System.out.println("Usage: move to Help directory. help2Website will read"
\r
86 +"\nhelpTOC.xml and help.jhm producing output helpTOC.html");
\r