serve-markdown 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/serve-markdown.rb +17 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1edbb083cdd62ab0f2317c02629ec5060f8b1e9ef76f71b72e78b2c8268da302
4
- data.tar.gz: 87caf4bb6ecd9691ec1d4c89ee093bd6b0cd2d9261cf534f34d7f6ba96b20bde
3
+ metadata.gz: 2c691699f2e33e8a596ef9116689833a5a4c0c93691729c499f7da428b97118b
4
+ data.tar.gz: 683a16bde104677e77da09d5b5d74ecf5dd154b7fceaabcd6c2bab33af9f1cb7
5
5
  SHA512:
6
- metadata.gz: bfac33440296c6d4881f498516147dbceb357899a60ee403331fbcaddda0dbe0319390e495f20489bb73594735980b084f7bea5f72650282cd7555220811b304
7
- data.tar.gz: 2facffa84365faa1a461951db34fd62ae3d8ff6fc9d7eaaa772150136f747c6d96eb0b2a5be51aa429c0a4aefe2c1b3732b1b2a573f2aab2a96f587050d832aa
6
+ metadata.gz: 2569839ff4f92d7149c88885f75c89280600e567635a70db4295a8d9e43fc20860f4b0d443d28c6a117724db63a3ee4e54cb4b81822ff80b6668820db12488ac
7
+ data.tar.gz: 6868251b6ce37557733cc453c3b5ff71d4258e31bef70ae16fb3c8e8e550b9a60cd9cea49f9e6b8422dab896e506f8f32c61ae25fb54bc91c0f015d68ceac3a6
@@ -1,13 +1,27 @@
1
1
  require 'erubi'
2
2
  require 'tilt'
3
- require 'fileutils'
4
3
  require 'webrick'
4
+ require 'optparse'
5
+
6
+ @options = {}
7
+ OptionParser.new do |opts|
8
+ opts.banner = "Usage: markdown-serve [options]"
9
+ opts.on("-h", "--help", "Prints this help") do
10
+ puts opts; exit
11
+ end
12
+
13
+ opts.on("-o", "--output-templates", "Output templates to local directory") do
14
+ FileUtils.cp_r File.join(__dir__, 'templates'), '.'; exit
15
+ end
16
+ end.parse!
5
17
 
6
18
  FileUtils.remove_dir('html', force=true)
7
19
  FileUtils.mkdir('html')
8
20
 
9
- layout = Tilt.new(File.join(__dir__, 'templates/layout.html.erb'))
10
- filenames = Dir['*.md'].map { |fn| fn[/(.*)\.md/, 1] } # removing the .md suffix from fns
21
+ layout_path = Pathname.new('templates/layout.html.erb').exist? ? 'templates/layout.html.erb' : File.join(__dir__, 'templates/layout.html.erb')
22
+
23
+ layout = Tilt.new(layout_path)
24
+ filenames = Dir['*.md'].map { |fn| fn[/(.*)\.md/, 1] } # removes the .md suffix from fns
11
25
 
12
26
  filenames.map { |fn| ["#{fn}.md", "#{fn}.html"] }.each do |md_fn, html_fn|
13
27
  contents = Tilt.new(md_fn).render
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serve-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radek Osmulski