packageDoc = new SimpleGroovyPackageDoc(relPackage); packagePath = relPackage; packageDoc = new SimpleGroovyPackageDoc(packagePath); packageDoc.putAll(classDocs); rootDoc.put(packagePath, packageDoc); } catch (RecognitionException e) {
public String nameWithDots() { return name().replace(FS, '.'); }
/* package private */ void processPackageInfo(String src, String filename, SimpleGroovyPackageDoc packageDoc) { String relPath = packageDoc.getRelativeRootPath(); String description = calcThenSetPackageDescription(src, filename, relPath); packageDoc.setDescription(description); // get same description but with paths relative to root String altDescription = calcThenSetPackageDescription(src, filename, ""); calcThenSetSummary(altDescription, packageDoc); }
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()); } }
private void calcThenSetSummary(String src, SimpleGroovyPackageDoc packageDoc) { packageDoc.setSummary(SimpleGroovyDoc.calculateFirstSentence(src)); }
private String calcThenSetPackageDescription(String src, SimpleGroovyPackageDoc packageDoc) { String description = scrubOffExcessiveTags(src); packageDoc.setDescription(description); return description; }
private String replaceAllTags(String self, String s1, String s2, Pattern regex, SimpleGroovyPackageDoc packageDoc) { Matcher matcher = regex.matcher(self); if (matcher.find()) { matcher.reset(); StringBuffer sb = new StringBuffer(); while (matcher.find()) { String tagname = matcher.group(1); if (tagname.equals("see") || tagname.equals("link")) { matcher.appendReplacement(sb, s1 + SimpleGroovyClassDoc.getDocUrl( SimpleGroovyClassDoc.encodeSpecialSymbols(matcher.group(2)), false, links, packageDoc.getRelativeRootPath(), rootDoc, null) + s2); } else if (!tagname.equals("interface")) { matcher.appendReplacement(sb, s1 + SimpleGroovyClassDoc.encodeSpecialSymbols(matcher.group(2)) + s2); } } matcher.appendTail(sb); return sb.toString(); } else { return self; } }
private static void calcThenSetSummary(String src, SimpleGroovyPackageDoc packageDoc) { packageDoc.setSummary(SimpleGroovyDoc.calculateFirstSentence(src)); }
private String calcThenSetPackageDescription(String src, String filename, SimpleGroovyPackageDoc packageDoc) { String description; if (filename.endsWith(".html")) { description = scrubOffExcessiveTags(src); description = pruneTagFromFront(description, "p"); description = pruneTagFromEnd(description, "/p"); } else { description = trimPackageAndComments(src); } description = replaceTags(description, packageDoc); packageDoc.setDescription(description); return description; }
packageDoc = new SimpleGroovyPackageDoc(packagePath); packageDoc.putAll(classDocs); rootDoc.put(packagePath, packageDoc); } catch (RecognitionException e) {
public String getRelativeRootPath() { StringTokenizer tokenizer = new StringTokenizer(name(), "" + FS); StringBuilder sb = new StringBuilder(); while (tokenizer.hasMoreTokens()) { tokenizer.nextToken(); sb.append("../"); } return sb.toString(); }
/* package private */ void processPackageInfo(String src, String filename, SimpleGroovyPackageDoc packageDoc) { String relPath = packageDoc.getRelativeRootPath(); String description = calcThenSetPackageDescription(src, filename, relPath); packageDoc.setDescription(description); // get same description but with paths relative to root String altDescription = calcThenSetPackageDescription(src, filename, ""); calcThenSetSummary(altDescription, packageDoc); }
private void calcThenSetSummary(String src, SimpleGroovyPackageDoc packageDoc) { packageDoc.setSummary(SimpleGroovyDoc.calculateFirstSentence(src)); }
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() + "]"); } }
public String nameWithDots() { return name().replace(FS, '.'); }
/* package private */ void processPackageInfo(String src, String filename, SimpleGroovyPackageDoc packageDoc) { String relPath = packageDoc.getRelativeRootPath(); String description = calcThenSetPackageDescription(src, filename, relPath); packageDoc.setDescription(description); // get same description but with paths relative to root String altDescription = calcThenSetPackageDescription(src, filename, ""); calcThenSetSummary(altDescription, packageDoc); }
private void calcThenSetSummary(String src, SimpleGroovyPackageDoc packageDoc) { packageDoc.setSummary(SimpleGroovyDoc.calculateFirstSentence(src)); }
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")) { processHtmlPackage(src, 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() + "]"); } }
public String nameWithDots() { return name().replace(FS, '.'); }
private void calcThenSetSummary(String src, SimpleGroovyPackageDoc packageDoc) { packageDoc.setSummary(SimpleGroovyDoc.calculateFirstSentence(src)); }