Auto-link any examples mentioned in the README
----------------------------------------------
Key: OPENEJB-1656
URL: https://issues.apache.org/jira/browse/OPENEJB-1656
Project: OpenEJB
Issue Type: Task
Reporter: David Blevins
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) {
return String.format("[%s](examples/%s)", token, 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
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira