caramelize 0.4.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/README.md +3 -1
- data/Rakefile +2 -2
- data/bin/caramelize +12 -5
- data/caramelize.gemspec +2 -3
- data/lib/caramelize.rb +2 -1
- data/lib/caramelize/content_transferer.rb +31 -17
- data/lib/caramelize/filter_processor.rb +1 -2
- data/lib/caramelize/filters/remove_table_tab_line_endings.rb +6 -2
- data/lib/caramelize/filters/swap_wiki_links.rb +6 -2
- data/lib/caramelize/filters/wikka_to_markdown.rb +53 -25
- data/lib/caramelize/input_wiki/redmine_wiki.rb +55 -47
- data/lib/caramelize/input_wiki/wikkawiki.rb +15 -11
- data/lib/caramelize/output_wiki/gollum.rb +12 -7
- data/lib/caramelize/version.rb +1 -1
- data/spec/lib/caramelize/filter_processor_spec.rb +7 -5
- data/spec/lib/caramelize/filters/remove_table_tab_line_endings_spec.rb +30 -16
- data/spec/lib/caramelize/filters/swap_wiki_links_spec.rb +33 -17
- data/spec/lib/caramelize/filters/wikka_to_markdown_spec.rb +152 -54
- data/spec/lib/caramelize/output_wiki/gollum_spec.rb +3 -4
- metadata +8 -24
- data/lib/caramelize/ext.rb +0 -17
- data/lib/caramelize/filters/trac_to_markdown.rb +0 -42
- data/lib/caramelize/input_wiki/trac_converter.rb +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 794ae829880cb349361e52ec4ca6a313e08c228aee66816e1be297b55dcc21f5
|
4
|
+
data.tar.gz: a755af756c4a6b450166ecbb8ebd23b4dd24a9e840728ddb40d2b8e6e214f04b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a3b6071991c74dbc86218e7646a8cd09c90aba0e51708a7f698a0b38e3338f3ea95580822e316ddd3c7ad8ba28ee3ae8874bc3c6e3c65ca2838fd7943d44e43
|
7
|
+
data.tar.gz: 8f6de4f36f2aca5a6b08c230a02f0a56e51bfb3f0e3cf1b57e04d052ee3ecd963d09845c0416b27b89b99a3f8ffafbfe4b43e1c04ceb5b596575be7d01f9eecd
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at public@danielsenff.de. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
74
|
+
|
75
|
+
For answers to common questions about this code of conduct, see
|
76
|
+
https://www.contributor-covenant.org/faq
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Caramelize
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/dahie/caramelize.svg?branch=master)](https://travis-ci.org/dahie/caramelize) [![Maintainability](https://api.codeclimate.com/v1/badges/7fe3ef34e09ba8133424/maintainability)](https://codeclimate.com/github/Dahie/caramelize/maintainability)
|
2
4
|
|
3
5
|
Caramelize is a compact and flexible wiki content migration tool. It is intended for easily transfering content from otherwise rare supported 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.
|
4
6
|
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'bundler/gem_tasks'
|
|
4
4
|
# Default directory to look in is `/specs`
|
5
5
|
# Run with `rake spec`
|
6
6
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
7
|
-
task.rspec_opts = ['--color', '--format', '
|
7
|
+
task.rspec_opts = ['--color', '--format', 'documentation']
|
8
8
|
end
|
9
9
|
|
10
|
-
task :default => :spec
|
10
|
+
task :default => :spec
|
data/bin/caramelize
CHANGED
@@ -6,7 +6,7 @@ require 'commander/import'
|
|
6
6
|
# :name is optional, otherwise uses the basename of this executable
|
7
7
|
program :name, 'caramelize'
|
8
8
|
program :version, Caramelize::VERSION
|
9
|
-
program :description, '
|
9
|
+
program :description, 'With Caramelize you can migrate any wiki to git-based Gollum wiki repositories.'
|
10
10
|
program :help, 'Author', 'Daniel Senff <public@danielsenff.de>'
|
11
11
|
|
12
12
|
default_command :run
|
@@ -25,7 +25,7 @@ command :new do |c|
|
|
25
25
|
options.default({ config: 'caramel.rb' })
|
26
26
|
FileUtils.cp(File.dirname(__FILE__) + '/../lib/caramelize/caramel.rb',
|
27
27
|
options.config)
|
28
|
-
say "Created new configuration file: #{
|
28
|
+
say "Created new configuration file: #{options.config}"
|
29
29
|
end
|
30
30
|
end
|
31
31
|
alias_command :create, :new
|
@@ -39,12 +39,19 @@ command :run do |c|
|
|
39
39
|
c.example 'Run transfer for "config.rb"', 'caramelize run --config config.rb'
|
40
40
|
c.action do |args, options|
|
41
41
|
time_start = Time.now
|
42
|
-
options.default({ config: 'caramel.rb' })
|
43
|
-
puts options.inspect
|
42
|
+
options.default({ config: 'caramel.rb', target: 'wiki-export' })
|
44
43
|
|
45
44
|
instance_eval(File.read(options.config))
|
46
45
|
|
47
|
-
|
46
|
+
target = options.target
|
47
|
+
|
48
|
+
if File.exists?(target)
|
49
|
+
answer = agree("#{target} already exists. Overwrite with fresh repository?")
|
50
|
+
FileUtils.rm_rf(target) if answer
|
51
|
+
end
|
52
|
+
|
53
|
+
wiki_options = input_wiki.options.merge(verbose: options.verbose,
|
54
|
+
target: options.target)
|
48
55
|
Caramelize::ContentTransferer.new(input_wiki, wiki_options).execute
|
49
56
|
say "Time required: #{Time.now - time_start} s"
|
50
57
|
end
|
data/caramelize.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["mail@danielsenff.de"]
|
12
12
|
spec.homepage = "http://github.com/Dahie/caramelize"
|
13
13
|
spec.summary = %q{Flexible and modular wiki conversion tool}
|
14
|
-
spec.description = %q{
|
14
|
+
spec.description = %q{With Caramelize you can migrate any wiki to git-based Gollum wiki repositories.}
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
@@ -20,9 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency('mysql2')
|
22
22
|
spec.add_dependency('commander')
|
23
|
-
spec.add_dependency('docile')
|
24
23
|
spec.add_dependency('ruby-progressbar')
|
25
|
-
spec.add_dependency('gollum-lib'
|
24
|
+
spec.add_dependency('gollum-lib')
|
26
25
|
|
27
26
|
spec.add_development_dependency "bundler", "~> 1.6"
|
28
27
|
spec.add_development_dependency "rake"
|
data/lib/caramelize.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'caramelize/version'
|
2
2
|
require 'caramelize/page'
|
3
|
-
require 'caramelize/ext'
|
4
3
|
require 'caramelize/content_transferer'
|
5
4
|
require 'caramelize/filter_processor'
|
6
5
|
require 'caramelize/database_connector'
|
@@ -10,3 +9,5 @@ require 'caramelize/input_wiki/wiki'
|
|
10
9
|
require 'caramelize/input_wiki/redmine_wiki'
|
11
10
|
require 'caramelize/input_wiki/wikkawiki'
|
12
11
|
|
12
|
+
Encoding.default_external = Encoding::UTF_8
|
13
|
+
Encoding.default_internal = Encoding::UTF_8
|
@@ -1,11 +1,8 @@
|
|
1
|
-
require 'gollum-lib'
|
2
|
-
require 'grit'
|
3
1
|
require 'ruby-progressbar'
|
4
2
|
|
5
3
|
module Caramelize
|
6
4
|
|
7
5
|
require 'caramelize/page'
|
8
|
-
require 'caramelize/ext'
|
9
6
|
require 'caramelize/content_transferer'
|
10
7
|
require 'caramelize/database_connector'
|
11
8
|
require 'caramelize/output_wiki/gollum'
|
@@ -15,12 +12,13 @@ module Caramelize
|
|
15
12
|
class ContentTransferer
|
16
13
|
attr_reader :input_wiki, :options, :filter_processor
|
17
14
|
|
15
|
+
DEFAULT_GOLLUM_HOME_TITLE = 'Home'.freeze
|
16
|
+
|
18
17
|
def initialize(input_wiki, options)
|
19
18
|
@input_wiki = input_wiki
|
20
19
|
@options = options
|
21
20
|
|
22
21
|
options[:default_author] = options.fetch(:default_author, "Caramelize")
|
23
|
-
options[:target_directory] = './wiki-export'
|
24
22
|
options[:markup] = target_markup
|
25
23
|
end
|
26
24
|
|
@@ -39,6 +37,8 @@ module Caramelize
|
|
39
37
|
|
40
38
|
puts 'Create Namespace Overview' if verbose?
|
41
39
|
create_overview_page_of_namespaces if options[:create_namespace_overview]
|
40
|
+
|
41
|
+
rename_home_page
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
@@ -57,7 +57,7 @@ module Caramelize
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def output_wiki
|
60
|
-
@output_wiki ||= OutputWiki::Gollum.new(options[:
|
60
|
+
@output_wiki ||= OutputWiki::Gollum.new(options[:target])
|
61
61
|
end
|
62
62
|
|
63
63
|
def filter_processor
|
@@ -72,51 +72,65 @@ module Caramelize
|
|
72
72
|
revisions.count
|
73
73
|
end
|
74
74
|
|
75
|
+
def latest_revisions_count
|
76
|
+
input_wiki.latest_revisions.count
|
77
|
+
end
|
78
|
+
|
75
79
|
def create_overview_page_of_namespaces
|
76
80
|
output_wiki.commit_namespace_overview(input_wiki.namespaces)
|
77
81
|
end
|
78
82
|
|
79
|
-
def
|
80
|
-
|
81
|
-
|
83
|
+
def migrate_markup_progress_bar
|
84
|
+
@migrate_markup_progress_bar ||=
|
85
|
+
ProgressBar.create(title: "Markup filters",
|
86
|
+
total: latest_revisions_count)
|
87
|
+
end
|
82
88
|
|
89
|
+
def commit_history_progress_bar
|
90
|
+
@commit_history_progress_bar ||=
|
91
|
+
ProgressBar.create(title: "Revisions",
|
92
|
+
total: revisions_count)
|
93
|
+
end
|
94
|
+
|
95
|
+
def migrate_markup_of_latest_revisions
|
83
96
|
input_wiki.latest_revisions.each do |revision|
|
84
|
-
migrate_markup_of_revision(revision
|
97
|
+
migrate_markup_of_revision(revision)
|
85
98
|
end
|
86
99
|
end
|
87
100
|
|
88
101
|
def commit_history
|
89
|
-
puts revisions_count
|
90
|
-
progress_bar = ProgressBar.create(title: "Revisions",
|
91
|
-
total: revisions_count)
|
92
|
-
|
93
102
|
output_wiki.commit_history(revisions, options) do |page, index|
|
94
103
|
if verbose?
|
95
104
|
puts "(#{index + 1}/#{revisions_count}) #{page.time} #{page.title}"
|
96
105
|
else
|
97
|
-
|
106
|
+
commit_history_progress_bar.increment
|
98
107
|
end
|
99
108
|
end
|
100
109
|
end
|
101
110
|
|
102
|
-
def migrate_markup_of_revision(revision
|
111
|
+
def migrate_markup_of_revision(revision)
|
103
112
|
if verbose?
|
104
113
|
puts "Filter source: #{revision.title} #{revision.time}"
|
105
114
|
else
|
106
|
-
|
115
|
+
migrate_markup_progress_bar.increment
|
107
116
|
end
|
108
117
|
|
109
118
|
body_new = filter_processor.run(revision.body)
|
110
119
|
|
111
120
|
unless body_new == revision.body
|
112
121
|
revision.body = body_new
|
113
|
-
revision.author_name =
|
122
|
+
revision.author_name = 'Caramelize'
|
114
123
|
revision.time = Time.now
|
115
124
|
revision.author = nil
|
125
|
+
revision.message = "Markup of '#{revision.title}' converted to #{target_markup}"
|
116
126
|
|
117
127
|
# commit as latest page revision
|
118
128
|
output_wiki.commit_revision(revision, options[:markup])
|
119
129
|
end
|
120
130
|
end
|
131
|
+
|
132
|
+
def rename_home_page
|
133
|
+
output_wiki.rename_page(options[:home_page_title], DEFAULT_GOLLUM_HOME_TITLE)
|
134
|
+
end
|
121
135
|
end
|
122
136
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'gollum-lib'
|
2
|
-
require 'grit'
|
3
2
|
require 'ruby-progressbar'
|
4
3
|
|
5
4
|
module Caramelize
|
@@ -16,7 +15,7 @@ module Caramelize
|
|
16
15
|
def run(body)
|
17
16
|
body_new = body
|
18
17
|
filters.each do |filter|
|
19
|
-
body_new = filter.
|
18
|
+
body_new = filter.new(body_new).run
|
20
19
|
end
|
21
20
|
body_new
|
22
21
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
module Caramelize
|
2
2
|
class RemoveTableTabLineEndings
|
3
3
|
|
4
|
+
def initialize(body)
|
5
|
+
@body = body
|
6
|
+
end
|
7
|
+
|
4
8
|
# take an input stream and convert all wikka syntax to markdown syntax
|
5
|
-
def run
|
6
|
-
migrated_body = body.dup
|
9
|
+
def run
|
10
|
+
migrated_body = @body.dup
|
7
11
|
migrated_body.gsub!(/\|[\t ]*\r?[\n]/, "|\n")
|
8
12
|
migrated_body
|
9
13
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
module Caramelize
|
2
2
|
class SwapWikiLinks
|
3
3
|
|
4
|
+
def initialize(body)
|
5
|
+
@body = body
|
6
|
+
end
|
7
|
+
|
4
8
|
# take an input stream and convert all wikka syntax to markdown syntax
|
5
|
-
def run
|
6
|
-
migrated_body = body.dup
|
9
|
+
def run
|
10
|
+
migrated_body = @body.dup
|
7
11
|
|
8
12
|
migrated_body.gsub!(/\[\[(\S+)\|(.+?)\]\]/, '[[\2|\1]]')
|
9
13
|
migrated_body.gsub!(/\[\[([\w\s\.]*)\]\]/) do |s|
|
@@ -1,39 +1,67 @@
|
|
1
1
|
module Caramelize
|
2
2
|
class Wikka2Markdown
|
3
|
+
attr_reader :source_body
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
body.gsub!(/(======)(.*?)(======)/ ) {|s| '# ' + $2 } #h1
|
8
|
-
body.gsub!(/(=====)(.*?)(=====)/) {|s| '## ' + $2 } #h2
|
9
|
-
body.gsub!(/(====)(.*?)(====)/) {|s| '### ' + $2 } #h3
|
10
|
-
body.gsub!(/(===)(.*?)(===)/) {|s| '#### ' + $2 } #h4
|
11
|
-
|
12
|
-
body.gsub!(/(\*\*)(.*?)(\*\*)/) {|s| '**' + $2 + '**' } #bold
|
13
|
-
body.gsub!(/(\/\/)(.*?)(\/\/)/) {|s| '_' + $2 + '_' } #italic
|
14
|
-
#str.gsub!(/(===)(.*?)(===)/) {|s| '`' + $2 + '`'} #code
|
15
|
-
body.gsub!(/(__)(.*?)(__)/) {|s| '<u>' + $2 + '</u>'} #underline
|
16
|
-
body.gsub!(/(---)/, ' ') #forced linebreak
|
17
|
-
|
18
|
-
#body.gsub!(/(.*?)(\n\t-)(.*?)/) {|s| $1 + $3 } #list
|
19
|
-
|
20
|
-
body.gsub!(/(\t-)(.*)/, '*\2') # unordered list
|
21
|
-
body.gsub!(/(~-)(.*)/, '*\2') # unordered list
|
22
|
-
body.gsub!(/( -)(.*)/, '*\2') # unordered list
|
23
|
-
# TODO ordered lists
|
5
|
+
def initialize(source_body)
|
6
|
+
@source_body = source_body
|
7
|
+
end
|
24
8
|
|
9
|
+
def run
|
25
10
|
# TODO images: ({{image)(url\=?)?(.*)(}})
|
11
|
+
# markdown: ![Tux, the Linux mascot](/assets/images/tux.png)
|
12
|
+
|
13
|
+
replace_headlines
|
14
|
+
replace_formatting
|
15
|
+
replace_lists
|
16
|
+
replace_wiki_links
|
17
|
+
replace_links
|
18
|
+
replace_code_block
|
19
|
+
|
20
|
+
target_body
|
21
|
+
end
|
22
|
+
|
23
|
+
def replace_headlines
|
24
|
+
target_body.gsub!(/(======)(.*?)(======)/ ) {|s| '# ' + $2 } #h1
|
25
|
+
target_body.gsub!(/(=====)(.*?)(=====)/) {|s| '## ' + $2 } #h2
|
26
|
+
target_body.gsub!(/(====)(.*?)(====)/) {|s| '### ' + $2 } #h3
|
27
|
+
target_body.gsub!(/(===)(.*?)(===)/) {|s| '#### ' + $2 } #h4
|
28
|
+
target_body.gsub!(/(==)(.*?)(==)/) {|s| '##### ' + $2 } #h5
|
29
|
+
end
|
26
30
|
|
27
|
-
|
31
|
+
def replace_formatting
|
32
|
+
target_body.gsub!(/(\*\*)(.*?)(\*\*)/) {|s| '**' + $2 + '**' } #bold
|
33
|
+
target_body.gsub!(/(\/\/)(.*?)(\/\/)/, '*\2*') #italic
|
34
|
+
target_body.gsub!(/(__)(.*?)(__)/) {|s| '<u>' + $2 + '</u>'} #underline
|
35
|
+
target_body.gsub!(/(---)/, ' ') #forced linebreak
|
36
|
+
end
|
28
37
|
|
38
|
+
def replace_lists
|
39
|
+
target_body.gsub!(/(\t-\s?)(.*)/, '* \2') # unordered list
|
40
|
+
target_body.gsub!(/(~-\s?)(.*)/, '* \2') # unordered list
|
41
|
+
target_body.gsub!(/( -\s?)(.*)/, '* \2') # unordered list
|
29
42
|
|
30
|
-
|
31
|
-
#
|
43
|
+
target_body.gsub!(/(~1\)\s?)(.*)/, '1. \2') # unordered list
|
44
|
+
# TODO ordered lists
|
45
|
+
end
|
32
46
|
|
47
|
+
def replace_wiki_links
|
48
|
+
target_body.gsub!(/[\[]{2}(\w+)[\s|](.+?)[\]]{2}/, '[[\2|\1]]')
|
49
|
+
end
|
33
50
|
|
34
|
-
|
51
|
+
def replace_links
|
52
|
+
target_body.gsub!(/[\[]{2}((\w+):[\S][^\| ]*)[\| ](.*)[\]]{2}/,
|
53
|
+
'[\3](\1)')
|
54
|
+
target_body.gsub!(/[\[]{2}((\w+):.*)[\]]{2}/, '<\1>')
|
55
|
+
end
|
56
|
+
|
57
|
+
def replace_code_block
|
58
|
+
target_body.gsub!(/^%%\s(.*?)%%\s?/m) do
|
59
|
+
$1.gsub(/^/, ' ')
|
60
|
+
end
|
61
|
+
end
|
35
62
|
|
36
|
-
|
63
|
+
def target_body
|
64
|
+
@target_body ||= source_body.dup
|
37
65
|
end
|
38
66
|
end
|
39
67
|
end
|