Difference between revisions of "Software/Html2mediawiki"

From ThorstensHome
Jump to: navigation, search
Line 1: Line 1:
 +
= Overview =
 
html2mediawiki converts html syntax to mediawiki syntax.
 
html2mediawiki converts html syntax to mediawiki syntax.
  

Revision as of 10:32, 14 December 2008

Contents

Overview

html2mediawiki converts html syntax to mediawiki syntax.

For example, this html syntax:

<!-- this is an example html file for use with html2mediawiki -->
<html>
<body>
<h1>heading 1 </h1>
<ul>
<li>list item 1</li>
<li>list item 2 </li>
</ul>
<h2>heading 2 </h2>
whatever text
</body>
</html>

is converted to this mediawiki syntax:

= heading 1 =
* list item 1
* list item 2
== heading 2 ==
whatever text

Download

Download version 0.1

Install it

To install html2mediawiki,

  • Make sure you have the needed software packages installed, tidy, cmake and KDE4. With SUSE Linux, you can do it like this:
yast -i tidy cmake kdelibs4-devel
  • Download the tarball and unpack it:
wget http://www.linuxintro.org/staerk/files/html2mediawiki.tar.gz
tar xvzf html2mediawiki.tar.gz
  • And build it:
cd html2mediawiki/
cmake . && make && make install

Run it

You call html2mediawiki like this:

html2mediawiki example.htm > example.txt

This will transform the file example.htm to mediawiki format and store it in example.txt. Here is a screenshot from how I ran html2mediawiki:

tweedleburg:~/html2mediawiki # cat example.htm 
<!-- this is an example html file for use with html2mediawiki -->
<html>                                                           
<body>                                                           
<h1>heading 1 </h1>                                              
<ul>                                                             
<li>list item 1</li>                                             
<li>list item 2 </li>                                            
</ul>                                                            
<h2>heading 2 </h2>                                              
whatever text                                                    
</body>                                                          
</html>                                                          
tweedleburg:~/html2mediawiki # html2mediawiki example.htm > example.txt
html2mediawiki(1979) main: "file:///root/html2mediawiki/example.htm"   
html2mediawiki(1979) tidy: Entering function                           
html2mediawiki(1979) tidy: Tidying:   %s\n <!-- this is an example html file for use with html2mediawiki -->                                                                          
<html>                                                                                     
<body>                                                                                     
<h1>heading 1 </h1>                                                                        
<ul>                                                                                       
<li>list item 1</li>                                                                       
<li>list item 2 </li>                                                                      
</ul>                                                                                      
<h2>heading 2 </h2>                                                                        
whatever text                                                                              
</body>                                                                                    
</html>                                                                                    
html2mediawiki(1979) tidy: \nDiagnostics:\n\n%s 0x76e160
html2mediawiki(1979) tidy: allocating memory  492
html2mediawiki(1979) main: "html"
html2mediawiki(1979) main: "head"
html2mediawiki(1979) main: "h1"
html2mediawiki(1979) output: "body"
html2mediawiki(1979) output: "h1"
html2mediawiki(1979) output: "#text"
html2mediawiki(1979) output: "heading 1"
html2mediawiki(1979) output: ""
html2mediawiki(1979) output: "ul"
html2mediawiki(1979) output: "li"
html2mediawiki(1979) output: "#text"
html2mediawiki(1979) output: "list item 1"
html2mediawiki(1979) output: ""
html2mediawiki(1979) output: "li"
html2mediawiki(1979) output: "#text"
html2mediawiki(1979) output: "list item 2"
html2mediawiki(1979) output: ""
html2mediawiki(1979) output: ""
html2mediawiki(1979) output: "h2"
html2mediawiki(1979) output: "#text"
html2mediawiki(1979) output: "heading 2"
html2mediawiki(1979) output: ""
html2mediawiki(1979) output: "#text"
html2mediawiki(1979) output: "
whatever text
"
html2mediawiki(1979) output: ""
tweedleburg:~/html2mediawiki # cat example.txt

= heading 1 =
* list item 1
* list item 2
== heading 2 ==
whatever text

See also