Difference between revisions of "Software/Html2mediawiki"

From ThorstensHome
Jump to: navigation, search
(Ubuntu)
(Download)
 
(11 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
{{DISPLAYTITLE:Html2mediawiki}}
 
= Overview =
 
= Overview =
 
html2mediawiki converts html syntax to mediawiki syntax.
 
html2mediawiki converts html syntax to mediawiki syntax.
Line 25: Line 26:
  
 
= Download =
 
= Download =
[http://www.linuxintro.org/staerk/files/html2mediawiki.tar.gz Download version 0.1]
+
* [http://www.linuxintro.org/staerk/files/html2mediawiki.tar.gz Download version 0.2 - sourcecode]
 +
To download the latest development source code, open a Linux terminal and issue:
 +
svn co svn://linuxintro.org/html2mediawiki
  
 
= Install it =
 
= Install it =
 
To install html2mediawiki,
 
To install html2mediawiki,
 +
 +
== SUSE ==
 
* Make sure you have the needed software packages installed, ''tidy'', ''cmake'' and ''KDE4''. With SUSE Linux, you can do it like this:
 
* 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
 
  yast -i tidy cmake kdelibs4-devel
Line 37: Line 42:
 
  cd html2mediawiki/
 
  cd html2mediawiki/
 
  cmake . && make && make install
 
  cmake . && make && make install
 +
 +
== Ubuntu ==
 +
Clever as I am ;) I have used a virtual machine and installed Ubuntu and tested html2mediawiki there. Here is how you install on Ubuntu:
 +
* Get the latest cmake
 +
cd
 +
wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
 +
tar xvzf cmake-2.6.2.tar.gz
 +
cd cmake-2.6.2
 +
./bootstrap
 +
make && sudo make install
 +
* install tidy
 +
sudo apt-get install tidy
 +
sudo apt-get install libtidy-dev
 +
* install the KDE 4 development libs
 +
sudo apt-get install kdelibs5-dev
 +
yes, really, to install KDE 4, you need to install kdelibs5. This is an Ubuntu feature.
 +
* get the html2mediawiki source
 +
cd
 +
wget http://www.linuxintro.org/staerk/files/html2mediawiki.tar.gz
 +
tar xvzf html2mediawiki.tar.gz
 +
* build and install it
 +
cd html2mediawiki
 +
cmake . && make && sudo make install
 +
* test it like in this screenshot
 +
tstaerk@tstaerk-desktop:~/html2mediawiki$  ./html2mediawiki example.htm 2>/dev/null
 +
 +
= heading 1 =
 +
* list item 1
 +
* list item 2
 +
== heading 2 ==
 +
whatever text
  
 
= Run it =
 
= Run it =
 +
 +
== Prerequisites ==
 +
You must have your html files UTF-8 encoded. For info how to do this, read http://www.linuxintro.org/wiki/Unicode.
 +
 +
== Call it ==
 
You call html2mediawiki like this:
 
You call html2mediawiki like this:
 
  html2mediawiki ''example.htm'' > ''example.txt''
 
  html2mediawiki ''example.htm'' > ''example.txt''
Line 109: Line 150:
 
whatever text
 
whatever text
 
</pre>
 
</pre>
 
= Ubuntu =
 
Clever as I am ;) I have used a virtual machine and installed Ubuntu and tested html2mediawiki there. Here is how you install on Ubuntu:
 
* Get the latest cmake
 
cd
 
wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
 
tar xvzf cmake-2.6.2.tar.gz
 
cd cmake-2.6.2
 
./bootstrap
 
make && sudo make install
 
* install tidy
 
sudo apt-get install tidy
 
sudo apt-get install libtidy-dev
 
* install the KDE 4 development libs
 
sudo apt-get install kdelibs5-dev
 
yes, really, to install KDE 4, you need to install kdelibs5. This is an Ubuntu feature.
 
* correct the placement of tidy
 
sudo cp /usr/include/tidy/*.h /usr/include
 
* get the html2mediawiki source
 
cd
 
wget http://www.linuxintro.org/staerk/files/html2mediawiki.tar.gz
 
tar xvzf html2mediawiki.tar.gz
 
* build and install it
 
cd html2mediawiki
 
cmake . && make && sudo make install
 
* test it like in this screenshot
 
tstaerk@tstaerk-desktop:~/html2mediawiki$  ./html2mediawiki example.htm 2>/dev/null
 
 
= heading 1 =
 
* list item 1
 
* list item 2
 
== heading 2 ==
 
whatever text
 
  
 
= Thanks to =
 
= Thanks to =

Latest revision as of 20:23, 17 May 2009

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

To download the latest development source code, open a Linux terminal and issue:

svn co svn://linuxintro.org/html2mediawiki

Install it

To install html2mediawiki,

SUSE

  • 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

Ubuntu

Clever as I am ;) I have used a virtual machine and installed Ubuntu and tested html2mediawiki there. Here is how you install on Ubuntu:

  • Get the latest cmake
cd
wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
tar xvzf cmake-2.6.2.tar.gz
cd cmake-2.6.2
./bootstrap
make && sudo make install
  • install tidy
sudo apt-get install tidy
sudo apt-get install libtidy-dev
  • install the KDE 4 development libs
sudo apt-get install kdelibs5-dev

yes, really, to install KDE 4, you need to install kdelibs5. This is an Ubuntu feature.

  • get the html2mediawiki source
cd
wget http://www.linuxintro.org/staerk/files/html2mediawiki.tar.gz
tar xvzf html2mediawiki.tar.gz
  • build and install it
cd html2mediawiki
cmake . && make && sudo make install
  • test it like in this screenshot
tstaerk@tstaerk-desktop:~/html2mediawiki$  ./html2mediawiki example.htm 2>/dev/null 

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

Run it

Prerequisites

You must have your html files UTF-8 encoded. For info how to do this, read http://www.linuxintro.org/wiki/Unicode.

Call 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

Thanks to

The two users I know of, Anne and Erik :)

See also