X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=utils%2Fhelp2Website.java;h=83e4b5f11ee6ff15cee9fdcb9bbccd657d7de73f;hb=22e330ae3a2ae90e23b14692661bc633de99453d;hp=e7dccd0407d7a2cc4012e53a55822cae68f5dae5;hpb=153dd62dc91da13ae732600e6ea55ddbe15eab39;p=jalview.git diff --git a/utils/help2Website.java b/utils/help2Website.java index e7dccd0..83e4b5f 100755 --- a/utils/help2Website.java +++ b/utils/help2Website.java @@ -1,19 +1,22 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ import java.io.*; import java.util.*; @@ -21,93 +24,87 @@ import java.util.*; public class help2Website { - public static void main(String [] args) - { - String line = ""; - try{ - Hashtable targets = new Hashtable(); - - File toc = new File("helpTOC.xml"); - File jhm = new File("help.jhm"); - - BufferedReader in = new BufferedReader(new FileReader(jhm)); - - PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html")); - out.println("Jalview - Help \n" - +"\n" - +"

Contents

\n"); - - - StringTokenizer st; - StringBuffer indent = new StringBuffer(); - String target, url, text; - while( (line = in.readLine()) != null) - { - if(line.indexOf("target")==-1) - continue; + public static void main(String[] args) + { + String line = ""; + try + { + Hashtable targets = new Hashtable(); + File toc = new File("helpTOC.xml"); + File jhm = new File("help.jhm"); - st = new StringTokenizer(line, "\""); - st.nextToken(); //Jalview - Help \n" + + "\n" + + "

Contents

\n"); - url = st.nextToken(); - targets.put(target, url); - } + StringTokenizer st; + StringBuffer indent = new StringBuffer(); + String target, url, text; + while ((line = in.readLine()) != null) + { + if (line.indexOf("target") == -1) + continue; - in = new BufferedReader(new FileReader(toc)); - while( (line = in.readLine()) != null) - { - if(line.indexOf("")!=-1) - indent.setLength(indent.length()-18); + st = new StringTokenizer(line, "\""); + st.nextToken(); // ") != -1) + indent.setLength(indent.length() - 18); - target = st.nextToken(); + if (line.indexOf(""+indent+"" - +text - +""); - } - else - out.println("
"+indent+text); + st = new StringTokenizer(line, "\""); + st.nextToken(); + text = st.nextToken(); + st.nextToken(); - if(line.indexOf("/>")==-1) - indent.append("   "); + target = st.nextToken(); - } - // Add Googletracker. + if (targets.get(target) != null) + { + out.println("
" + indent + "" + text + ""); + } + else + out.println("
" + indent + text); + if (line.indexOf("/>") == -1) + indent.append("   "); - out.close(); + } + // Add Googletracker. - } + out.close(); - catch(Exception ex) - { + } - ex.printStackTrace(); + catch (Exception ex) + { - System.out.println("\n"+line+"\n"); + ex.printStackTrace(); - System.out.println("Usage: move to Help directory. help2Website will read" - +"\nhelpTOC.xml and help.jhm producing output helpTOC.html"); - } - } + System.out.println("\n" + line + "\n"); + System.out + .println("Usage: move to Help directory. help2Website will read" + + "\nhelpTOC.xml and help.jhm producing output helpTOC.html"); + } + } }