[Jamwiki-devel] Custom Tag discussion
Brought to you by:
wrh2
From: <jam...@li...> - 2012-01-04 07:22:11
|
I see the Custom Tag initial implementation and realized that this is what I was looking for. However when I read more about current implementation I realized that IMHO it should work differently. So let discuss... First of all I don't thing that the name of the tag should be hardcoded in the Java. This may cause the name conflict if 2 different custom tag classes would use the same name. Instead the name should be configured in the jamwiki-configuration.xml file along side with Java class. This way the site administrator will be responsible for naming custom tags and can avoid conflict. Second. The parce(...) method converts Wiki text inside custom tag into Wiki text to replace that tag. This is obviously useful in some cases (like <gallery> tag), but limited. On one hand the replacement is done after template substitution, so the replacing Wiki text should be final and can not use any shortcuts (like templates). On another hand replacing Wiki text with HTML fragment is still subject for Wiki configuration and limitations in terms of supported HTML tags. I am not argue agains current parse(...) method, but suggesting to extend the interface with parse2HTML(...) method, which will insert HTML fragment directly into the final document. It should be called later in the parsing process and produced output should not be modified any more. This would allow to develop Custom Tag to convert Wiki text directly into HTML. For example nowadays more and more browsers support HTML5. I am planning to develop Custom Tag to include SVG images into the Wiki. The source text would follow basic JAMWiki syntax (more or less), but Java class behind Custom Tag will convert it into SVG (which is XML) and need to insert it into the page. Another application of this could be Custom Tag to convert ASCIIMath into MathML (which is also XML and part of HTML5). This would allow many different customizations without changing the core code. For example special Custom Tag can generate the HTML form for user to fill (I don't think this functionality is available now). What do you think? I don't know how much more difficult to implement this would be, but it will provide a huge flexibility for the whole system. Thanks CAB |