2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 public class help2Website
25 public static void main(String [] args)
29 Hashtable targets = new Hashtable();
31 File toc = new File("helpTOC.xml");
32 File jhm = new File("help.jhm");
34 BufferedReader in = new BufferedReader(new FileReader(jhm));
36 PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
37 out.println("<html><head><title>Jalview - Help </title></head>\n"
38 +"<body bgcolor=#F1F1F1>\n"
39 +"<p><center><strong>Contents</strong></center></p>\n");
43 StringBuffer indent = new StringBuffer();
44 String target, url, text;
45 while( (line = in.readLine()) != null)
47 if(line.indexOf("target")==-1)
51 st = new StringTokenizer(line, "\"");
52 st.nextToken(); //<mapID target="
54 target = st.nextToken();
55 st.nextToken(); //" url="
58 targets.put(target, url);
61 in = new BufferedReader(new FileReader(toc));
62 while( (line = in.readLine()) != null)
64 if(line.indexOf("</tocitem>")!=-1)
65 indent.setLength(indent.length()-18);
67 if(line.indexOf("<tocitem")==-1)
70 st = new StringTokenizer(line, "\"");
73 text = st.nextToken();
76 target = st.nextToken();
78 if(targets.get(target)!=null)
80 out.println("<br>"+indent+"<a href=\""
82 +"\" target=bodyframe>"
87 out.println("<br>"+indent+text);
90 if(line.indexOf("/>")==-1)
91 indent.append(" ");
104 ex.printStackTrace();
106 System.out.println("\n"+line+"\n");
108 System.out.println("Usage: move to Help directory. help2Website will read"
109 +"\nhelpTOC.xml and help.jhm producing output helpTOC.html");