mdoc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +46 -0
- data/ROADMAP +21 -0
- data/bin/mdoc +32 -0
- data/config/members.yml +16 -0
- data/docs/css/jsgantt.css +53 -0
- data/docs/gantt.html +68 -0
- data/docs/js/jsgantt.js +1681 -0
- data/examples/multikeys.md +8 -0
- data/examples/original.md +10 -0
- data/examples/pandoc.md +7 -0
- data/lib/mdoc/convert.rb +84 -0
- data/lib/mdoc/parser.rb +80 -0
- data/lib/mdoc/version.rb +4 -0
- data/lib/mdoc.rb +2 -0
- data/mdoc.gemspec +19 -0
- data/spec/parser_spec.rb +32 -0
- data/spec/spec_helper.rb +7 -0
- metadata +128 -0
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
MDOC: markdown document converting/management tool
|
2
|
+
========================================================
|
3
|
+
|
4
|
+
Requirement
|
5
|
+
----------------
|
6
|
+
|
7
|
+
- Ruby 1.9.x
|
8
|
+
- pandoc in path for docx/rtf conversion
|
9
|
+
- xelatex in path for pdf conversion
|
10
|
+
|
11
|
+
Command line options
|
12
|
+
-------------------------
|
13
|
+
|
14
|
+
Convert a markdown file (`readme.md`) to docx (`readme.docx`):
|
15
|
+
|
16
|
+
mdoc -t docx readme.md
|
17
|
+
|
18
|
+
Use `mdoc --help` for more options.
|
19
|
+
|
20
|
+
Online Preview
|
21
|
+
-----------------
|
22
|
+
|
23
|
+
Put a markdown document to an temporary url for revew:
|
24
|
+
|
25
|
+
mdoc --preview readme.md
|
26
|
+
|
27
|
+
This will open your browser to show a converted document (use documentup).
|
28
|
+
|
29
|
+
Meta information in header
|
30
|
+
-----------------------------
|
31
|
+
|
32
|
+
Three different formats are supported:
|
33
|
+
|
34
|
+
1. pandoc like three line header:
|
35
|
+
|
36
|
+
% title
|
37
|
+
% author
|
38
|
+
% date
|
39
|
+
|
40
|
+
2. multi-header (separate by first blank line)
|
41
|
+
|
42
|
+
Title: some key
|
43
|
+
Author: some key
|
44
|
+
|
45
|
+
3. separator:
|
46
|
+
if `% ---` is the first no-blank line, the contents between until the next `% ---` will be treated as header.
|
data/ROADMAP
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
% ----
|
2
|
+
title: Markdown Document Converting Tools
|
3
|
+
status: producing
|
4
|
+
leader: huangw
|
5
|
+
moderator: lixf
|
6
|
+
team: [xuyc sunyr songcy]
|
7
|
+
year: 2013
|
8
|
+
% ----
|
9
|
+
|
10
|
+
[+] design: design api document in readme 06/12 @huangw:06/12
|
11
|
+
|
12
|
+
[+] parser: write a document parser using yaml and kramdown 06/12 @huangw:06/12
|
13
|
+
|
14
|
+
[+] converters: write converters for varies format 06/12 @huangw
|
15
|
+
[++] docx: convert to docx with pandoc 06/12 @huangw:06/13
|
16
|
+
[++] docup: convert to html use document-up 06/12 @huangw:06/13
|
17
|
+
[++] pdf: convert to pdf use xelatex 06/12 @huangw
|
18
|
+
|
19
|
+
[+] server: a server that can receive html for review 06/12 @huangw:50
|
20
|
+
|
21
|
+
[+] release_v0.1.0: first public release 06/13 @huangw:06/13
|
data/bin/mdoc
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# vim: ft=ruby
|
3
|
+
|
4
|
+
$: << 'lib' # debug only
|
5
|
+
|
6
|
+
require "mdoc"
|
7
|
+
require "optparse"
|
8
|
+
|
9
|
+
options = {}
|
10
|
+
|
11
|
+
optparse = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: mdoc [options] filename.md"
|
13
|
+
opts.separator "Options:"
|
14
|
+
|
15
|
+
options[:type] = 'rtf'
|
16
|
+
opts.on('-t TYPE', '--type TYPE', 'output file type') do |type|
|
17
|
+
options[:type] = type
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on_tail('-h', '--help', 'Display this screen') do
|
21
|
+
puts opts
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
optparse.parse!(ARGV)
|
27
|
+
|
28
|
+
file = ARGV[0]
|
29
|
+
raise "Only markdown file (`*.md`) can be parsed" unless file =~ /\.md$/
|
30
|
+
|
31
|
+
klass = options[:type].to_s.capitalize
|
32
|
+
eval("Mdoc::" + klass).new(file).convert
|
data/config/members.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
members:
|
2
|
+
huangw: ['黄巍', 'huangw@pe-po.com']
|
3
|
+
xuyc: ['徐以臣', 'xuyc@pe-po.com']
|
4
|
+
sunyr: ['孙云蕊', 'sunyr@pe-po.com']
|
5
|
+
lizh: ['李中华', 'lizh@pe-po.com']
|
6
|
+
songcy: ['宋春月', 'songcy@pe-po.com']
|
7
|
+
du: ['杜丽玲', 'du@pe-po.com']
|
8
|
+
zhaogl: ['赵桂兰', 'zhaogl@pe-po.com']
|
9
|
+
wangh: ['王浩', 'wangh@pe-po.com']
|
10
|
+
liudx: ['刘东旭', 'liudx@pe-po.com']
|
11
|
+
zhangy: ['张祎', 'zhangy@pe-po.com']
|
12
|
+
wangqh: ['王清华', 'wangqh@pe-po.com']
|
13
|
+
cuibg: ['崔保国', 'cuibg@pe-po.com']
|
14
|
+
lixf: ['李现凤', 'lixf@pe-po.com']
|
15
|
+
zhaoxx: ['赵秀秀', 'zhaoxx@pe-po.com']
|
16
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
// These are the class/styles used by various objects in GanttChart. However, Firefox has problems deciphering class style when DIVs are embedded in other DIVs.
|
3
|
+
|
4
|
+
// GanttChart makes heavy use of embedded DIVS, thus the style are often embedded directly in the objects html. If this could be resolved with Firefox, it would
|
5
|
+
|
6
|
+
// make alot of the code look simpleer/cleaner without all the embedded styles
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
..gantt { font-family:tahoma, arial, verdana; font-size:10px;}
|
11
|
+
|
12
|
+
..gdatehead { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; HEIGHT: 18px }
|
13
|
+
|
14
|
+
..ghead { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 24px; HEIGHT: 20px }
|
15
|
+
|
16
|
+
..gname { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; WIDTH: 18px; HEIGHT: 18px }
|
17
|
+
|
18
|
+
..ghead A { FONT-SIZE: 10px; COLOR: #000000; TEXT-DECORATION: none }
|
19
|
+
|
20
|
+
..gheadwkend A { FONT-SIZE: 10px; COLOR: #000000; TEXT-DECORATION: none }
|
21
|
+
|
22
|
+
..gheadwkend { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 24px; HEIGHT: 20px; background-color: #cfcfcf }
|
23
|
+
|
24
|
+
..gfiller { BORDER-TOP: #efefef 1px solid; BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px }
|
25
|
+
|
26
|
+
..gfillerwkend { BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px; BACKGROUND-COLOR: #cfcfcf }
|
27
|
+
|
28
|
+
..gitem { BORDER-TOP: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px }
|
29
|
+
|
30
|
+
..gitemwkend { BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px }
|
31
|
+
|
32
|
+
..gmilestone { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 14px; OVERFLOW: hidden; BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px}
|
33
|
+
|
34
|
+
..gmilestonewkend { BORDER-TOP: #efefef 1px solid; BORDER-LEFT: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px}
|
35
|
+
|
36
|
+
..btn { BORDER-RIGHT: #ffffff; BORDER-TOP: #ffffff; FONT-WEIGHT: bold; FONT-SIZE: 10px; BORDER-LEFT: #ffffff; WIDTH: 12px; COLOR: #cccccc; BORDER-BOTTOM: #ffffff; BACKGROUND-COLOR: #ffffff }
|
37
|
+
|
38
|
+
..hrcomplete { BORDER-RIGHT: #000000 2px solid; PADDING-RIGHT: 0px; BORDER-TOP: #000000 2px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; BORDER-LEFT: #000000 2px solid; WIDTH: 20px; COLOR: #000000; PADDING-TOP: 0px; BORDER-BOTTOM: #000000 2px solid; HEIGHT: 4px }
|
39
|
+
|
40
|
+
..hrhalfcomplete { BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 2px solid; WIDTH: 9px; COLOR: #000000; BORDER-BOTTOM: #000000 2px solid; HEIGHT: 4px }
|
41
|
+
|
42
|
+
..gweekend { font-family:tahoma, arial, verdana; font-size:11px; background-color:#EEEEEE; text-align:center; }
|
43
|
+
|
44
|
+
..gtask { font-family:tahoma, arial, verdana; font-size:11px; background-color:#00FF00; text-align:center; }
|
45
|
+
|
46
|
+
..gday { font-family:tahoma, arial, verdana; font-size:11px; text-align:center; }
|
47
|
+
|
48
|
+
..gcomplete { background-color:black; height:5px; overflow: auto; margin-top:4px; }
|
49
|
+
|
50
|
+
DIV.scroll { BORDER-RIGHT: #efefef 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #efefef 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; OVERFLOW: hidden; BORDER-LEFT: #efefef 1px solid; WIDTH: 420px; PADDING-TOP: 0px; BORDER-BOTTOM: #efefef 1px solid; BACKGROUND-COLOR: #ffffff }
|
51
|
+
|
52
|
+
DIV.scroll2 { position:relative; PADDING-RIGHT: 0px; overflow:auto ;overflow-x:scroll;overflow-y:hidden; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; WIDTH: 482px; PADDING-TOP: 0px; BACKGROUND-COLOR: #ffffff }
|
53
|
+
|
data/docs/gantt.html
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
5
|
+
<link rel="stylesheet" type="text/css" href="./css/jsgantt.css" />
|
6
|
+
<script language="javascript" src="./js/jsgantt.js"></script>
|
7
|
+
<title>Gantt Chart | Markdown Document Converting Tools</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<h2>Markdown Document Converting Tools
|
11
|
+
|
12
|
+
</h2>
|
13
|
+
|
14
|
+
<div style="position:relative" class="gantt" id="GanttChartDIV"></div>
|
15
|
+
<script>
|
16
|
+
var g = new JSGantt.GanttChart('g',document.getElementById('GanttChartDIV'), 'day');
|
17
|
+
g.setShowRes(1); // Show/Hide Responsible (0/1)
|
18
|
+
g.setShowDur(1); // Show/Hide Duration (0/1)
|
19
|
+
g.setShowComp(0); //
|
20
|
+
g.setCaptionType('Caption'); // Set to Show Caption
|
21
|
+
g.setShowStartDate(0); // Show/Hide Start Date(0/1)
|
22
|
+
g.setShowEndDate(0); // Show/Hide End Date(0/1)
|
23
|
+
//g.setDateDisplayFormat('yyyy-mm-dd') // Set format to display dates ('mm/dd/yyyy', 'dd/mm/yyyy', 'yyyy-mm-dd')
|
24
|
+
g.setFormatArr("day","week","month") // Set format options (up to 4 : "minute","hour","day","week","month","quarter")
|
25
|
+
|
26
|
+
if( g ) {
|
27
|
+
g.AddTaskItem(new JSGantt.TaskItem(10,'design api document in readme','06/12/2013','06/12/2013','FFA500','',0,'黄巍',0,0,0,1,'','黄巍'));
|
28
|
+
|
29
|
+
g.AddTaskItem(new JSGantt.TaskItem(12,'write a document parser using yaml and kramdown','06/12/2013','06/12/2013','FFA500','',0,'黄巍',0,0,0,1,'','黄巍'));
|
30
|
+
|
31
|
+
g.AddTaskItem(new JSGantt.TaskItem(14,'write converters for varies format','06/12/2013','06/12/2013','FFA500','',0,'黄巍',0,1,0,1,'',''));
|
32
|
+
|
33
|
+
g.AddTaskItem(new JSGantt.TaskItem(15,'convert to docx with pandoc','06/12/2013','06/12/2013','FFA500','',0,'黄巍',0,0,14,1,'','黄巍'));
|
34
|
+
|
35
|
+
g.AddTaskItem(new JSGantt.TaskItem(16,'convert to html use document-up','06/12/2013','06/12/2013','FFA500','',0,'黄巍',0,0,14,1,'','黄巍'));
|
36
|
+
|
37
|
+
g.AddTaskItem(new JSGantt.TaskItem(17,'convert to pdf use xelatex','06/12/2013','06/12/2013','FFA500','',0,'黄巍',0,0,14,1,'','黄巍'));
|
38
|
+
|
39
|
+
g.AddTaskItem(new JSGantt.TaskItem(19,'a server that can receive html for review','06/12/2013','06/12/2013','FFA500','',0,'黄巍',0,0,0,1,'','黄巍'));
|
40
|
+
|
41
|
+
g.AddTaskItem(new JSGantt.TaskItem(21,'first public release','06/13/2013','06/13/2013','B0C4DE','',1,'黄巍',0,0,0,1,'','黄巍'));
|
42
|
+
|
43
|
+
g.Draw();
|
44
|
+
g.DrawDependencies();
|
45
|
+
}
|
46
|
+
else
|
47
|
+
{
|
48
|
+
alert("not defined");
|
49
|
+
}
|
50
|
+
</script>
|
51
|
+
|
52
|
+
|
53
|
+
<h3>Recent Git Log</h3>
|
54
|
+
<pre><code>
|
55
|
+
* <em style='color:grey'>8bdb56db381fa801a56bad355add39c78d44f5c1</em>
|
56
|
+
| <strong>2013-06-12 10:15</strong> By Huang Wei <huangw@pe-po.com>
|
57
|
+
| | <strong style='color:green'>update Gantt chart</strong>
|
58
|
+
|
|
59
|
+
|
|
60
|
+
* <em style='color:grey'>831f9d5945f2be643d54fd6abe230a8ae6657aba</em>
|
61
|
+
<strong>2013-06-12 10:14</strong> By Huang Wei <huangw@pe-po.com>
|
62
|
+
<strong style='color:green'>add roadmap</strong>
|
63
|
+
|
64
|
+
|
65
|
+
</code></pre>
|
66
|
+
|
67
|
+
</body>
|
68
|
+
</html>
|