advertisement

XWiki Rendering: A content rendering engine

50 %
50 %
advertisement
Information about XWiki Rendering: A content rendering engine
Technology

Published on February 14, 2014

Author: xwiki

Source: slideshare.net

Description

These slides present http://rendering.xwiki.org/, a generic engine for transforming content in a given syntax (mediawiki, confluence, JSPWiki, Markdown, HTML, XWiki Syntax, etc) into an output format (PDF, HTML, XML, etc), applying optional transformations. This framework is generic and can be used outside of XWiki easily into your own Java applications.
advertisement

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:

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

FOSDEM 2014 - XWiki Rendering: A content rendering engine

XWiki Rendering: A content rendering engine; ... End: 14:25; Presents http://rendering.xwiki.org/ a generic engine for transforming content in a given ...
Read more

XWiki Rendering Framework (Main.WebHome) - XWiki

XWiki Rendering Framework. ... (useful for rendering large content) ... Uses both the XWiki Rendering and the XWiki WYSIWYG Editor to provide a simple wiki ...
Read more

XWiki Rendering: A content rendering engine - Technology

These slides present http://rendering.xwiki.org/, a generic engine for transforming content in a given syntax ... XWiki Rendering: A content rendering engine;
Read more

XWiki - The Advanced Open Source Enterprise and ...

Why use XWiki? Developed for more ... XWiki Rendering; XWiki Commons; Extensions. All extensions; Applications; Code Snippets; ... Translate content; Write ...
Read more

GitHub - xwiki/xwiki-rendering: The XWiki Rendering Engine

README.md XWiki Rendering. XWiki Rendering is a generic Rendering system that converts textual input in a given syntax (wiki syntax, HTML, etc) into ...
Read more

Grails Plugin: XWiki Rendering Plugin

mavenRepo "http://nexus.xwiki.org/nexus/content/groups/public/" ... The wiki rendering engine using XWiki Rendering Framework. Description. The full ...
Read more

XWiki Presentation Ideas (Drafts.PresentationIdeas) - XWiki

XWiki Presentation Ideas. XWiki Presentation Ideas. Last modified by Vincent Massol on 2015/01/15 15:21 ... XWiki Rendering: A content rendering engine;
Read more

XWiki Syntaxes (Main.XWikiSyntax) - XWiki

The XWiki Syntax 2.0 has proven to be ... we've also changed our underlying rendering engine in XWiki Enterprise ... Rendering Macro with a content ...
Read more