Skip to content

Commit 96db4f4

Browse files
committed
documentation cleanup, force pandoc to use ATX style headings
1 parent 0d5b742 commit 96db4f4

File tree

4 files changed

+79
-23
lines changed

4 files changed

+79
-23
lines changed

README.md

+54-21
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,80 @@
22

33
[![Maintainability](https://api.codeclimate.com/v1/badges/7fe3ef34e09ba8133424/maintainability)](https://codeclimate.com/github/Dahie/caramelize/maintainability)
44

5-
Caramelize is a compact and flexible wiki content migration tool. It is intended for easi transfer of content from legacy wikis. With caramelize you can create your own export configurations and migrate your data into a git-based [gollum](https://github.com/github/gollum) wiki retaining all your history and gaining the most flexible access to your wiki content.
5+
Caramelize is a compact and flexible wiki migration tool. It is intended for easy transfer of content from legacy wikis. With caramelize you can create your own export configurations and migrate your page revisions into a git repository of markdown files. This retains all your history and you gain the most flexible access to your wiki content available for use with git-based wikis like [gollum](https://github.com/github/gollum), [Otter Wiki](https://github.com/redimp/otterwiki), [Wiki.js](https://js.wiki/) or [Obsidian](https://obsidian.md/).
6+
7+
By default, it ships with configurations for [WikkaWiki](http://wikkawiki.org/) and [Redmine](http://www.redmine.org/).
68

7-
In the future more target wikis may be added. For the moment migration is supported for [WikkaWiki](http://wikkawiki.org/) and [Redmine](http://www.redmine.org/)-Wiki.
89

910
## Usage
1011

1112
### Installation
1213

13-
$ gem install caramelize
14+
```sh
15+
$ gem install caramelize
16+
```
1417

1518
Install the latest release of caramelize using RubyGems.
19+
Requires pandoc to be installed.
1620

1721
### Use
1822

19-
$ caramelize create
23+
```sh
24+
$ caramelize create
25+
```
2026

2127
Creates a template configuration file "caramel.rb". This includes documentation on how to use the preset Wiki-connectors and how to write addition customized connectors. More about this below.
2228

23-
$ caramelize run
29+
```sh
30+
$ caramelize run
31+
```
2432

2533
Will start the wiki migration based on the configuration file. These are either found in predefined paths (./caramel.rb, ./config.rb, …), or passed as argument, as below.
2634

27-
$ caramelize doctor
35+
```sh
36+
$ caramelize doctor
37+
```
2838

2939
Can be used to assess the quality of your wiki conversion. It'll help you see
3040
how many wiki links may be broken and how many pages were orphaned.
3141

32-
$ caramelize help
42+
```sh
43+
$ caramelize help
44+
```
3345

3446
Returns help information.
3547

36-
$ caramelize version
48+
```sh
49+
$ caramelize version
50+
```
3751

3852
Returns version and release information.
3953

4054
### Options
4155

42-
$ caramelize create --config my_caramel_configuration.rb
56+
```sh
57+
$ caramelize create --config my_caramel_configuration.rb
58+
```
4359

4460
Creates an example configuration by the given name.
4561

46-
$ caramelize run --config my_caramel_configuration.rb
62+
```sh
63+
$ caramelize run --config my_caramel_configuration.rb
64+
```
4765

4866
Executes the given configuration.
4967

50-
$ caramelize --verbose [command]
68+
```sh
69+
$ caramelize --verbose [command]
70+
```
5171

5272
Displays more verbose output to the command line.
5373

5474
## Content migration
5575

5676
### Wiki support
5777

58-
Caramelize comes with direct support for [WikkaWiki](http://wikkawiki.org/) and [Redmine](http://www.redmine.org/)-Wiki.
78+
Caramelize comes with direct support for [MediaWiki](https://www.mediawiki.org), [WikkaWiki](http://wikkawiki.org/) and [Redmine](http://www.redmine.org/)-Wiki.
5979
More custom wikis can be supported by creating a suitable configuration file.
6080

6181
The wiki is exported to markdown files in a git-repository. This can be directly used as source for [gollum](https://github.com/github/gollum) wiki, [Otter Wiki](https://github.com/redimp/otterwiki), or if you don't care about the history even [Obsidian](https://obsidian.md/).
@@ -76,7 +96,7 @@ Since wiki software may have special features, that are not common among other w
7696

7797
### Configuration recipes
7898

79-
The `caramel.rb` configuration contains the settings on how to import the data of the existing wiki and how to convert it into the format required by caramelize to export to gollum.
99+
The `lib/caramelize/caramel.rb` configuration contains the settings on how to import the data of the existing wiki and how to convert it into the format required by caramelize to export to gollum.
80100
You also find the predefined definitions for importing from WikkaWiki and Redmine and and example for a custom import.
81101

82102
Custom import allows you to import data from wikis that are not natively supported by caramelize. Defining your own wiki import requires a bit of knowledge on Ruby and MySQL as you setup the access to your wiki database and need to define how the data is to be transformed. Depending on the database model of the wiki this can be one simple call for all revisions in the database, or it can get more complicated with multiple mysql-calls as the database becomes more complex.
@@ -123,41 +143,54 @@ end
123143

124144
In the end the `wiki` instance needs the `titles` and `revisions` filled.
125145

126-
Some wikis don't have all necessary metadata saved in the revision. In this case additional database queries are necessary. **The configuration recipe is pure ruby code, that is included on execution. This gives you alot of freedom in writing your configuration, but also a lot of power to break things for yourself. Be advised.**
146+
Some wikis don't have all necessary metadata saved in the revision. In this case additional database queries are necessary. **The configuration recipe is pure ruby code, that is included on execution. This gives you a lot of freedom in writing your configuration, but also a lot of power to break things. Be advised.**
127147

128148
I'm happy to give support on your recipes and I'd also like to extend caramelize with more wiki modules, if you send in your configurations (minus database credentials of course).
129149

130150
### Building
131151

132152
This is how you can build caramelize, in case you'd like to develop it further. To get startered you'll need Bundler.
133153

134-
$ gem install bundler
154+
```sh
155+
$ gem install bundler
156+
```
135157

136158
Clone or fork this repository and start building.
137159

138-
$ git clone git@github.com:Dahie/caramelize.git
139-
$ gem build caramelize.gemspec
160+
```sh
161+
$ git clone git@github.com:Dahie/caramelize.git
162+
$ gem build caramelize.gemspec
163+
```
140164

141165
Now to build and package the gem do
142166

143-
$ rake build
167+
```sh
168+
$ rake build
169+
```
144170

145171
or
146172

147-
$ rake install
173+
```sh
174+
$ rake install
175+
```
148176

149177
to install the new gem right to your system.
150178

179+
Tests run with
180+
181+
```sh
182+
$ rspec
183+
```
184+
151185
## Contributing to caramelize
152186

153-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
187+
* Check out the latest main to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
154188
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
155189
* Fork the project
156190
* Start a feature/bugfix branch
157191
* Commit and push until you are happy with your contribution
158192
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
159193

160-
161194
## Copyright
162195

163196
Copyright (c) 2011-2024 Daniel Senff. See LICENSE.md for further details.

lib/caramelize/caramel.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# frozen_string_literal: true
22

3-
require 'caramelize/input_wiki/wikkawiki'
3+
require 'caramelize/input_wiki/media_wiki'
44
require 'caramelize/input_wiki/redmine_wiki'
5+
require 'caramelize/input_wiki/wikka_wiki'
56

67
## Example caramelize configuration file
78

@@ -53,6 +54,14 @@ def predefined_wiki
5354
# password: "root",
5455
# database: "wikka" }
5556
# return Caramelize::InputWiki::WikkaWiki.new(options)
57+
#
58+
# For connection to a MediaWiki-Database use this Connector
59+
# By default it converts to markdown
60+
# options = { host: "localhost",
61+
# username: "root",
62+
# password: "root",
63+
# database: "my_wiki" }
64+
# return Caramelize::InputWiki::MediaWiki.new(options)
5665

5766
# For connection to a Redmine-Database use this Connector
5867
# Additional options:

lib/caramelize/filters/mediawiki_to_markdown.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def initialize(source_body)
1111
end
1212

1313
def run
14-
::PandocRuby.convert(source_body.dup, from: :mediawiki, to: :markdown)
14+
::PandocRuby.convert(source_body.dup, { from: :mediawiki, to: :markdown }, '--markdown-headings=atx)
1515
end
1616
end
1717
end

samples/media_wiki.rb

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
# Connecting to the MediaWiki Docker setup at https://hub.docker.com/_/mediawiki/
4+
5+
def input_wiki
6+
options = {
7+
host: '0.0.0.0',
8+
username: 'wikiuser',
9+
password: 'example',
10+
database: 'my_wiki',
11+
port: 63_645
12+
}
13+
Caramelize::InputWiki::MediaWiki.new(options)
14+
end

0 commit comments

Comments
 (0)