several bugfixes
added tags deprecated, overrides DocSkin now only looks for handlers response, request, param, session
This commit is contained in:
parent
b8cf9b2e4c
commit
424b2f8021
4 changed files with 44 additions and 23 deletions
|
@ -41,7 +41,7 @@ public class DocProperties extends DocFileElement {
|
|||
}
|
||||
}
|
||||
|
||||
protected Properties getProperties () {
|
||||
public Properties getProperties () {
|
||||
return props;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,16 @@ public class DocPrototype extends DocDirElement {
|
|||
}
|
||||
}
|
||||
|
||||
public DocPrototype getParentPrototype () {
|
||||
return parentPrototype;
|
||||
}
|
||||
|
||||
|
||||
public DocProperties getTypeProperties () {
|
||||
return typeProperties;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* runs through the prototype directory and parses all helma files
|
||||
*/
|
||||
|
|
|
@ -52,8 +52,14 @@ public class DocSkin extends DocFileElement {
|
|||
if (j > i+2) {
|
||||
String str = (new String (source, i+2, j-i)).trim ();
|
||||
str = str.substring (0, str.indexOf(" "));
|
||||
if (!partBuffer.contains(str))
|
||||
if (str.indexOf(".")>-1 &&
|
||||
(str.startsWith ("param.")
|
||||
|| str.startsWith ("response.")
|
||||
|| str.startsWith("request.")
|
||||
|| str.startsWith ("session.")
|
||||
) && !partBuffer.contains(str)) {
|
||||
partBuffer.add (str);
|
||||
}
|
||||
start = j+2;
|
||||
}
|
||||
i = j+1;
|
||||
|
|
|
@ -7,13 +7,15 @@ public final class DocTag {
|
|||
// for public use we have less types than
|
||||
// internally. eg, we're combining "return" and "returns"
|
||||
// or "arg" and "param".
|
||||
// those that aren't combined, need to match the index of
|
||||
// the values here have to match the index of
|
||||
// the tags-array!
|
||||
public static final int PARAMETER = 0;
|
||||
public static final int RETURN = 2;
|
||||
public static final int AUTHOR = 4;
|
||||
public static final int VERSION = 5;
|
||||
public static final int SEE = 6;
|
||||
public static final int DEPRECATED = 7;
|
||||
public static final int OVERRIDES = 8;
|
||||
|
||||
public static final String[][] tags = {
|
||||
{"@arg","Argument"},
|
||||
|
@ -22,47 +24,50 @@ public final class DocTag {
|
|||
{"@returns","Returns"},
|
||||
{"@author","Author"},
|
||||
{"@version","Version"},
|
||||
{"@see","See also"}
|
||||
{"@see","See also"},
|
||||
{"@deprecated", "Deprecated"},
|
||||
{"@overrides", "Overrides"}
|
||||
};
|
||||
|
||||
private String name;
|
||||
// kind is for internal use, type is external
|
||||
// "kind" is for internal use, "type" is external
|
||||
private int kind;
|
||||
private String text;
|
||||
|
||||
public static boolean isTagStart (String rawLine) {
|
||||
rawLine = rawLine.trim ();
|
||||
for (int i=0; i<tags.length; i++) {
|
||||
if (rawLine.startsWith (tags[i][0])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
public static boolean isTagStart (String rawTag) {
|
||||
if (getTagNumber(rawTag) > -1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static DocTag parse (String rawTag) throws DocException {
|
||||
rawTag = rawTag.trim ();
|
||||
int kind = -1;
|
||||
for (int i=0; i<tags.length; i++) {
|
||||
if (rawTag.startsWith (tags[i][0])) {
|
||||
kind = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int kind = getTagNumber (rawTag);
|
||||
if (kind == -1)
|
||||
throw new DocException ("unsupported tag type: " + rawTag);
|
||||
String content = rawTag.substring (tags[kind][0].length ()).trim ();
|
||||
String content = rawTag.substring (tags[kind][0].length ()+1).trim ();
|
||||
if (kind == 0 || kind==1) {
|
||||
StringTokenizer tok = new StringTokenizer (content);
|
||||
String name = "";
|
||||
if (tok.hasMoreTokens ())
|
||||
name = tok.nextToken ();
|
||||
return new DocTag (kind, name, content.substring (name.length ()).trim ());
|
||||
return new DocTag (kind, name, content.substring (name.length ()+1).trim ());
|
||||
} else {
|
||||
return new DocTag (kind, "", content);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getTagNumber (String rawTag) {
|
||||
rawTag = rawTag.trim ().toLowerCase ();
|
||||
for (int i=0; i<tags.length; i++) {
|
||||
if (rawTag.startsWith (tags[i][0])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
private DocTag (int kind, String name, String text) {
|
||||
this.kind = kind;
|
||||
this.name = (name!=null) ? name : "";
|
||||
|
|
Loading…
Add table
Reference in a new issue