public void testCommentExtraction() throws Exception { GroovyRootDocBuilder builder = new GroovyRootDocBuilder(null, null, new ArrayList<LinkArgument>(), null); SimpleGroovyPackageDoc doc = new SimpleGroovyPackageDoc("org.dummy.cmdline"); builder.processPackageInfo(src, "package-info.groovy", doc); assertEquals("<h1>Description</h1>\n" + " This class is used by an application to process the command line\n" + " that invokes it. The processing of the command line proceeds in\n" + " the following steps.\n" + " <ol>\n" + " <li>Create an <code>CmdLine</code> object specifying the properties\n" + " that control how the command line is to be processed and what\n" + " options the program supports.</li>\n" + " <li>Call \n" + " org.dummy.cmdline.CmdLine#processCmdLine()\n" + " to process the command line.</li>", doc.description().trim()); } }
packagePath = relPackage; processPackageInfo(src, filename, packageDoc); rootDoc.put(packagePath, packageDoc); return;
private void processFile(String filename, File srcFile) throws IOException { String src = DefaultGroovyMethods.getText(srcFile); String packagePath = tool.getPath(filename).replace('\\', FS); String file = tool.getFile(filename); SimpleGroovyPackageDoc packageDoc = (SimpleGroovyPackageDoc) rootDoc.packageNamed(packagePath); if (packageDoc == null) { packageDoc = new SimpleGroovyPackageDoc(packagePath); } if (filename.endsWith("package.html") || filename.endsWith("package-info.java") || filename.endsWith("package-info.groovy")) { processPackageInfo(src, filename, packageDoc); rootDoc.put(packagePath, packageDoc); return; } try { Map<String, GroovyClassDoc> classDocs = getClassDocsFromSingleSource(packagePath, file, src); rootDoc.putAllClasses(classDocs); packageDoc.putAll(classDocs); rootDoc.put(packagePath, packageDoc); } catch (RecognitionException e) { System.err.println("ignored due to RecognitionException: " + filename + " [" + e.getMessage() + "]"); } catch (TokenStreamException e) { System.err.println("ignored due to TokenStreamException: " + filename + " [" + e.getMessage() + "]"); } }
packageDoc = new SimpleGroovyPackageDoc(packagePath); processPackageInfo(src, filename, packageDoc); rootDoc.put(packagePath, packageDoc); return;
packagePath = relPackage; processPackageInfo(src, filename, packageDoc); rootDoc.put(packagePath, packageDoc); return;