[Laszlo-checkins] r10079 - in openlaszlo/trunk: WEB-INF/lps/server/src/org/openlaszlo/js2doc docs/src/reference
dda@openlaszlo.org
dda at openlaszlo.org
Fri Jun 27 14:13:24 PDT 2008
Author: dda
Date: 2008-06-27 14:13:17 -0700 (Fri, 27 Jun 2008)
New Revision: 10079
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/Main.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/ReprocessComments.java
openlaszlo/trunk/docs/src/reference/langref.xml
Log:
Change 20080627-dda-7 by dda at lester.local on 2008-06-27 16:09:59 EDT
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-doc
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Resolve references to as2/as3/js1 in doc to their aliases.
New Features:
Bugs Fixed: LPP-6101 (Remove "as2" terminology and replace with swf7/8/9)
Technical Reviewer: ptw (pending)
QA Reviewer: (pending)
Doc Reviewer: liorio (pending)
Documentation:
Release Notes:
Details:
When a method/class is marked as2, as3, or js1, we need to map those
to the known aliases (swf8, swf9, dhtml).
This is an expedient fix that covers our current basic situations.
Left a TODO in the code to resolve the issue in a better way.
The current fix relies on textual substitutions after the
string runtimes is generated rather than being involved with
generation of the runtimes string. I went with this approach
for now since it seems safer - we are only modifying text,
not potential output file names.
Removed swf7 from the list of runtimes.
Changed some 'hand-generated' js2doc entries to remove as2 from
the output, again avoiding and filename changes.
Tests:
Added a testTranslateRuntime() function,
and enabled it temporarily (not in this change set) to test.
Rebuilt doc and grepped for as2.
Compared list of generated files in docs/reference
before and after this fix to make sure that no filenames had been changed.
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/Main.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/Main.java 2008-06-27 21:12:49 UTC (rev 10078)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/Main.java 2008-06-27 21:13:17 UTC (rev 10079)
@@ -55,14 +55,21 @@
js2doc(args, null, null, null);
}
- static final String[] runtimeOptionStrings = { "swf7", "swf8", "swf9", "dhtml" };
+ static final String[] runtimeOptionStrings = { "swf8", "swf9", "dhtml" };
static final Set runtimeOptions = new HashSet(Arrays.asList(runtimeOptionStrings));
// first element is the alias, subsequent elements are valid runtimes
// e.g. js1 === dhtml
- static final String[][] runtimeAliasStrings = { { "as2", "swf7", "swf8", "swf9" },
+ static final String[][] runtimeAliasStrings = { { "as2", "swf8" },
{ "as3", "swf9" },
{ "js1", "dhtml" } };
- static final List runtimeAliases = Arrays.asList(runtimeAliasStrings);
+ static final List runtimeAliases = Arrays.asList(runtimeAliasStrings);
+
+ static {
+ // TODO [dda 2008/06/26] redo these ugly static dependencies
+ ReprocessComments.setOptions(runtimeOptions, runtimeAliases);
+ //ReprocessComments.testTranslateRuntime();
+ }
+
static final String[] buildOptionStrings = { "debug", "profile" };
static final List buildOptions = Arrays.asList(buildOptionStrings);
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/ReprocessComments.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/ReprocessComments.java 2008-06-27 21:12:49 UTC (rev 10078)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/ReprocessComments.java 2008-06-27 21:13:17 UTC (rev 10079)
@@ -20,6 +20,9 @@
static private Logger logger = Logger.getLogger("org.openlaszlo.js2doc");
+ static private Set runtimeOptions = null;
+ static private List runtimeAliases = null;
+
static void appendToAttribute(org.w3c.dom.Element node, String attr, String value)
{
String oldvalue = node.getAttribute(attr);
@@ -29,6 +32,53 @@
node.setAttribute(attr, oldvalue + " " + value.trim());
}
+ // TODO [dda 6/27/08] this is a minimal implementation,
+ // it does not handle odd cases like "as2 swf8".
+ // It really should just be integrated into describeConditionalState().
+ //
+ static private String translateRuntime(String runtime) {
+ boolean except = runtime.startsWith("except ");
+ if (except) {
+ runtime = runtime.substring("except ".length());
+ }
+ String newruntime = "";
+
+ StringTokenizer tokenizer = new StringTokenizer(runtime);
+ while (tokenizer.hasMoreTokens()) {
+ String rt = tokenizer.nextToken();
+
+ for (Iterator iter = runtimeAliases.iterator(); iter.hasNext(); ) {
+ String[] aliases = (String[])iter.next();
+ if (aliases[0].equals(rt)) {
+ rt = "";
+ for (int i=1; i<aliases.length; i++) {
+ if (rt.length() > 0) {
+ rt += " ";
+ }
+ rt += aliases[i];
+ }
+ break;
+ }
+ }
+ if (newruntime.length() > 0) {
+ newruntime += " ";
+ }
+ newruntime += rt;
+ }
+ return ((except ? "except " : "") + newruntime);
+ }
+
+ static public void testTranslateRuntime() {
+ String[] testStrings = { "swf8", "js1", "foo", "except swf8",
+ "as2", "except as2",
+ "swf8 js1 dhtml", "except swf8 js1 dhtml" };
+
+ for (int i=0; i<testStrings.length; i++) {
+ String s = testStrings[i];
+ System.out.println("Test runtime translate: [" + s + "] => [" + translateRuntime(s) + "]");
+ }
+ }
+
static private abstract class CommentFieldFilter {
CommentFieldFilter nextFilter;
@@ -115,7 +165,7 @@
logger.warning("Invalid @access keyword: '" + keyword + "'");
}
} else if (fieldName.equals("runtimes")) {
- node.setAttribute("runtimes", fieldValue);
+ node.setAttribute("runtimes", translateRuntime(fieldValue));
return true;
}
return false;
@@ -525,6 +575,11 @@
}
}
+ static public void setOptions(Set runtimeOptionsArg, List runtimeAliasesArg) {
+ runtimeOptions = runtimeOptionsArg;
+ runtimeAliases = runtimeAliasesArg;
+ }
+
static public Document reprocess(String contents) {
org.w3c.dom.Document doc = null;
Modified: openlaszlo/trunk/docs/src/reference/langref.xml
===================================================================
--- openlaszlo/trunk/docs/src/reference/langref.xml 2008-06-27 21:12:49 UTC (rev 10078)
+++ openlaszlo/trunk/docs/src/reference/langref.xml 2008-06-27 21:13:17 UTC (rev 10079)
@@ -351,7 +351,7 @@
</class>
</property>
-<property id="tag.splash+as2" topic="LZX" subtopic="Basics" access="public" runtimes="as2">
+<property id="tag.splash+as2" topic="LZX" subtopic="Basics" access="public" runtimes="swf8">
<doc>
<tag name="shortdesc"><text>Controls the presentation while the application is loading.</text></tag>
<tag name="lzxname"><text>splash</text></tag>
@@ -439,7 +439,7 @@
</class>
</property>
-<property id="tag.splash-view" topic="LZX" subtopic="Basics" access="public" runtimes="as2">
+<property id="tag.splash-view" topic="LZX" subtopic="Basics" access="public" runtimes="swf8">
<doc>
<tag name="shortdesc"><text>A view element within the splash element positions a resource on the canvas while the application is loading.</text></tag>
<tag name="lzxname"><text>splash view</text></tag>
More information about the Laszlo-checkins
mailing list