~akiban-technologies/akiban-persistit/3.2.9

« back to all changes in this revision

Viewing changes to doc/build/src/AsciiDocPrep.java

  • Committer: build-akiban
  • Date: 2013-03-24 13:02:17 UTC
  • mfrom: (426.1.2 release-notes-3.2.7)
  • Revision ID: build@akiban.com-20130324130217-2ig2t4rpm3rjsuvy
merge pbeaman: Release note and documentation upgrade.

https://code.launchpad.net/~pbeaman/akiban-persistit/release-notes-3.2.7/+merge/155117

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
    private final static Pattern PERSISTIT_PATTERN = Pattern
15
15
            .compile("(\\+)?(com\\.persistit(?:\\.[a-z]\\w?)*(?:\\.[A-Z]\\w*)+)(?:#(\\w+(?:[\\(\\)\\,a-zA-Z]*)))?(\\+)?");
16
16
 
17
 
    private final static String[] ARG_TEMPLATE = { "in|string:|Input file",
18
 
            "out|string:|Output file",
19
 
            "index|string:|Pathname of index-all.html file",
20
 
            "base|string:|Base of generated URLs", };
 
17
    private final static String[] ARG_TEMPLATE = { "in|string:|Input file", "out|string:|Output file",
 
18
            "index|string:|Pathname of index-all.html file", "base|string:|Base of generated URLs", };
21
19
 
22
20
    private AsciiDocIndex index;
23
21
    private boolean block;
26
24
    private String indexPath;
27
25
 
28
26
    private void prepare(final String[] args) throws Exception {
29
 
        ArgParser ap = new ArgParser("AsciiDocPrep", args, ARG_TEMPLATE);
 
27
        final ArgParser ap = new ArgParser("AsciiDocPrep", args, ARG_TEMPLATE);
30
28
        final String inPath = ap.getStringValue("in");
31
29
        final String outPath = ap.getStringValue("out");
32
30
 
33
 
        writer = outPath.isEmpty() ? new PrintWriter(System.out)
34
 
                : new PrintWriter(new FileWriter(outPath));
 
31
        writer = outPath.isEmpty() ? new PrintWriter(System.out) : new PrintWriter(new FileWriter(outPath));
35
32
 
36
33
        base = ap.getStringValue("base");
37
34
        if (base.isEmpty()) {
51
48
        writer.close();
52
49
    }
53
50
 
54
 
    public void processFile(final File file, final int level)
55
 
            throws Exception {
56
 
        BufferedReader reader = new BufferedReader(new FileReader(file));
 
51
    public void processFile(final File file, final int level) throws Exception {
 
52
        final BufferedReader reader = new BufferedReader(new FileReader(file));
57
53
        System.out.print("Processing file " + file);
58
54
        String line;
59
55
        while ((line = reader.readLine()) != null) {
89
85
    }
90
86
 
91
87
    private void processMatch(final Matcher matcher, final StringBuffer sb) {
92
 
        String className = matcher.group(2);
93
 
        String methodName = matcher.group(3);
 
88
        final String className = matcher.group(2);
 
89
        final String methodName = matcher.group(3);
94
90
 
95
 
        StringBuilder replacement = new StringBuilder("+link:");
 
91
        final StringBuilder replacement = new StringBuilder("+link:");
96
92
        if (methodName == null) {
97
93
            final String url = index.getClassMap().get(className);
98
94
            if (url == null || url.isEmpty()) {
100
96
            } else {
101
97
                replacement.append(url);
102
98
            }
103
 
            replacement.append('[' + className +"]+");
 
99
            replacement.append('[' + className + "]+");
104
100
        } else {
105
 
            String from = className + "#" + methodName.split("\\(")[0];
 
101
            final String from = className + "#" + methodName.split("\\(")[0];
106
102
            final SortedMap<String, String> map = index.getMethodMap().tailMap(from);
107
103
            if (map.isEmpty()) {
108
104
                replacement.append("<<<Missing method: " + methodName + ">>>");
120
116
                text = text.replace("java.lang.", "");
121
117
                text = text.replace("java.util.", "");
122
118
                replacement.append(url);
123
 
                replacement.append('[' + text +"]+");
 
119
                replacement.append('[' + text + "]+");
124
120
            }
125
121
        }
126
122