ravicious-clothmark 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/bin/clothmark +7 -10
- data/clothmark.gemspec +1 -1
- data/lib/clothmark.rb +7 -7
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -37,7 +37,7 @@ Wanna see help? No problem.
|
|
37
37
|
-ah, --additional-html Specify, do additional HTML and CSS will be used (default - false)
|
38
38
|
-m, --markup LANG Specify markup language (markdown, textile or bbcode, default is markdown)
|
39
39
|
|
40
|
-
|
40
|
+
As you see, there are four arguments:
|
41
41
|
* -i or --input which specifies input file. If it isn't typed, then first argument will be used as an input file. This argument is required.
|
42
42
|
* -o or --output which specifies output file. You don't have to specify it, because ClothMark generates filename for output file automatically.
|
43
43
|
* -m or --markup which specifies markup language. If you don't specify it, then Markdown will be used as a choosed language.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
data/bin/clothmark
CHANGED
@@ -12,9 +12,9 @@ optparse = OptionParser.new do |opts|
|
|
12
12
|
exit
|
13
13
|
end
|
14
14
|
|
15
|
-
# If input
|
15
|
+
# If input isn't specified, then first argument will be used
|
16
16
|
options[:input] = ARGV.first
|
17
|
-
opts.on('-i', '--input FILE', 'Specify input file (if it
|
17
|
+
opts.on('-i', '--input FILE', 'Specify input file (if it isn\'t specified, then first argument will be used)') do |arg|
|
18
18
|
options[:input] = arg
|
19
19
|
end
|
20
20
|
|
@@ -43,22 +43,19 @@ if ARGV.size < 1
|
|
43
43
|
else
|
44
44
|
begin
|
45
45
|
optparse.parse!
|
46
|
-
rescue
|
46
|
+
rescue => e
|
47
47
|
puts e
|
48
48
|
puts "To see help, type:"
|
49
49
|
puts "$ #{File.basename(__FILE__)} -h"
|
50
50
|
exit
|
51
|
-
rescue OptionParser::InvalidArgument => e
|
52
|
-
puts e
|
53
|
-
puts "To see accepted arguments, type:"
|
54
|
-
puts "$ #{File.basename(__FILE__)} -h"
|
55
|
-
exit
|
56
51
|
end #begin
|
57
52
|
end
|
58
53
|
|
59
54
|
@cloth = ClothMark.new(options[:input], options[:markup], options[:additional_html], options[:output])
|
55
|
+
puts "Reading..."
|
60
56
|
@cloth.read_from_file
|
57
|
+
puts "Converting..."
|
61
58
|
@cloth.to_html
|
59
|
+
puts "Saving..."
|
62
60
|
@cloth.save_to_file
|
63
|
-
|
64
|
-
puts "File converted and saved to #{File.expand_path(@cloth.output)}"
|
61
|
+
puts "Done - #{File.expand_path(@cloth.output)}"
|
data/clothmark.gemspec
CHANGED
data/lib/clothmark.rb
CHANGED
@@ -12,7 +12,7 @@ class ClothMark
|
|
12
12
|
def initialize(file, markup = "markdown", additional_html = false, output = nil)
|
13
13
|
@file = file
|
14
14
|
|
15
|
-
# ClothMark will raise an error if unknown markup language
|
15
|
+
# ClothMark will raise an error if unknown markup language was sent
|
16
16
|
if %w(markdown textile bbcode).include? markup
|
17
17
|
@markup = markup
|
18
18
|
else
|
@@ -63,8 +63,8 @@ class ClothMark
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
|
67
|
-
|
66
|
+
# Header for an output file.
|
67
|
+
HEADER = <<-EOF
|
68
68
|
<html>
|
69
69
|
<head>
|
70
70
|
<style type="text/css">
|
@@ -94,11 +94,11 @@ end
|
|
94
94
|
</head>
|
95
95
|
<body>
|
96
96
|
<div id="wrapper">
|
97
|
-
|
97
|
+
EOF
|
98
98
|
|
99
|
-
|
100
|
-
|
99
|
+
# Footer for an output file.
|
100
|
+
FOOTER = <<-EOF
|
101
101
|
</div>
|
102
102
|
</body>
|
103
103
|
</html>
|
104
|
-
|
104
|
+
EOF
|