r1200 - in trunk/wikitty-publication/src: main/resources/filters-properties site/doc
Author: mfortun Date: 2011-08-29 23:31:02 +0200 (Mon, 29 Aug 2011) New Revision: 1200 Url: http://nuiton.org/repositories/revision/wikitty/1200 Log: correct/complete docs Modified: trunk/wikitty-publication/src/main/resources/filters-properties/README.txt trunk/wikitty-publication/src/site/doc/Rajouter_des_langages.rst Modified: trunk/wikitty-publication/src/main/resources/filters-properties/README.txt =================================================================== --- trunk/wikitty-publication/src/main/resources/filters-properties/README.txt 2011-08-29 15:44:02 UTC (rev 1199) +++ trunk/wikitty-publication/src/main/resources/filters-properties/README.txt 2011-08-29 21:31:02 UTC (rev 1200) @@ -1,12 +1,11 @@ - - - Those filters options are use to transform WikittyPubText content with a nuiton processor and filters. The goal of this is to include html (and after other langage design for ui inside web browser) with scripting mechanism. Instead of write the script and include inside result value html tag, do the opposite, that what allow those filters. +In this case use script langage inside tag like in a jsp: <% %> and <%= %> + Filters options doc: OpeningTemplate: the string openning the template @@ -34,14 +33,13 @@ </html> with template: -wpContext.setContentType("[ContentType]"); +wpContext.setContentType("[ContentType]")[EndingCar] -[OpeningTemplate]<html>[StringDelim]; -var name= bob; -[WriteString][OpeningWriterChar][StringDelim]<h1>Hello World [StringDelim][ConcatChar]name[ConcatChar]!</h1>[ConcatChar][StringDelim]; - -[WriteString][OpeningWriterChar][StringDelim]</html>[StringDelim]; - +[OpeningTemplate]<html>[StringDelim][ClosingWriterChar][EndingCar] +[WriteString][OpeningWriterChar][StringDelim]bob[StringDelim][ClosingWriterChar][EndingCar] +[WriteString][OpeningWriterChar][StringDelim]<h1>Hello World [StringDelim][ConcatChar]name[ConcatChar][StringDelim]!</h1>[StringDelim][ClosingWriterChar][EndingCar] +[WriteString][OpeningWriterChar][StringDelim]</html>[StringDelim][ClosingWriterChar][EndingCar][ClosingTemplate] + This filters will be enable when try to evaluate wikittyPubText with mime type: text/[Key], the mime type of the wikittyPubText after will be: [MimeType] @@ -60,3 +58,16 @@ This filters will be enable when try to evaluate wikittyPubText with mime type: text/html.javascript, the mime type of the wikittyPubText after will be: application/javascript +Template: + +OpeningTemplate= +WriteString= +StringDelim= +ConcatChar= +EndingCar= +ClosingWriterChar= +OpeningWriterChar= +ClosingTemplate= +MimeType= +Key= +ContentType= Modified: trunk/wikitty-publication/src/site/doc/Rajouter_des_langages.rst =================================================================== --- trunk/wikitty-publication/src/site/doc/Rajouter_des_langages.rst 2011-08-29 15:44:02 UTC (rev 1199) +++ trunk/wikitty-publication/src/site/doc/Rajouter_des_langages.rst 2011-08-29 21:31:02 UTC (rev 1200) @@ -1,12 +1,95 @@ -Fonctionnement des mime type +====================================================== +Comment rajouter des langages dans Wikitty Publication +====================================================== +:Authors: Manoël Fortun +Un nouveau langage +------------------ +Pour rajouter un nouveau langage il faut enregistrer dans le service ou dans +le classPath le jar contenant le script engine correspondant. Il faut s'assurer +que l'engine peut être récupéré avec un mimeType de forme : text/[langage], avec +langage qui est égale au langage de script. Puisque la forme text/[truc] correspond +qu wikitty pub text dans le mapping des mimeType. -Rajouter des langages +Comment marche le mapping mimeType <-> extension de fichier +----------------------------------------------------------- -Rajouter le mécanisme des mime type extension +Dans les ressources du module Wikitty Publication il y a un fichier de propriétés +nommé: "mimetype.properties" qui contient les mapping mimeType <-> extension. +Seulement ceux à l'intérieur sont considéré. +Pour en rajouter il suffit de rajouter des lignes. -Jouer avec la décoration +Les mimeTypes commençant par text/ seront considérés comme des wikittyPubText. +Les mimeTypes composé comme: +text/html.javascript=htmljs +Sont des mimeTypes liés au filtres: +Comment marche les filtres +-------------------------- + +Les filtres sont à utiliser en relation avec le mapping mime type - extension. +Ils permettent de définir des transformations du contenu d'un wikitty pub text. +Ceci est utilisé par exemple pour insérer du html dans le contenu des wikitty +pub text facilement, ou d'autre. + +Pour en rajouter il suffit de reprendre le template et de le remplir selon +ses besoins. + +Les Options de fitre: +********************* + + * OpeningTemplate: chaine d'ouverture du template + * WriteString: instruction d'écriture + * StringDelim: délimiteur de chaine exemple " + * ConcatChar: caractère de concaténation + * EndingCar: caractère de fin d'instruction + * ClosingWriterChar: chaine qui se place avant le caractère de fin et le délimiteur de chaine + * OpeningWriterChar: chaine qui se place juste après l'instruction d'écriture et avant le délimiteur de chaine + * ClosingTemplate: chaine de fermeture du template + * MimeType: mime type après application du template + * Key: clé du mime type, définition des langages utilisé langageAutourBalise.LangageEntreBalise si le mime type du wikitty pub fini par la clé, ce template sera appliqué. + * ContentType: content type qui sera mit pour le retour de la page + + +Un exemple de fonctionnement +**************************** + +Contenu d'un wikitty pub text: + + <html> + <%var name="bob"%> + <h1>Hello World <%=name%>!</h1> + </html> + +Règle de remplacement avec le template: + + wpContext.setContentType("[ContentType]")[EndingCar] + + [OpeningTemplate]<html>[StringDelim][ClosingWriterChar][EndingCar] + + [WriteString][OpeningWriterChar][StringDelim]bob[StringDelim][ClosingWriterChar][EndingCar] + + [WriteString][OpeningWriterChar][StringDelim]<h1>Hello World [StringDelim][ConcatChar]name[ConcatChar][StringDelim]!</h1>[StringDelim][ClosingWriterChar][EndingCar] + + [WriteString][OpeningWriterChar][StringDelim]</html>[StringDelim][ClosingWriterChar][EndingCar][ClosingTemplate] + +ce filtre sera actif quand on le mime type du wikittyPubText sera : +text/[Key], après transformation par le filtre le mimetype sera [MimeType] + +Si on avait utilisé le filtre de base: + + wpContext.setContentType("text/html; charset=UTF-8"); + + var wp_result="<html>"; + var name= bob; + wp_result+="<h1>Hello World "+name+"!</h1>"; + wp_result+="</html>"; + + +ce filtre sera actif quand on le mime type du wikittyPubText sera : +text/html.javascript, après transformation par le filtre le mimetype sera application/javascript + +
participants (1)
-
mfortun@users.nuiton.org