Details
-
Task
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Anytime an example is mentioned, we should automatically turn it into a link to that example. So as an example, given this text:
"For complex asynchronous processing, JavaEE's answer is MessageDrivenBean. Have a look at the simple-mdb example"
We'd automatically turn "simple-mdb" into a link to that example page.
Should be just a matter of iterating over the example directory names and doing a find/replace in code on each README file. Side note on my experience doing this kind of find/replace, if you the keys that need replacing from longest to shortest and apply the longest first, you easily protect against bad replacements.
For example, we have "simple-mdb" and "simple-mdb-with-descriptor" examples. If you try the short one first, you get things like "see the simple-mdb-with-descriptor example" getting turned into "see the [simple-mdb](examples/simple-mdb.html)-with-descriptor example"
With swizzle-stream you could do something like:
StreamTokenHandler handler = new StringTokenHandler() {
public String handleToken(String token)
};
InputStream in = //.. the README.mdtext
in = new FixedTokenReplacementInputStream(in, "simple-mdb-with-descriptor", handler);
in = new FixedTokenReplacementInputStream(in, "simple-mdb", handler);
// hand the InputStream to the markdown processor