4 public class help2Website
\r
7 public static void main(String [] args)
\r
11 Hashtable targets = new Hashtable();
\r
13 File toc = new File("helpTOC.xml");
\r
14 File jhm = new File("help.jhm");
\r
16 BufferedReader in = new BufferedReader(new FileReader(jhm));
\r
18 PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
\r
19 out.println("<html><head><title>Jalview - Help </title></head>\n"
\r
20 +"<body bgcolor=#F1F1F1>\n"
\r
21 +"<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
33 st = new StringTokenizer(line, "\"");
\r
34 st.nextToken(); //<mapID target="
\r
36 target = st.nextToken();
\r
37 st.nextToken(); //" url="
\r
39 url = st.nextToken();
\r
40 targets.put(target, url);
\r
43 in = new BufferedReader(new FileReader(toc));
\r
44 while( (line = in.readLine()) != null)
\r
46 if(line.indexOf("</tocitem>")!=-1)
\r
47 indent.setLength(indent.length()-18);
\r
49 if(line.indexOf("<tocitem")==-1)
\r
52 st = new StringTokenizer(line, "\"");
\r
55 text = st.nextToken();
\r
58 target = st.nextToken();
\r
60 if(targets.get(target)!=null)
\r
61 out.println("<br>"+indent+"<a href=\""
\r
62 + targets.get(target)
\r
63 +"\" target=bodyframe>"
\r
67 out.println("<br>"+indent+text);
\r
70 if(line.indexOf("/>")==-1)
\r
71 indent.append(" ");
\r
75 out.println("</body>\n</html>");
\r
85 ex.printStackTrace();
\r
87 System.out.println("\n"+line+"\n");
\r
89 System.out.println("Usage: move to Help directory. help2Website will read"
\r
90 +"\nhelpTOC.xml and help.jhm producing output helpTOC.html");
\r