Add an option to specify the order of the packages.
This commit is contained in:
@@ -73,6 +73,10 @@ public class HelpOutput {
|
|||||||
.println("-tablescale <factor> Scale factor to specify width of tables. Default value is 0.9.");
|
.println("-tablescale <factor> Scale factor to specify width of tables. Default value is 0.9.");
|
||||||
System.err
|
System.err
|
||||||
.println("-createpdf Creates .pdf file from the .tex output file by using pdflatex tool.");
|
.println("-createpdf Creates .pdf file from the .tex output file by using pdflatex tool.");
|
||||||
|
System.err
|
||||||
|
.println("-packageorder <pkg1>,<pkg2>,...");
|
||||||
|
System.err
|
||||||
|
.println(" Use a specific package order.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ public class TeXDoclet extends Doclet {
|
|||||||
static String introFile = null;
|
static String introFile = null;
|
||||||
static double tableWidthScale = 0.9;
|
static double tableWidthScale = 0.9;
|
||||||
static boolean createPdf = false;
|
static boolean createPdf = false;
|
||||||
|
static String package_order = null;
|
||||||
static final String REPLACE_OUT = "_replace_data_";
|
static final String REPLACE_OUT = "_replace_data_";
|
||||||
static final String REPLACE_TITLE = "_replace_title_";
|
static final String REPLACE_TITLE = "_replace_title_";
|
||||||
static final String HTML_PDF_WRAPPER = "<!DOCTYPE html><html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\"><head>"
|
static final String HTML_PDF_WRAPPER = "<!DOCTYPE html><html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\"><head>"
|
||||||
@@ -386,6 +387,8 @@ public class TeXDoclet extends Doclet {
|
|||||||
return 2;
|
return 2;
|
||||||
} else if (option.equals("-createpdf")) {
|
} else if (option.equals("-createpdf")) {
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (option.equals("-packageorder")) {
|
||||||
|
return 2;
|
||||||
}
|
}
|
||||||
System.out.println("unknown TeXDoclet option " + option);
|
System.out.println("unknown TeXDoclet option " + option);
|
||||||
|
|
||||||
@@ -492,6 +495,8 @@ public class TeXDoclet extends Doclet {
|
|||||||
tableWidthScale = Double.parseDouble(args[i][1]);
|
tableWidthScale = Double.parseDouble(args[i][1]);
|
||||||
} else if (args[i][0].equals("-createpdf")) {
|
} else if (args[i][0].equals("-createpdf")) {
|
||||||
createPdf = true;
|
createPdf = true;
|
||||||
|
} else if (args[i][0].equals("-packageorder")) {
|
||||||
|
package_order = args[i][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sectionLevelMax != null
|
if (sectionLevelMax != null
|
||||||
@@ -568,6 +573,32 @@ public class TeXDoclet extends Doclet {
|
|||||||
ClassDoc[] cls = root.classes();
|
ClassDoc[] cls = root.classes();
|
||||||
|
|
||||||
PackageDoc[] specifiedPackages = root.specifiedPackages();
|
PackageDoc[] specifiedPackages = root.specifiedPackages();
|
||||||
|
|
||||||
|
// Sort the packages
|
||||||
|
if (package_order != null) {
|
||||||
|
String[] pkg = package_order.split(",");
|
||||||
|
for (int i = 0; i < pkg.length; i++) {
|
||||||
|
// Search for pkg[i] in the specifiedPackages
|
||||||
|
int j; boolean found = false;
|
||||||
|
for (j = i; j < specifiedPackages.length; j++) {
|
||||||
|
if (specifiedPackages[j].name().equals(pkg[i])) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
System.err.println("Package " + pkg + " not found, aborting.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (i != j) {
|
||||||
|
// specifiedPackages has to be reordered
|
||||||
|
PackageDoc swap = specifiedPackages[i];
|
||||||
|
specifiedPackages[i] = specifiedPackages[j];
|
||||||
|
specifiedPackages[j] = swap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("specifiedPackages : " + specifiedPackages.length);
|
System.out.println("specifiedPackages : " + specifiedPackages.length);
|
||||||
for (int i = 0; i < specifiedPackages.length; i++) {
|
for (int i = 0; i < specifiedPackages.length; i++) {
|
||||||
Package P = new Package(specifiedPackages[i].name(),
|
Package P = new Package(specifiedPackages[i].name(),
|
||||||
|
|||||||
Reference in New Issue
Block a user