[
https://jira.codehaus.org/browse/DOXIA-460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Scholte closed DOXIA-460.
--------------------------------
Resolution: Fixed
Fix Version/s: 1.4
Assignee: Robert Scholte
Fixed in [r1462782|http://svn.apache.org/r1462782]
> Converting XHTML to Confluence and Numeric Lists
> ------------------------------------------------
>
> Key: DOXIA-460
> URL: https://jira.codehaus.org/browse/DOXIA-460
> Project: Maven Doxia
> Issue Type: Bug
> Components: Module - Confluence
> Affects Versions: 1.1.4, 1.2
> Environment: All I believe. Tested on Windows and Mac OS.
> Reporter: Anthony Milano
> Assignee: Robert Scholte
> Fix For: 1.4
>
> Attachments: Example.java
>
>
> When generating XHTML from a Confluence markup containing a numeric list the
> following is true:
> # FirstNumericListItem
> # SecondNumericListItem
> is turned into an ordered list:
> {code:xml}
> <ol style="list-style-type:
> decimal"><li>FirstNumericListItem</li><li>SecondNumericListItem</li></ol>
> {code}
> This seems to work fine. If you try and generate Confluence from the
> generated XHTML the numeric list is translated to:
> {noformat}
> 1. FirstNumericListItem
> 1. SecondNumericListItem
> {noformat}
> So basically you cannot round trip Confluence to XHTML and and back using
> numeric lists.
> Tried to attach the following test example though got an error.
> {code}
> package jsftest.testwebapp;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.FileReader;
> import org.apache.maven.doxia.Converter;
> import org.apache.maven.doxia.DefaultConverter;
> import org.apache.maven.doxia.wrapper.InputReaderWrapper;
> import org.apache.maven.doxia.wrapper.OutputStreamWrapper;
> /**
> *
> */
> public class Example {
> /**
> * The input Confluence file.
> */
> private static final String INPUT_FILE = "confluence.txt";
>
> /**
> * The output XHTML file.
> */
> private static final String XHTML_FILE = "output.xhtml";
>
> /**
> * If you run this example with an input file containing a numeric list:
> *
> * # item1
> * # item2
> *
> * You'll notice when you parse the XHTML back to confluence it is turned
> * into:
> *
> * 1. item1
> * 1. item2
> *
> * This is a numeric list wiki format for some markups though it doesn't
> * match what is supported from Confluence to XHTML. If you try this the
> * 1. itemX are not turned into a numeric list when generating XHTML.
> */
> public static void main(String[] args) {
> // A converter
> Converter converter = new DefaultConverter();
>
> try {
> // Global var.
> InputReaderWrapper input = null;
> OutputStreamWrapper output = null;
> FileReader reader = null;
> ByteArrayOutputStream outputStream = null;
> String results;
>
> // Read the Confluence file containing numeric lists and generate
> // an XHTML file.
> reader = new FileReader(new File(INPUT_FILE));
> input = InputReaderWrapper.valueOf(reader, "confluence",
> converter.getInputFormats());
> FileOutputStream fileOutput = new FileOutputStream(XHTML_FILE);
> output = OutputStreamWrapper.valueOf(fileOutput, "xhtml",
> "UTF-8", converter.getOutputFormats());
> converter.convert(input, output);
> fileOutput.close();
> // Try and convert the XHTML back to Confluence.
> reader = new FileReader(new File(XHTML_FILE));
> input = InputReaderWrapper.valueOf(reader, "xhtml",
> converter.getInputFormats());
> outputStream = new ByteArrayOutputStream();
> output = OutputStreamWrapper.valueOf(outputStream, "confluence",
> "UTF-8", converter.getOutputFormats());
> converter.convert(input, output);
> results = outputStream.toString();
>
> System.out.println("Converted xhtml back to wiki:");
> System.out.println(results);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira