2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
21 public class help2Website
24 public static void main(String [] args)
28 Hashtable targets = new Hashtable();
30 File toc = new File("helpTOC.xml");
31 File jhm = new File("help.jhm");
33 BufferedReader in = new BufferedReader(new FileReader(jhm));
35 PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
36 out.println("<html><head><title>Jalview - Help </title></head>\n"
37 +"<body bgcolor=#F1F1F1>\n"
38 +"<p><center><strong>Contents</strong></center></p>\n");
42 StringBuffer indent = new StringBuffer();
43 String target, url, text;
44 while( (line = in.readLine()) != null)
46 if(line.indexOf("target")==-1)
50 st = new StringTokenizer(line, "\"");
51 st.nextToken(); //<mapID target="
53 target = st.nextToken();
54 st.nextToken(); //" url="
57 targets.put(target, url);
60 in = new BufferedReader(new FileReader(toc));
61 while( (line = in.readLine()) != null)
63 if(line.indexOf("</tocitem>")!=-1)
64 indent.setLength(indent.length()-18);
66 if(line.indexOf("<tocitem")==-1)
69 st = new StringTokenizer(line, "\"");
72 text = st.nextToken();
75 target = st.nextToken();
77 if(targets.get(target)!=null)
79 out.println("<br>"+indent+"<a href=\""
81 +"\" target=bodyframe>"
86 out.println("<br>"+indent+text);
89 if(line.indexOf("/>")==-1)
90 indent.append(" ");
103 ex.printStackTrace();
105 System.out.println("\n"+line+"\n");
107 System.out.println("Usage: move to Help directory. help2Website will read"
108 +"\nhelpTOC.xml and help.jhm producing output helpTOC.html");