madowu 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: abfe3a1abc637f014d9dbc8df28f4a47511f3c89
4
+ data.tar.gz: d01f82d68410459d76871c9f8822d70715ec51c8
5
+ SHA512:
6
+ metadata.gz: f2f9bbe76af4ea519a16f470df9c14687013c3645f3fc5dd9458cf275f09e13895ca5f3ecfca0c9626aaa833112e2ad6ab486de3a43e34e3dd18b049e0496a8c
7
+ data.tar.gz: 727f0e3dfd1b55a3371eaebad0a945487ee5524e8aa73acdc1f1799c0ec937daf94e939b399c00e54869e07d8f3a2a392a0aadefa70485a4059a6bd267b51380
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/CHANGES ADDED
@@ -0,0 +1,7 @@
1
+ = THIS_GEM changelog
2
+
3
+ == Master (for 0.0.0)
4
+
5
+ ####
6
+ == Version 0.0.0
7
+ First release. [2015-10-20]
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rdoc", "~> 4.2"
10
+ gem "bundler", "~> 1.0"
11
+ gem "jeweler", "~> 2.0"
12
+ gem "simplecov", "~> 0"
13
+ gem "test-unit", "~> 3.1"
14
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 ippei94da
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = madowu
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to madowu
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * 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.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2015 ippei94da. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "madowu"
18
+ gem.homepage = "http://github.com/ippei94da/madowu"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Madowu, MArkDOWn to markUp, to build html}
21
+ gem.description = %Q{Markdown to HTML with table of contents, sidebar to neighboring directories.}
22
+ gem.email = "ippei94da@gmail.com"
23
+ gem.authors = ["ippei94da"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ desc "Code coverage detail"
36
+ task :simplecov do
37
+ ENV['COVERAGE'] = "true"
38
+ Rake::Task['test'].execute
39
+ end
40
+
41
+ task :default => :test
42
+
43
+ require 'rdoc/task'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "madowu #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
data/bin/dirmap ADDED
@@ -0,0 +1,30 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require "optparse"
5
+ require "pathname"
6
+ require "pp"
7
+ require "madowu"
8
+
9
+ ### option analysis
10
+ OPTIONS = {}
11
+ op = OptionParser.new
12
+ op.banner = [
13
+ "Usage: #{File.basename("#{__FILE__}")} dir_path",
14
+ " Note that indicate directory, not file."
15
+ ].join("\n")
16
+ #op.on("-a" , "--aho" , "descriptionA"){ OPTIONS[:aho] = true}
17
+ #op.on("-b val", "--bak=val", "descriptionB"){|v| OPTIONS[:bak] = v}
18
+ #op.parse!(ARGV)
19
+
20
+ unless ARGV.size == 1
21
+ puts op.banner
22
+ exit
23
+ end
24
+
25
+ unless FileTest.directory? ARGV[0]
26
+ puts op.banner
27
+ exit
28
+ end
29
+
30
+ puts Madowu::DirectoryMapper.dirmap(ARGV[0])
data/bin/madowu ADDED
@@ -0,0 +1,37 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require "optparse"
5
+ require "pp"
6
+ require "fileutils"
7
+ require "madowu"
8
+
9
+ ENCODING = "UTF-8"
10
+ HTML2PDF = "wkhtmltopdf"
11
+ HTML2PDF_OPTIONS = "-B 1cm -L 1.5cm -R 1.5cm -T 1.5cm -s A4 --encoding #{ENCODING} "
12
+
13
+ ### option analysis
14
+ OPTIONS = {}
15
+ op = OptionParser.new
16
+ op.banner = [
17
+ "Usage: #{File.basename("#{__FILE__}")} [options] foo.md",
18
+ " You can see help with '#{File.basename("#{__FILE__}")} --help'.",
19
+ ].join("\n")
20
+ op.on("-c css_file", "--css=file", "Indicate css file"){|v| OPTIONS[:css] = v}
21
+ op.on("-o" , "--outline" , "Embed outline"){ OPTIONS[:outline] = true}
22
+ op.on("-d" , "--dirmap-side", "Embed sideber of directory map"){OPTIONS[:dirmap] = true}
23
+ op.on("-s file" , "--side", "Read file for sidebar"){|v|OPTIONS[:sidebar] = v}
24
+ op.on("-m markdown" , "--markdown=command", "Indicate Markdown command"){|v| OPTIONS[:markdown] = v}
25
+ op.parse!(ARGV)
26
+
27
+ #pp OPTIONS
28
+
29
+ unless ARGV.size == 1
30
+ puts op.banner
31
+ exit
32
+ end
33
+
34
+ md_file = ARGV[0]
35
+ html_file = md_file.sub(/\.md/, ".html")
36
+ hg = Madowu::HtmlGenerator.new(md_file, OPTIONS[:markdown])
37
+ File.open(html_file, "w") { |io| io.puts hg.generate(OPTIONS) }
@@ -0,0 +1 @@
1
+ **/*.html
data/example/Rakefile ADDED
@@ -0,0 +1,74 @@
1
+ # coding: utf-8
2
+ # Rakefile for Markdown documents.
3
+
4
+ #DIRMAP_HTML = '.dirmap.html'
5
+ ENCODING = "UTF-8"
6
+ HTML2PDF = "wkhtmltopdf"
7
+ HTML2PDF_OPTIONS = "-B 1cm -L 1.5cm -R 1.5cm -T 1.5cm -s A4 --encoding #{ENCODING} "
8
+
9
+ require "pp"
10
+ require "fileutils"
11
+ require "pathname"
12
+
13
+ desc "Make .sidebar"
14
+ #dirmaps = []
15
+
16
+ #Dir.glob(['.', "**/*"]).each do |path|
17
+ # next unless FileTest.directory? path
18
+ #
19
+ # dirpath = Pathname.new(path)
20
+ # dirmap = "#{dirpath}/#{DIRMAP_HTML}"
21
+ # dirmap.sub!(/^\.\//, '')
22
+ # dirmaps << dirmap
23
+ # #pp dirmap
24
+ # file dirmap => [dirpath, dirpath.parent] do
25
+ # sh "dirmap #{dirpath} > #{dirpath}/#{DIRMAP_HTML}"
26
+ # end
27
+ #end
28
+ ##pp dirmaps
29
+ #task :dirmaps => dirmaps
30
+
31
+ desc "Make *.html from *.md"
32
+ md_files = FileList["**/*.md"]
33
+ html_files = md_files.ext("html")
34
+ task :md2html => FileList[html_files]
35
+ html_files.each do |html_file|
36
+ md_file = html_file.ext("md")
37
+ md_path = Pathname.new( md_file)
38
+ dirpath = md_path.dirname
39
+ #dirmap = md_path.dirname + DIRMAP_HTML
40
+ #file html_file => [md_file, dirmap] do
41
+ file html_file => [md_file, dirpath, dirpath.parent] do
42
+ #sh "madowu -o -s #{dirmap} -c madowu.css #{md_file}"
43
+ sh "madowu -o -d -c madowu.css #{md_file}"
44
+ end
45
+ end
46
+
47
+ desc "Update mtime of all html files"
48
+ task :tree => :md2html do
49
+ html_files.each do |html_file|
50
+ File.utime(Time.now, Time.now, html_file)
51
+ end
52
+ end
53
+
54
+ desc "Make *.pdf from *.html"
55
+ pdf_files = html_files.ext("pdf")
56
+ task :html2pdf => FileList[pdf_files]
57
+ pdf_files.each do |pdf_file|
58
+ html_file = pdf_file.ext("html")
59
+ file pdf_file => html_file do
60
+ sh "#{HTML2PDF} #{HTML2PDF_OPTIONS} #{html_file} #{pdf_file}"
61
+ end
62
+ end
63
+
64
+
65
+ task :pdf => :html2pdf
66
+ task :default => :tree
67
+
68
+ require "rake/clean"
69
+ CLEAN.include( [
70
+ html_files,
71
+ pdf_files,
72
+ #dirmaps,
73
+ ])
74
+
data/example/enum.md ADDED
@@ -0,0 +1,6 @@
1
+ # enum
2
+
3
+ enum
4
+
5
+ 0. enum
6
+ 0. enum
@@ -0,0 +1,7 @@
1
+ # head1
2
+ ## head2
3
+ ### head3
4
+ #### head4
5
+ ##### head5
6
+ ###### head6
7
+
data/example/index.md ADDED
@@ -0,0 +1,5 @@
1
+ # index of directory
2
+
3
+ * [enum.html](enum.html)
4
+ * [heading.html](heading.html)
5
+ * [list.html](list.html)
data/example/list.md ADDED
@@ -0,0 +1,8 @@
1
+ # List
2
+
3
+ list
4
+
5
+ * list
6
+ * list
7
+
8
+