Starting with JAMWiki 1.2, the default JFlex parser can be configured to support extensions to the base wiki syntax. For example, sites that wish to allow Facebook "like" buttons can do so by enabling the <facebook /> tag.
| Contents |
|---|
There are several steps that must be taken to use parser extensions:
/resources/jamwiki-configuration.xml file in the JAMWiki file system directory to include the tag class name and (optionally) the tag name by updating the jflex-parser-custom-tag section as follows:
<jflex-parser-custom-tags>
<custom-tag>
<class>org.jamwiki.parser.jflex.addon.FacebookTag</class>
<key>facebook</key> <!-- key is optional, defaults if not specified -->
</custom-tag>
</jflex-parser-custom-tags>
tag_name is either the default tag name or the name configured in step #3.Many tags are implemented as extensions because they do have security concerns. For example, the iframe tag can be easily exploited by malicious users to implement a Cross-site scripting attack. In many cases such issues may not be a concern, for example when using the tag on an internal wiki, and in other cases security concerns can be mitigated by being vigilant about how the tags are used, or by implementing limitations on tag usage with tools such as the spam filter to prevent end users from utilizing the tag. See each tag description for a list of specific security issues to be aware of.
The facebook tag allows implementation of Facebook like / recommend buttons. See http://developers.facebook.com/docs/reference/plugins/like/ for additional details.
<facebook data-href="http://www.example.com" />
true or false, depending on whether to include a "Send" button. Defaults to false.true or false, depending on whether to include profile pictures. Defaults to false.
<jflex-parser-custom-tags>
<custom-tag>
<class>org.jamwiki.parser.jflex.addon.FacebookTag</class>
</custom-tag>
</jflex-parser-custom-tags>
By enabling this tag malicious users could implement "like" buttons that reference sites other than the current site. Administrators should monitor usage of this tag carefully.
The iframe tag allows use of HTML IFrames in wiki pages. The syntax is exactly the same as a normal HTML iframe tag.
<iframe src="http://www.example.com" id="iframe_id" scrolling="yes"></iframe>
<jflex-parser-custom-tags>
<custom-tag>
<class>org.jamwiki.parser.jflex.addon.IFrameTag</class>
</custom-tag>
</jflex-parser-custom-tags>
Enabling iframes allows malicious users to implement cross-site scripting attacks, whereby the iframe is used to load an external page that can be used to fool users into entering password or other sensitive information.
The twitter tag allows implementation of Twitter "tweet" buttons. See http://twitter.com/about/resources/buttons#tweet for additional details.
<twitter data-href="http://www.example.com" />
<jflex-parser-custom-tags>
<custom-tag>
<class>org.jamwiki.parser.jflex.addon.TwitterTag</class>
</custom-tag>
</jflex-parser-custom-tags>
By enabling this tag malicious users could implement "Tweet" buttons that reference sites other than the current site. Administrators should monitor usage of this tag carefully.
Author: shar
The source tag will automatically highlight programming language syntax.
<source lang="java">
void main(){
int i;
}
</source>
<jflex-parser-custom-tags>
<custom-tag>
<class>org.jamwiki.parser.jflex.addon.SourceTag</class>
</custom-tag>
</jflex-parser-custom-tags>
The following JAR files must be in the classpath for this code to work:
Source code can be found at Jhighlight or downloaded directly as jhighlight src.zip
None.