2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
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 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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
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");