39 |
import java.util.Iterator; |
import java.util.Iterator; |
40 |
import java.util.List; |
import java.util.List; |
41 |
import java.util.Map; |
import java.util.Map; |
42 |
|
import java.util.Set; |
43 |
|
import java.util.HashSet; |
44 |
import java.util.StringTokenizer; |
import java.util.StringTokenizer; |
45 |
|
|
46 |
import gnu.classpath.tools.gjdoc.TemporaryStore; |
import gnu.classpath.tools.gjdoc.TemporaryStore; |
47 |
import gnu.classpath.tools.gjdoc.GjdocPackageDoc; |
import gnu.classpath.tools.gjdoc.GjdocPackageDoc; |
48 |
|
|
49 |
import gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTranslet; |
import gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTranslet; |
50 |
|
import gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTransletOptions; |
51 |
|
|
52 |
import gnu.classpath.tools.taglets.AuthorTaglet; |
import gnu.classpath.tools.taglets.AuthorTaglet; |
53 |
|
|
175 |
private File workingDirectory; |
private File workingDirectory; |
176 |
|
|
177 |
/** |
/** |
178 |
|
* Whether to deep-copy the doc-files subdirectory. |
179 |
|
*/ |
180 |
|
private boolean docFilesSubdirsEnabled = false; |
181 |
|
|
182 |
|
/** |
183 |
|
* Which direct subdirectories of the doc-files directories to exclude. |
184 |
|
* Set of String. |
185 |
|
*/ |
186 |
|
private Set excludeDocFilesSubDirs = new HashSet(); |
187 |
|
|
188 |
|
/** |
189 |
* Stores the Doclet API RootDoc we are operating on. |
* Stores the Doclet API RootDoc we are operating on. |
190 |
*/ |
*/ |
191 |
private RootDoc rootDoc; |
private RootDoc rootDoc; |
661 |
} |
} |
662 |
} |
} |
663 |
if (!tagsOfThisType.isEmpty()) { |
if (!tagsOfThisType.isEmpty()) { |
|
printOpenTag(0, "tagletText tagName=\"" + tagName + "\""); |
|
664 |
Tag[] tagletTags = (Tag[])tagsOfThisType.toArray(new Tag[tagsOfThisType.size()]); |
Tag[] tagletTags = (Tag[])tagsOfThisType.toArray(new Tag[tagsOfThisType.size()]); |
665 |
String tagletString = getTagletForName(tagName).toString(tagletTags); |
String tagletString = getTagletForName(tagName).toString(tagletTags); |
666 |
if (fixHTML) { |
if (null != tagletString) { |
667 |
print(htmlRepairer.getWellformedHTML(tagletString)); |
printOpenTag(0, "tagletText tagName=\"" + tagName + "\""); |
668 |
print(htmlRepairer.terminateText()); |
if (fixHTML) { |
669 |
} |
print(htmlRepairer.getWellformedHTML(tagletString)); |
670 |
else { |
print(htmlRepairer.terminateText()); |
671 |
print("<![CDATA["+cdata(tagletString)+"]]>"); |
} |
672 |
|
else { |
673 |
|
print("<![CDATA["+cdata(tagletString)+"]]>"); |
674 |
|
} |
675 |
|
printCloseTag(0, "tagletText", false); |
676 |
} |
} |
|
printCloseTag(0, "tagletText", false); |
|
677 |
} |
} |
678 |
} |
} |
679 |
} |
} |
694 |
|
|
695 |
boolean xmlOnly = false; |
boolean xmlOnly = false; |
696 |
|
|
697 |
|
AuthorTaglet.setTagletEnabled(false); |
698 |
|
|
699 |
|
DocTransletOptions docTransletOptions = new DocTransletOptions(); |
700 |
|
|
701 |
try { |
try { |
702 |
{ |
{ |
703 |
|
|
871 |
return false; |
return false; |
872 |
} |
} |
873 |
} |
} |
874 |
|
else if ("-author".equals(optionTag)) { |
875 |
|
AuthorTaglet.setTagletEnabled(true); |
876 |
|
} |
877 |
else if ("-authormail".equals(optionTag)) { |
else if ("-authormail".equals(optionTag)) { |
878 |
|
|
879 |
if ("no-replace".equalsIgnoreCase(option[1])) { |
if ("no-replace".equalsIgnoreCase(option[1])) { |
900 |
else if ("-mailmangleat".equals(optionTag)) { |
else if ("-mailmangleat".equals(optionTag)) { |
901 |
AuthorTaglet.setAtReplacement(option[1]); |
AuthorTaglet.setAtReplacement(option[1]); |
902 |
} |
} |
903 |
|
else if ("-docfilessubdirs".equals(optionTag)) { |
904 |
|
docFilesSubdirsEnabled = true; |
905 |
|
} |
906 |
|
else if ("-excludedocfilessubdir".equals(optionTag)) { |
907 |
|
StringTokenizer st = new StringTokenizer(option[1]); |
908 |
|
while (st.hasMoreTokens()) { |
909 |
|
excludeDocFilesSubDirs.add(st.nextToken()); |
910 |
|
} |
911 |
|
} |
912 |
|
else if ("-nonavbar".equals(optionTag)) { |
913 |
|
docTransletOptions.nonavbar = true; |
914 |
|
} |
915 |
|
else if ("-noindex".equals(optionTag)) { |
916 |
|
docTransletOptions.noindex = true; |
917 |
|
} |
918 |
|
else if ("-notree".equals(optionTag)) { |
919 |
|
docTransletOptions.notree = true; |
920 |
|
} |
921 |
|
else if ("-nocomment".equals(optionTag)) { |
922 |
|
docTransletOptions.nocomment = true; |
923 |
|
} |
924 |
} |
} |
925 |
|
|
926 |
// Use current directory if target directory hasn't been set. |
// Use current directory if target directory hasn't been set. |
1183 |
|
|
1184 |
// We have XSLT postprocessing, run DocTranslet. |
// We have XSLT postprocessing, run DocTranslet. |
1185 |
|
|
1186 |
DocTranslet docTranslet = DocTranslet.fromClasspath("/doctranslets/html/gjdoc.xsl"); |
//DocTranslet docTranslet = DocTranslet.fromClasspath("/doctranslets/html/gjdoc.xsl"); |
1187 |
|
|
1188 |
|
//docTranslet.setOptions(docTransletOptions); |
1189 |
|
|
1190 |
|
target.getDocTranslet().setOptions(docTransletOptions); |
1191 |
|
|
1192 |
target.getDocTranslet().apply(xmlTargetDirectory, |
target.getDocTranslet().apply(xmlTargetDirectory, |
1193 |
target.getTargetDirectory(), |
target.getTargetDirectory(), |
1378 |
else if ("-authormail".equals(option)) return 2; |
else if ("-authormail".equals(option)) return 2; |
1379 |
else if ("-mailmangledot".equals(option)) return 2; |
else if ("-mailmangledot".equals(option)) return 2; |
1380 |
else if ("-mailmangleat".equals(option)) return 2; |
else if ("-mailmangleat".equals(option)) return 2; |
1381 |
|
else if ("-noindex".equals(option)) return 1; |
1382 |
|
else if ("-nocomment".equals(option)) return 1; |
1383 |
|
else if ("-notree".equals(option)) return 1; |
1384 |
|
else if ("-nohelp".equals(option)) return 1; |
1385 |
|
else if ("-nonavbar".equals(option)) return 1; |
1386 |
|
|
1387 |
else return -1; |
else return -1; |
1388 |
} |
} |
1389 |
|
|
1525 |
packageDoc.name().replace('.', File.separatorChar)); |
packageDoc.name().replace('.', File.separatorChar)); |
1526 |
if (docFilesSourceDirectory.exists()) { |
if (docFilesSourceDirectory.exists()) { |
1527 |
printNotice("Copying files from " + docFilesSourceDirectory); |
printNotice("Copying files from " + docFilesSourceDirectory); |
1528 |
copyDirectory(docFilesSourceDirectory, docFilesTargetDirectory); |
copyDirectory(docFilesSourceDirectory, docFilesTargetDirectory, |
1529 |
|
docFilesSubdirsEnabled, |
1530 |
|
excludeDocFilesSubDirs); |
1531 |
} |
} |
1532 |
} |
} |
1533 |
|
|
1535 |
* Recursively copy the contents of the input directory to the |
* Recursively copy the contents of the input directory to the |
1536 |
* output directory. The output directory must exist. |
* output directory. The output directory must exist. |
1537 |
*/ |
*/ |
1538 |
private static void copyDirectory(File sourceDir, File targetDir) throws IOException { |
private static void copyDirectory(File sourceDir, File targetDir, |
1539 |
|
boolean recursive, |
1540 |
|
Set excludeDirs) throws IOException { |
1541 |
if (!targetDir.exists() && !targetDir.mkdirs()) { |
if (!targetDir.exists() && !targetDir.mkdirs()) { |
1542 |
throw new IOException("Cannot create directory " + targetDir); |
throw new IOException("Cannot create directory " + targetDir); |
1543 |
} |
} |
1545 |
File[] sourceFiles = sourceDir.listFiles(); |
File[] sourceFiles = sourceDir.listFiles(); |
1546 |
for (int i=0; i<sourceFiles.length; ++i) { |
for (int i=0; i<sourceFiles.length; ++i) { |
1547 |
if (sourceFiles[i].isDirectory()) { |
if (sourceFiles[i].isDirectory()) { |
1548 |
File targetSubDir = new File(targetDir, |
if (recursive && (null == excludeDirs |
1549 |
sourceFiles[i].getName()); |
|| !excludeDirs.contains(sourceFiles[i].getName()))) { |
1550 |
if (targetSubDir.exists() || targetSubDir.mkdir()) { |
File targetSubDir = new File(targetDir, |
1551 |
copyDirectory(sourceFiles[i], targetSubDir); |
sourceFiles[i].getName()); |
1552 |
} |
if (targetSubDir.exists() || targetSubDir.mkdir()) { |
1553 |
else { |
copyDirectory(sourceFiles[i], targetSubDir, recursive, null); |
1554 |
throw new IOException("Cannot create directory " + targetSubDir); |
} |
1555 |
|
else { |
1556 |
|
throw new IOException("Cannot create directory " + targetSubDir); |
1557 |
|
} |
1558 |
} |
} |
1559 |
} |
} |
1560 |
else { |
else { |