2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
24 public class help2Website
27 public static void main(String [] args)
31 Hashtable targets = new Hashtable();
33 File toc = new File("helpTOC.xml");
34 File jhm = new File("help.jhm");
36 BufferedReader in = new BufferedReader(new FileReader(jhm));
38 PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
39 out.println("<html><head><title>Jalview - Help </title></head>\n"
40 +"<body bgcolor=#F1F1F1>\n"
41 +"<p><center><strong>Contents</strong></center></p>\n");
45 StringBuffer indent = new StringBuffer();
46 String target, url, text;
47 while( (line = in.readLine()) != null)
49 if(line.indexOf("target")==-1)
53 st = new StringTokenizer(line, "\"");
54 st.nextToken(); //<mapID target="
56 target = st.nextToken();
57 st.nextToken(); //" url="
60 targets.put(target, url);
63 in = new BufferedReader(new FileReader(toc));
64 while( (line = in.readLine()) != null)
66 if(line.indexOf("</tocitem>")!=-1)
67 indent.setLength(indent.length()-18);
69 if(line.indexOf("<tocitem")==-1)
72 st = new StringTokenizer(line, "\"");
75 text = st.nextToken();
78 target = st.nextToken();
80 if(targets.get(target)!=null)
82 out.println("<br>"+indent+"<a href=\""
84 +"\" target=bodyframe>"
89 out.println("<br>"+indent+text);
92 if(line.indexOf("/>")==-1)
93 indent.append(" ");
106 ex.printStackTrace();
108 System.out.println("\n"+line+"\n");
110 System.out.println("Usage: move to Help directory. help2Website will read"
111 +"\nhelpTOC.xml and help.jhm producing output helpTOC.html");