mmarkdown 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f0ec6fb4f618a9ee8807d57cdafbe713b79ec00
4
- data.tar.gz: 3f5dda12f6f1da38c851a1cc6b352af8cdb00e43
3
+ metadata.gz: 73317ef3141f225d7a7bbf1e065f67decbb7d75a
4
+ data.tar.gz: daf74cb04a7d90eb092bd97d514f9df4b8cb92e8
5
5
  SHA512:
6
- metadata.gz: 3b62550197b658c6b0049f738d94c718bd9d37991e5ed4669061d47feb56013f1f3bc671ed7569320bcc5867172e9d8d7adef8514f812bfabaaab252572baae7
7
- data.tar.gz: 81048d75a3f3c9bd0eb6989b6563b2e57d3c103ca6312c55be1ed49d800bdce2983724147fec074c73cdb1635817436427054642d83fc0dcb870552f9c272912
6
+ metadata.gz: 0b836dd27ca1070e50ca86706a3e98efd109f0100fd1fdd298ee727e614f6a1f6c8c7b45cad915aed25e105d1241511fd6423d9ecb73057462d582d6cd6010ad
7
+ data.tar.gz: 79dfc3e16639cbfa7094ccb936952d418c6ba40553624243a0283b764b4fff80d8743a07a12b727082067d947b504e3c958785f43fe21ca38840e5cea88431cc
data/bin/mmarkdown CHANGED
@@ -13,12 +13,24 @@ option_parser = OptionParser.new {|opts|
13
13
  Version = MMarkdown::VERSION
14
14
 
15
15
  opts.banner = "Markdown with MathML\n"
16
- opts.banner += " Usage: #{File.basename(__FILE__)} <file.md>"
16
+ opts.banner += " Usage: #{File.basename(__FILE__)} [option] <file.md>\n"
17
+ opts.banner += " #{File.basename(__FILE__)} [option] -i <markdown string>"
17
18
 
18
- opts.on("-o", "--output FILENAME", String, "Output file name") {|f|
19
+ opts.separator "Options:"
20
+
21
+ opts.on("-oFILENAME", "--output FILENAME", String, "Output file name") {|f|
19
22
  options[:out_filename] = f
20
23
  }
21
24
 
25
+ opts.on("-iSTRING", "--input STRING", String, "Markdown string") {|str|
26
+ options[:input_string] = str
27
+ }
28
+
29
+ opts.on("--toc LEVEL", Integer, "List of table of contents as HTML",
30
+ "(Header LEVEL)") {|level|
31
+ options[:toc] = level
32
+ }
33
+
22
34
  opts.on("--stdout", "Output to STDOUT") {
23
35
  options[:stdout] = true
24
36
  }
@@ -36,16 +48,24 @@ def usage
36
48
  puts Help_message
37
49
  end
38
50
 
39
- if ARGV.size != 1
51
+ if (ARGV.size != 1) && !options[:input_string]
40
52
  usage
41
53
  exit 0
42
54
  else
43
55
  in_filename = ARGV[0]
44
56
  end
45
57
 
46
- md_string = File.open(ARGV[0]).read
58
+ if options[:input_string]
59
+ md_string = options[:input_string]
60
+ else
61
+ md_string = File.open(ARGV[0]).read
62
+ end
47
63
 
48
- html_string = MMarkdown.new(md_string).to_str
64
+ if options[:toc]
65
+ html_string = MMarkdown.new(md_string).toc_html(options[:toc])
66
+ else
67
+ html_string = MMarkdown.new(md_string).to_str
68
+ end
49
69
 
50
70
  unless options[:stdout]
51
71
  if options[:out_filename]
@@ -57,6 +77,8 @@ unless options[:stdout]
57
77
  out_filename = in_filename.gsub(/\.mmd$/, ".html")
58
78
  elsif in_filename =~ /\.markdown$/
59
79
  out_filename = in_filename.gsub(/\.markdown$/, ".html")
80
+ elsif in_filename == ""
81
+ out_filename = "mmarkdown.html"
60
82
  else
61
83
  out_filename = in_filename + ".html"
62
84
  end
@@ -2,7 +2,7 @@
2
2
  class MMarkdown
3
3
  VERSION_MAJOR = 0
4
4
  VERSION_MINOR = 0
5
- VERSION_REVISION = 5
5
+ VERSION_REVISION = 6
6
6
 
7
7
  VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_REVISION}"
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Tanaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-06 00:00:00.000000000 Z
11
+ date: 2014-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet