jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven Doxia
  • DOXIA-460

Converting XHTML to Confluence and Numeric Lists

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.1.4, 1.2
  • Fix Version/s: None
  • Component/s: Module - Confluence
  • Labels:
    None
  • Environment:
    All I believe. Tested on Windows and Mac OS.

Description

When generating XHTML from a Confluence markup containing a numeric list the following is true:

  1. FirstNumericListItem
  2. SecondNumericListItem

is turned into an ordered list:

<ol style="list-style-type: decimal"><li>FirstNumericListItem</li><li>SecondNumericListItem</li></ol>

This seems to work fine. If you try and generate Confluence from the generated XHTML the numeric list is translated to:

1. FirstNumericListItem
1. SecondNumericListItem

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.

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(); }
}
}

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Java Source File
    Example.java
    11/Jan/12 11:13 AM
    3 kB
    Anthony Milano

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
There are no comments yet on this issue.

People

  • Assignee:
    Unassigned
    Reporter:
    Anthony Milano
Vote (0)
Watch (1)

Dates

  • Created:
    11/Jan/12 11:13 AM
    Updated:
    11/Jan/12 11:13 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.