2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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)
32 Hashtable targets = new Hashtable();
34 File toc = new File("helpTOC.xml");
35 File jhm = new File("help.jhm");
37 BufferedReader in = new BufferedReader(new FileReader(jhm));
39 PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
40 out.println("<html><head><title>Jalview - Help </title></head>\n"
41 + "<body bgcolor=#F1F1F1>\n"
42 + "<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)
52 st = new StringTokenizer(line, "\"");
53 st.nextToken(); // <mapID target="
55 target = st.nextToken();
56 st.nextToken(); // " url="
59 targets.put(target, url);
62 in = new BufferedReader(new FileReader(toc));
63 while ((line = in.readLine()) != null)
65 if (line.indexOf("</tocitem>") != -1)
66 indent.setLength(indent.length() - 18);
68 if (line.indexOf("<tocitem") == -1)
71 st = new StringTokenizer(line, "\"");
74 text = st.nextToken();
77 target = st.nextToken();
79 if (targets.get(target) != null)
81 out.println("<br>" + indent + "<a href=\"" + targets.get(target)
82 + "\" target=bodyframe>" + text + "</a>");
85 out.println("<br>" + indent + text);
87 if (line.indexOf("/>") == -1)
88 indent.append(" ");
100 ex.printStackTrace();
102 System.out.println("\n" + line + "\n");
105 .println("Usage: move to Help directory. help2Website will read"
106 + "\nhelpTOC.xml and help.jhm producing output helpTOC.html");