SlideShare a Scribd company logo
1 of 11
Download to read offline
XWiki Rendering

Vincent Massol
XWiki Committer
CTO XWiki SAS
!

@vmassol
Vincent Massol, February 2014

27 au 29 mars 2013
What is XWiki Rendering?

•
•
•

A Java, open source (LGPL) library to convert an input in a given syntax
into an output in another syntax.	

Needs: Wikis, Commenting system on web sites, any place where you ask
user to enter content.	

Complex to implement properly!
Supported Syntaxes
Input Syntaxes

•
•
•
•
•
•
•
•
•
•
•

XWiki Syntax 1.0, 2.0, 2.1	

HTML 4.x/XHTML 1.0	

Plain text	

Docbook 4.x	

Confluence/Confluence XHTML	

Mediawiki	

JSPWiki	

TWiki	

Creole 1.0	

Markdown	

APT

Output Syntaxes

•
•
•
•
•

XWiki Syntax 2.0, 2.1	

HTML 4.x/XHTML 1.0	

Plain text	

Docbook 4.x	

APT

Future Syntaxes

•
•

PDF (prototype version using iText exists)	

Asciidoc (need events in Asciidoctor)
Library Initialization

// Initialize Rendering components and allow getting instances!
EmbeddableComponentManager componentManager = !
! new EmbeddableComponentManager();!
componentManager.initialize(this.getClass().getClassLoader());
Example 1: Convert to XHTML
Converter converter =!
! componentManager.getInstance(Converter.class);!
!

WikiPrinter printer = new DefaultWikiPrinter();!
converter.convert(new StringReader("This is **bold**”),!
! Syntax.XWIKI_2_1, Syntax.XHTML_1_0, printer);!
!

Assert.assertEquals("<p>This is <strong>bold</strong></p>", !
! printer.toString());
Example 2: Italicize links
Parser parser = componentManager.getInstance(Parser.class, !
! Syntax.XWIKI_2_1.toIdString());!
XDOM xdom = parser.parse(new StringReader("This a [[link>MyPage]]"));!
!
// Find all links and make them italic!
for (Block block : xdom.getBlocks(new ClassBlockMatcher(LinkBlock.class), !
! Block.Axes.DESCENDANT)) {!
! Block parentBlock = block.getParent();!
! Block newBlock = new FormatBlock(Collections.<Block>singletonList(block), !
! ! Format.ITALIC);!
! parentBlock.replaceChild(newBlock, block);!
}!

!
WikiPrinter printer = new DefaultWikiPrinter();!
BlockRenderer renderer = componentManager.getInstance(BlockRenderer.class, !
! Syntax.XWIKI_2_1.toIdString());!
renderer.render(xdom, printer);!

!
Assert.assertEquals("This a //[[link>MyPage]]//", printer.toString());
Example 3: Execute Macros
Parser parser = componentManager.getInstance(Parser.class, !
! Syntax.XWIKI_2_1.toIdString());!
XDOM xdom = parser.parse(new StringReader("{{id name="test"/}}"));!

!
Transformation transformation = componentManager.getInstance(Transformation.class, !
! "macro");!
TransformationContext txContext = new TransformationContext(xdom, parser.getSyntax());!
transformation.transform(xdom, txContext);!

!
WikiPrinter printer = new DefaultWikiPrinter();!
BlockRenderer renderer = componentManager.getInstance(BlockRenderer.class, !
! Syntax.XHTML_1_0.toIdString());!
renderer.render(xdom, printer);!

!
Assert.assertEquals("<div id="test"></div>", printer.toString());
Demo Time!
!

Build a live preview web site using
XWiki Rendering and AngularJS

27 au 29 mars 2013
Use it!

• Documentation on http://rendering.xwiki.org	

• WYSIWYG editor using XWiki Rendering also available	

• Use Maven for a simple start (recommended) or use the
•

Standalone JAR	

Contribute to add more Syntaxes, more Macros!
Q&A

Me
Vincent Massol

• Speaker Bio	

•

CTO XWiki SAS	


•
•

XWiki (community-driven open source project)	

Past: Maven, Apache Cargo, Apache Cactus, Pattern Testing	


•
•
•

LesCastCodeurs podcast	

Creator of OSSGTP open source group in Paris	

3 books: JUnit in Action, Maven: A Developer’s Notebook, BBWM	


• Your Projects	


• Other Credentials:

More Related Content

More from XWiki

More from XWiki (20)

L'intranet collaboratif Aelia : l'étude de cas
L'intranet collaboratif Aelia : l'étude de casL'intranet collaboratif Aelia : l'étude de cas
L'intranet collaboratif Aelia : l'étude de cas
 
An collaborative intranet: the Aelia case study
An collaborative intranet: the Aelia case studyAn collaborative intranet: the Aelia case study
An collaborative intranet: the Aelia case study
 
La base de connaissance de la FNAB
La base de connaissance de la FNABLa base de connaissance de la FNAB
La base de connaissance de la FNAB
 
Collaborative Watch: the AFP case study
Collaborative Watch: the AFP case studyCollaborative Watch: the AFP case study
Collaborative Watch: the AFP case study
 
Une solution de veille partagée et collaborative : le cas de l'AFP
Une solution de veille partagée et collaborative : le cas de l'AFPUne solution de veille partagée et collaborative : le cas de l'AFP
Une solution de veille partagée et collaborative : le cas de l'AFP
 
Créer ses applications métier : le cas DCNS
Créer ses applications métier : le cas DCNSCréer ses applications métier : le cas DCNS
Créer ses applications métier : le cas DCNS
 
La base de connaissances du CNFPT
La base de connaissances du CNFPTLa base de connaissances du CNFPT
La base de connaissances du CNFPT
 
Documentation of an application revamping program: the Capgemini case study
Documentation of an application revamping program: the Capgemini case studyDocumentation of an application revamping program: the Capgemini case study
Documentation of an application revamping program: the Capgemini case study
 
Documentation d'un programme de rénovation applicative : le cas Capgemini
Documentation d'un programme de rénovation applicative : le cas CapgeminiDocumentation d'un programme de rénovation applicative : le cas Capgemini
Documentation d'un programme de rénovation applicative : le cas Capgemini
 
Base de connaissance : le cas CAPHC
Base de connaissance : le cas CAPHCBase de connaissance : le cas CAPHC
Base de connaissance : le cas CAPHC
 
Knowledge Exchange Network: the CAPHC use case
Knowledge Exchange Network: the CAPHC use caseKnowledge Exchange Network: the CAPHC use case
Knowledge Exchange Network: the CAPHC use case
 
La plateforme IWA : retour d'expérience
La plateforme IWA : retour d'expérienceLa plateforme IWA : retour d'expérience
La plateforme IWA : retour d'expérience
 
How DCNS creates its own business applications
How DCNS creates its own business applicationsHow DCNS creates its own business applications
How DCNS creates its own business applications
 
Ressources pédagogiques en ligne
Ressources pédagogiques en ligneRessources pédagogiques en ligne
Ressources pédagogiques en ligne
 
L'intranet collaboratif Fidelia Assistance
L'intranet collaboratif Fidelia AssistanceL'intranet collaboratif Fidelia Assistance
L'intranet collaboratif Fidelia Assistance
 
Documentation produit : le cas Easyvista
Documentation produit : le cas EasyvistaDocumentation produit : le cas Easyvista
Documentation produit : le cas Easyvista
 
Documentation and Knowledge management: the EasyVista's use case
Documentation and Knowledge management: the EasyVista's use caseDocumentation and Knowledge management: the EasyVista's use case
Documentation and Knowledge management: the EasyVista's use case
 
Collaborative intranet: the Fidelia Assistance case study
Collaborative intranet: the Fidelia Assistance case studyCollaborative intranet: the Fidelia Assistance case study
Collaborative intranet: the Fidelia Assistance case study
 
L'intranet Numéricable / SFR
L'intranet Numéricable / SFRL'intranet Numéricable / SFR
L'intranet Numéricable / SFR
 
La mise en place d'un centre de ressources : le cas XWiki / FOPH
La mise en place d'un centre de ressources : le cas XWiki / FOPHLa mise en place d'un centre de ressources : le cas XWiki / FOPH
La mise en place d'un centre de ressources : le cas XWiki / FOPH
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

XWiki Rendering: A content rendering engine

  • 1. XWiki Rendering Vincent Massol XWiki Committer CTO XWiki SAS ! @vmassol Vincent Massol, February 2014 27 au 29 mars 2013
  • 2. What is XWiki Rendering? • • • A Java, open source (LGPL) library to convert an input in a given syntax into an output in another syntax. Needs: Wikis, Commenting system on web sites, any place where you ask user to enter content. Complex to implement properly!
  • 3. Supported Syntaxes Input Syntaxes • • • • • • • • • • • XWiki Syntax 1.0, 2.0, 2.1 HTML 4.x/XHTML 1.0 Plain text Docbook 4.x Confluence/Confluence XHTML Mediawiki JSPWiki TWiki Creole 1.0 Markdown APT Output Syntaxes • • • • • XWiki Syntax 2.0, 2.1 HTML 4.x/XHTML 1.0 Plain text Docbook 4.x APT Future Syntaxes • • PDF (prototype version using iText exists) Asciidoc (need events in Asciidoctor)
  • 4. Library Initialization // Initialize Rendering components and allow getting instances! EmbeddableComponentManager componentManager = ! ! new EmbeddableComponentManager();! componentManager.initialize(this.getClass().getClassLoader());
  • 5. Example 1: Convert to XHTML Converter converter =! ! componentManager.getInstance(Converter.class);! ! WikiPrinter printer = new DefaultWikiPrinter();! converter.convert(new StringReader("This is **bold**”),! ! Syntax.XWIKI_2_1, Syntax.XHTML_1_0, printer);! ! Assert.assertEquals("<p>This is <strong>bold</strong></p>", ! ! printer.toString());
  • 6. Example 2: Italicize links Parser parser = componentManager.getInstance(Parser.class, ! ! Syntax.XWIKI_2_1.toIdString());! XDOM xdom = parser.parse(new StringReader("This a [[link>MyPage]]"));! ! // Find all links and make them italic! for (Block block : xdom.getBlocks(new ClassBlockMatcher(LinkBlock.class), ! ! Block.Axes.DESCENDANT)) {! ! Block parentBlock = block.getParent();! ! Block newBlock = new FormatBlock(Collections.<Block>singletonList(block), ! ! ! Format.ITALIC);! ! parentBlock.replaceChild(newBlock, block);! }! ! WikiPrinter printer = new DefaultWikiPrinter();! BlockRenderer renderer = componentManager.getInstance(BlockRenderer.class, ! ! Syntax.XWIKI_2_1.toIdString());! renderer.render(xdom, printer);! ! Assert.assertEquals("This a //[[link>MyPage]]//", printer.toString());
  • 7. Example 3: Execute Macros Parser parser = componentManager.getInstance(Parser.class, ! ! Syntax.XWIKI_2_1.toIdString());! XDOM xdom = parser.parse(new StringReader("{{id name="test"/}}"));! ! Transformation transformation = componentManager.getInstance(Transformation.class, ! ! "macro");! TransformationContext txContext = new TransformationContext(xdom, parser.getSyntax());! transformation.transform(xdom, txContext);! ! WikiPrinter printer = new DefaultWikiPrinter();! BlockRenderer renderer = componentManager.getInstance(BlockRenderer.class, ! ! Syntax.XHTML_1_0.toIdString());! renderer.render(xdom, printer);! ! Assert.assertEquals("<div id="test"></div>", printer.toString());
  • 8. Demo Time! ! Build a live preview web site using XWiki Rendering and AngularJS 27 au 29 mars 2013
  • 9. Use it! • Documentation on http://rendering.xwiki.org • WYSIWYG editor using XWiki Rendering also available • Use Maven for a simple start (recommended) or use the • Standalone JAR Contribute to add more Syntaxes, more Macros!
  • 11. Vincent Massol • Speaker Bio • CTO XWiki SAS • • XWiki (community-driven open source project) Past: Maven, Apache Cargo, Apache Cactus, Pattern Testing • • • LesCastCodeurs podcast Creator of OSSGTP open source group in Paris 3 books: JUnit in Action, Maven: A Developer’s Notebook, BBWM • Your Projects • Other Credentials: