Feature #3933

Add docbook export to wiki

Added by Ulrich Staudinger about 12 years ago. Updated about 8 years ago.

Status:NewStart date:2009-09-27
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Wiki
Target version:-
Resolution:

Description

Hi,
i'd love to export docbook straight from the wiki, then i could create a docbook ref file somewhere and include via url some selected wiki pages in my wiki.

Thanks !

History

#1 Updated by John Yani almost 11 years ago

Any news on this? Maybe plagin is available?

#2 Updated by Etienne Massip almost 10 years ago

  • Category set to Wiki

#3 Updated by Hans Artmann about 8 years ago

There is a gem redcloth-formatters-docbook which can do some basic conversion from textile to docbook.
Safe the TODO's which are easy enough to add conversion works quite nice.
So I thought I share this little program and maybe someone can integrate something in Redmine.

# Convert textile formatted files to docbook
#

require 'optparse'
require 'fileutils'
require 'rubygems'
require 'RedCloth'
require 'redcloth-formatters-docbook'

revision = "0.9 - 2012-08-29" 

# CHANGELOG
# 0.9   initial version

# Program options
@options = {}

optparse = OptionParser.new do|opts|
  # Set a banner, displayed at the top
  # of the help screen.
  opts.banner = "Usage: tex2doc.rb [optionen] datei ..." 

  # Define the options, and what they do
  opts.on( '-v', '--version', 'Print version' ) do
    puts "tex2doc " + revision
  end

  # This displays the help screen, all programs are
  # assumed to have this option.
  opts.on( '-h', '--help', 'This message' ) do
    puts opts
    exit
  end
end

# Parse the command-line. Remember there are two forms
# of the parse method. The 'parse' method simply parses
# ARGV, while the 'parse!' method parses ARGV and removes
# any options found there, as well as any parameters for
# the options. What's left is the list of files to resize.
optparse.parse!

puts "Tex2Doc Version #{revision}, Help: -h, --help" unless ARGV.size > 0

# TODO replace <pre> by <programlisting>
# TODO search empty table cells ||, fill with a single blank should do
# TODO escape <, >, &

ARGV.each do |file|
  textile = File.open(file, 'rb') { |f| f.read }
  docbook = RedCloth.new(textile).to_docbook
  File.open(file + '.xml', "w") { |f| f.write docbook }
end
</pre>

Also available in: Atom PDF