diff --git a/doclet/ReferenceGenerator/bin/ProcessingWeblet.class b/doclet/ReferenceGenerator/bin/ProcessingWeblet.class index eaf1d8486..d941c41a9 100644 Binary files a/doclet/ReferenceGenerator/bin/ProcessingWeblet.class and b/doclet/ReferenceGenerator/bin/ProcessingWeblet.class differ diff --git a/doclet/ReferenceGenerator/bin/writers/BaseWriter.class b/doclet/ReferenceGenerator/bin/writers/BaseWriter.class index 471ce0067..969096f16 100644 Binary files a/doclet/ReferenceGenerator/bin/writers/BaseWriter.class and b/doclet/ReferenceGenerator/bin/writers/BaseWriter.class differ diff --git a/doclet/ReferenceGenerator/bin/writers/ClassWriter.class b/doclet/ReferenceGenerator/bin/writers/ClassWriter.class index 26fb29ba2..094d3bb05 100644 Binary files a/doclet/ReferenceGenerator/bin/writers/ClassWriter.class and b/doclet/ReferenceGenerator/bin/writers/ClassWriter.class differ diff --git a/doclet/ReferenceGenerator/bin/writers/FieldWriter.class b/doclet/ReferenceGenerator/bin/writers/FieldWriter.class index 3addad6fd..5a34bd21b 100644 Binary files a/doclet/ReferenceGenerator/bin/writers/FieldWriter.class and b/doclet/ReferenceGenerator/bin/writers/FieldWriter.class differ diff --git a/doclet/ReferenceGenerator/bin/writers/FunctionWriter.class b/doclet/ReferenceGenerator/bin/writers/FunctionWriter.class index d031cd27f..282936476 100644 Binary files a/doclet/ReferenceGenerator/bin/writers/FunctionWriter.class and b/doclet/ReferenceGenerator/bin/writers/FunctionWriter.class differ diff --git a/doclet/ReferenceGenerator/bin/writers/LibraryIndexWriter.class b/doclet/ReferenceGenerator/bin/writers/LibraryIndexWriter.class deleted file mode 100644 index ee3324522..000000000 Binary files a/doclet/ReferenceGenerator/bin/writers/LibraryIndexWriter.class and /dev/null differ diff --git a/doclet/ReferenceGenerator/bin/writers/LibraryWriter.class b/doclet/ReferenceGenerator/bin/writers/LibraryWriter.class index 06c2e443c..2c3a41d5e 100644 Binary files a/doclet/ReferenceGenerator/bin/writers/LibraryWriter.class and b/doclet/ReferenceGenerator/bin/writers/LibraryWriter.class differ diff --git a/doclet/ReferenceGenerator/bin/writers/Shared.class b/doclet/ReferenceGenerator/bin/writers/Shared.class index 951921d58..c8a7cb820 100644 Binary files a/doclet/ReferenceGenerator/bin/writers/Shared.class and b/doclet/ReferenceGenerator/bin/writers/Shared.class differ diff --git a/doclet/ReferenceGenerator/processingrefBuild.sh b/doclet/ReferenceGenerator/processingrefBuild.sh index 498ad2c68..81a59a654 100755 --- a/doclet/ReferenceGenerator/processingrefBuild.sh +++ b/doclet/ReferenceGenerator/processingrefBuild.sh @@ -5,7 +5,7 @@ echo "[REFERENCE GENERATOR] Booting up..." # PROCESSING_SRC_PATH=./test PROCESSING_SRC_PATH=../../core/src PROCESSING_LIB_PATH=../../java/libraries -REFERENCES_OUT_PATH=../../../processing-website +REFERENCES_OUT_PATH=../../../processing-website/content/references/translations/en # GENERATE REFERENCE ENTRIES AND INDEX THROUGH JAVADOC - BY DAVID WICKS echo "[REFERENCE GENERATOR] Source Path :: $PROCESSING_SRC_PATH" @@ -13,20 +13,14 @@ echo "[REFERENCE GENERATOR] Library Path :: $PROCESSING_LIB_PATH" echo "[REFERENCE GENERATOR] Removing previous version of the ref..." -rm -rf ../../reference -mkdir ../../reference -rm -rf ../../distribution -mkdir ../../distribution -rm -rf $REFERENCES_OUT_PATH/json -mkdir $REFERENCES_OUT_PATH/json -mkdir $REFERENCES_OUT_PATH/json/libraries -mkdir $REFERENCES_OUT_PATH/json/libraries/io -mkdir $REFERENCES_OUT_PATH/json/libraries/net -mkdir $REFERENCES_OUT_PATH/json/libraries/data -mkdir $REFERENCES_OUT_PATH/json/libraries/serial -mkdir $REFERENCES_OUT_PATH/json/libraries/opengl -mkdir $REFERENCES_OUT_PATH/json/libraries/sound -mkdir $REFERENCES_OUT_PATH/json/libraries/video +rm -rf $REFERENCES_OUT_PATH +mkdir $REFERENCES_OUT_PATH +mkdir $REFERENCES_OUT_PATH/processing +mkdir $REFERENCES_OUT_PATH/io +mkdir $REFERENCES_OUT_PATH/net +mkdir $REFERENCES_OUT_PATH/serial +mkdir $REFERENCES_OUT_PATH/sound +mkdir $REFERENCES_OUT_PATH/video echo "[REFERENCE GENERATOR] Generating new javadocs..." javadoc -doclet ProcessingWeblet \ diff --git a/doclet/ReferenceGenerator/src/ProcessingWeblet.java b/doclet/ReferenceGenerator/src/ProcessingWeblet.java index 337e32521..1a8a42726 100644 --- a/doclet/ReferenceGenerator/src/ProcessingWeblet.java +++ b/doclet/ReferenceGenerator/src/ProcessingWeblet.java @@ -62,15 +62,6 @@ public class ProcessingWeblet extends Standard { // see: /api_en/include System.out.println("===Source code @webref files written.==="); - - if (!Shared.i().getIncludeDirectory().equals("")) - { - System.out.println("\n===Writing XML-sourced reference.==="); - - //XMLReferenceWriter.write( Shared.i().getIncludeDirectory(), indexWriter); - - System.out.println("===Include directory files written.==="); - } // write out the index file diff --git a/doclet/ReferenceGenerator/src/writers/BaseWriter.java b/doclet/ReferenceGenerator/src/writers/BaseWriter.java index 6ccf8d723..713effb40 100644 --- a/doclet/ReferenceGenerator/src/writers/BaseWriter.java +++ b/doclet/ReferenceGenerator/src/writers/BaseWriter.java @@ -10,12 +10,6 @@ import java.util.HashMap; import java.util.Locale; import java.util.TimeZone; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - import org.w3c.dom.Document; import org.w3c.dom.NodeList; @@ -37,7 +31,7 @@ public class BaseWriter { // Some utilities public final static String MODE_JAVASCRIPT = "js"; - public final static String jsonDir = "../../../processing-website/json/"; + public final static String jsonDir = "../../../processing-website/content/references/translations/en/processing/"; public BaseWriter() { @@ -78,7 +72,11 @@ public class BaseWriter { //add package name to anchor String[] parts = doc.containingPackage().name().split("\\."); String pkg = parts[parts.length-1] + "/"; - ret = "libraries/" + pkg + ret; + if (pkg.equals("data/") || pkg.equals("opengl/")) + ret = ret; + else + ret = pkg + ret; + } return ret; @@ -597,49 +595,7 @@ public class BaseWriter { // add link to each @see_external item for( Tag tag : doc.tags( Shared.i().getSeeAlsoTagName() ) ) { - // get xml for method - String filename = tag.text() + ".json"; - String basePath = Shared.i().getJSONDirectory(); - File f = new File( basePath + filename ); - - if( ! f.exists() ) - { - basePath = Shared.i().getIncludeDirectory(); - f = new File( basePath + filename ); - } - - if( f.exists() ) - { - Document xmlDoc = Shared.loadXmlDocument( f.getPath() ); - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - - try - { - String name = (String) xpath.evaluate("//name", xmlDoc, XPathConstants.STRING); - // get anchor from original filename - String path = f.getAbsolutePath(); - String anchorBase = path.substring( path.lastIndexOf("/")+1, path.indexOf(".xml")); - if( name.endsWith("()") ) - { - if( !anchorBase.endsWith("_" ) ) - { - anchorBase += "_"; - } - } - String anchor = anchorBase; - - // get method name from xml - // get anchor from method name - HashMap map = new HashMap(); - map.put( "anchor", anchor ); - - related.add( anchor ); - } catch (XPathExpressionException e) - { - e.printStackTrace(); - } - } + related.add( tag.text().concat("_") ); } return related; diff --git a/doclet/ReferenceGenerator/src/writers/LibraryIndexWriter.java b/doclet/ReferenceGenerator/src/writers/LibraryIndexWriter.java deleted file mode 100644 index 4d32d75ed..000000000 --- a/doclet/ReferenceGenerator/src/writers/LibraryIndexWriter.java +++ /dev/null @@ -1,130 +0,0 @@ -package writers; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -import com.sun.javadoc.ClassDoc; -import com.sun.javadoc.MethodDoc; -import com.sun.javadoc.PackageDoc; -/** - * Writes the index page of libraries. - * Also grabs the xml files in lib/dir/events - * and sends them to the XMLReferenceWriter - * - * @author davidwicks - * - */ -public class LibraryIndexWriter extends IndexWriter { - HashMap sections; - ArrayList classes; - ArrayList events; - TemplateWriter templateWriter; - - public LibraryIndexWriter(PackageDoc doc, String outputPath){ - sections = new HashMap(); - classes = new ArrayList(); - events = new ArrayList(); - - templateWriter = new TemplateWriter(); - writePartials(doc, outputPath); - } - - private void writePartials(PackageDoc doc, String outputPath){ - for( ClassDoc cd : doc.allClasses() ){ - addItem(cd); - } - } - - private void getXMLInformation(String path){ - - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - DocumentBuilder builder; - Document xmlDoc = null; - try { - builder = factory.newDocumentBuilder(); - xmlDoc = builder.parse(path); - } catch (ParserConfigurationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SAXException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - System.out.println("WARNING: no index.xml file found at: " + path ); - return; - } - - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - try { - String name = (String) xpath.evaluate("//libraryName", xmlDoc, XPathConstants.STRING); - String desc = (String) xpath.evaluate("//libraryDescription", xmlDoc, XPathConstants.STRING); - - sections.put("libraryname", name); - sections.put("librarydescription", desc); - } catch (XPathExpressionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private String explode(ArrayList array){ - String ret = ""; - Collections.sort(array); - for(String s : array){ - ret += s + "\n"; - } - return ret; - } - - public void write (String path) throws IOException { - templateWriter.write("library.index.template.html", sections, path+"index.html"); - } - - public void addItem (ClassDoc doc) { - ArrayList> methods = new ArrayList>(); - HashMap cmap = new HashMap(); - - HashMap map = new HashMap(); - map.put("name", getName(doc)); - map.put("anchor", getLocalAnchor(doc)); - methods.add(map); - - for(MethodDoc m : doc.methods()){ - if(Shared.i().isWebref(m)){ - HashMap methodMap = new HashMap(); - methodMap.put("name", getName(m)); - methodMap.put("anchor", getLocalAnchor(m)); - methods.add(methodMap); - } - } - - cmap.put("methods", templateWriter.writeLoop("related.partial.html", methods)); - cmap.put("classname", getName(doc) + " Class"); - cmap.put("classdescription", getBriefDescriptionFromSource(doc)); - - classes.add(templateWriter.writePartial("library.section.partial.html", cmap)); - } - - public void addEvent(String name, String anchor){ - HashMap map = new HashMap(); - map.put("name", name); - map.put("anchor", getAnchorFromName(name)); - events.add(templateWriter.writePartial("related.partial.html", map) + "\n"); - } -} diff --git a/doclet/ReferenceGenerator/src/writers/LibraryWriter.java b/doclet/ReferenceGenerator/src/writers/LibraryWriter.java index 2fcc5e112..6f931ad10 100644 --- a/doclet/ReferenceGenerator/src/writers/LibraryWriter.java +++ b/doclet/ReferenceGenerator/src/writers/LibraryWriter.java @@ -10,11 +10,12 @@ import com.sun.javadoc.PackageDoc; public class LibraryWriter extends BaseWriter { PackageDoc doc; String pkg; - LibraryIndexWriter indexWriter; String dir; static TemplateWriter templateWriter; static ArrayList writtenLibraries; + + private String libDir ="../../../processing-website/content/references/translations/en/"; public LibraryWriter(){ if(templateWriter == null ){ @@ -38,10 +39,12 @@ public class LibraryWriter extends BaseWriter { String[] parts = doc.name().split("\\."); String pkg = parts[parts.length-1] + "/"; - dir = jsonDir + "libraries/"+pkg; + if (pkg.equals("data/") || pkg.equals("opengl/")) + dir = jsonDir; + else + dir = libDir + pkg; Shared.i().createOutputDirectory(dir); - indexWriter = new LibraryIndexWriter(doc, dir); //grab all relevant information for the doc for( ClassDoc classDoc : doc.allClasses() ){ @@ -58,19 +61,4 @@ public class LibraryWriter extends BaseWriter { } } - - private void writeRemainingXml( String xmlDir ) - { - File directory = new File( xmlDir ); - File[] files = directory.listFiles(); - for( File f : files ) - { - if( f.getAbsolutePath().endsWith("xml") ) - { - // try writing everything (will not overwrite any existing docs) - //XMLReferenceWriter.parseFile( f.getAbsoluteFile(), dir, indexWriter ); - } - - } - } } diff --git a/doclet/ReferenceGenerator/src/writers/Shared.java b/doclet/ReferenceGenerator/src/writers/Shared.java index 9cfc261d6..de1a0178b 100644 --- a/doclet/ReferenceGenerator/src/writers/Shared.java +++ b/doclet/ReferenceGenerator/src/writers/Shared.java @@ -4,12 +4,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - import org.w3c.dom.Document; -import org.xml.sax.SAXException; import com.sun.javadoc.Doc; import com.sun.javadoc.ProgramElementDoc; @@ -32,7 +27,7 @@ public class Shared { private String templateDirectory = "templates"; private String exampleDirectory = "web_examples"; private String includeDirectory = "include"; - private String jsonDirectory ="../../../processing-website/json/"; + private String jsonDirectory ="../../../processing-website/content/references/translations/en/processing/"; boolean noisy = false; public ArrayList corePackages; @@ -183,29 +178,6 @@ public class Shared { f.mkdirs(); } - public static Document loadXmlDocument( String path ) - { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - DocumentBuilder builder; - Document doc = null; - try { - builder = factory.newDocumentBuilder(); - doc = builder.parse( path ); - } catch (ParserConfigurationException e) { - System.out.println("Failed to parse " + path ); - System.out.println( e.getLocalizedMessage() ); - } catch (SAXException e) { - System.out.println("Failed to parse " + path ); - System.out.println( e.getLocalizedMessage() ); - } catch (IOException e) { - System.out.println("Failed to parse " + path ); - System.out.println( e.getLocalizedMessage() ); - } - - return doc; - } - public void createBaseDirectories(){ File f = new File(getLocalOutputDirectory()); f.mkdirs();