Skip to content

Commit 832bd80

Browse files
committed
Added some comments to help understand the reference generation steps better
1 parent 1eda6a7 commit 832bd80

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

java_generate/ReferenceGenerator/src/ProcessingWeblet.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,44 @@ public class ProcessingWeblet extends Standard {
4141
private static String xmlDescriptionFlag = "-includeXMLTag";
4242
private static IndexWriter indexWriter;
4343

44-
public static boolean start(RootDoc root) {
44+
public static boolean start(RootDoc root)
45+
{
4546
setConfig(root.options());
4647
Shared.i().createBaseDirectories();
47-
48+
4849
indexWriter = new IndexWriter();
4950

50-
try {
51+
try
52+
{
53+
// write out everything in the .java files:
54+
// Classes, Methods, Fields ... see specific XxxWriters
55+
5156
System.out.println("\n===Writing .javadoc sourced reference.===");
52-
// write out everything in the .java files
57+
5358
writeContents(root);
5459

60+
// write out everything in the include directory:
61+
// see: /api_en/include
62+
5563
System.out.println("===Source code @webref files written.===");
5664

5765
if (!Shared.i().getIncludeDirectory().equals(""))
58-
{ // need to get something back from
59-
// this to create index
66+
{
6067
System.out.println("\n===Writing XML-sourced reference.===");
6168
XMLReferenceWriter.write( Shared.i().getIncludeDirectory(), indexWriter);
6269
System.out.println("===Include directory files written.===");
6370
}
71+
72+
// write out the index file
73+
6474
System.out.println("\n===Telling the index to write itself.===");
6575
indexWriter.write();
76+
6677
} catch (IOException e) {
6778
// TODO Auto-generated catch block
6879
e.printStackTrace();
6980
}
81+
7082
System.out.println("===All finished in the weblet.===");
7183
return true;
7284
}

java_generate/ReferenceGenerator/src/writers/BaseWriter.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,21 +365,30 @@ protected static String getXMLDescription(ProgramElementDoc doc) throws IOExcept
365365
}
366366
}
367367

368-
protected static String getXMLDescription(Document doc) {
368+
/**
369+
* Based upon Shared.addDescriptionTag().
370+
*
371+
* Hint: this loads and adds js_mode/description as well
372+
*/
373+
protected static String getXMLDescription(Document doc)
374+
{
369375
XPathFactory xpathFactory = XPathFactory.newInstance();
370376
XPath xpath = xpathFactory.newXPath();
371377

372378
String desc = "";
373379

374380
for( String component : Shared.i().getDescriptionSets() )
375381
{
376-
try{
382+
try
383+
{
377384
XPathExpression expr = xpath.compile(component);
378385
String result = (String) expr.evaluate(doc, XPathConstants.STRING);
379386
if ( !desc.equals("") )
380387
desc += "<br /><br />\n";
381388
desc += result;
382-
} catch ( XPathExpressionException e){
389+
}
390+
catch ( XPathExpressionException e)
391+
{
383392
System.out.println("Error getting description from xml with expression: //" + component);
384393
e.printStackTrace();
385394
}

0 commit comments

Comments
 (0)