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

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 casXWiki
 
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 studyXWiki
 
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 FNABXWiki
 
Collaborative Watch: the AFP case study
Collaborative Watch: the AFP case studyCollaborative Watch: the AFP case study
Collaborative Watch: the AFP case studyXWiki
 
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'AFPXWiki
 
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 DCNSXWiki
 
La base de connaissances du CNFPT
La base de connaissances du CNFPTLa base de connaissances du CNFPT
La base de connaissances du CNFPTXWiki
 
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 studyXWiki
 
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 CapgeminiXWiki
 
Base de connaissance : le cas CAPHC
Base de connaissance : le cas CAPHCBase de connaissance : le cas CAPHC
Base de connaissance : le cas CAPHCXWiki
 
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 caseXWiki
 
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érienceXWiki
 
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 applicationsXWiki
 
Ressources pédagogiques en ligne
Ressources pédagogiques en ligneRessources pédagogiques en ligne
Ressources pédagogiques en ligneXWiki
 
L'intranet collaboratif Fidelia Assistance
L'intranet collaboratif Fidelia AssistanceL'intranet collaboratif Fidelia Assistance
L'intranet collaboratif Fidelia AssistanceXWiki
 
Documentation produit : le cas Easyvista
Documentation produit : le cas EasyvistaDocumentation produit : le cas Easyvista
Documentation produit : le cas EasyvistaXWiki
 
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 caseXWiki
 
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 studyXWiki
 
L'intranet Numéricable / SFR
L'intranet Numéricable / SFRL'intranet Numéricable / SFR
L'intranet Numéricable / SFRXWiki
 
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 / FOPHXWiki
 

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

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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...Drew Madelung
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Recently uploaded (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

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: