markdown_to_word 0.1.5

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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.travis.yml +18 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +20 -0
  6. data/README.md +49 -0
  7. data/Rakefile +8 -0
  8. data/bin/m2w +14 -0
  9. data/lib/markdown_to_word.rb +18 -0
  10. data/lib/markdown_to_word/default.docx +0 -0
  11. data/lib/markdown_to_word/document.rb +35 -0
  12. data/lib/markdown_to_word/template/[Content_Types].xml +16 -0
  13. data/lib/markdown_to_word/template/_rels/.rels +7 -0
  14. data/lib/markdown_to_word/template/docProps/app.xml +2 -0
  15. data/lib/markdown_to_word/template/docProps/core.xml +2 -0
  16. data/lib/markdown_to_word/template/docProps/thumbnail.jpeg +0 -0
  17. data/lib/markdown_to_word/template/word/_rels/document.xml.rels +10 -0
  18. data/lib/markdown_to_word/template/word/document.xml +127 -0
  19. data/lib/markdown_to_word/template/word/fontTable.xml +64 -0
  20. data/lib/markdown_to_word/template/word/numbering.xml +229 -0
  21. data/lib/markdown_to_word/template/word/settings.xml +63 -0
  22. data/lib/markdown_to_word/template/word/styles.xml +504 -0
  23. data/lib/markdown_to_word/template/word/stylesWithEffects.xml +504 -0
  24. data/lib/markdown_to_word/template/word/theme/theme1.xml +318 -0
  25. data/lib/markdown_to_word/template/word/webSettings.xml +5 -0
  26. data/lib/markdown_to_word/version.rb +3 -0
  27. data/markdown_to_word.gemspec +29 -0
  28. data/script/bootstrap +3 -0
  29. data/script/build-template +19 -0
  30. data/script/cibuild +9 -0
  31. data/script/console +3 -0
  32. data/spec/fixtures/ol.md +4 -0
  33. data/spec/fixtures/ul.md +4 -0
  34. data/spec/markdown_to_word_bin_spec.rb +18 -0
  35. data/spec/markdown_to_word_conversion_spec.rb +21 -0
  36. data/spec/markdown_to_word_document_spec.rb +32 -0
  37. data/spec/markdown_to_word_spec.rb +15 -0
  38. data/spec/spec_helper.rb +25 -0
  39. metadata +201 -0
@@ -0,0 +1,318 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">
3
+ <a:themeElements>
4
+ <a:clrScheme name="Office">
5
+ <a:dk1>
6
+ <a:sysClr val="windowText" lastClr="000000"/>
7
+ </a:dk1>
8
+ <a:lt1>
9
+ <a:sysClr val="window" lastClr="FFFFFF"/>
10
+ </a:lt1>
11
+ <a:dk2>
12
+ <a:srgbClr val="1F497D"/>
13
+ </a:dk2>
14
+ <a:lt2>
15
+ <a:srgbClr val="EEECE1"/>
16
+ </a:lt2>
17
+ <a:accent1>
18
+ <a:srgbClr val="4F81BD"/>
19
+ </a:accent1>
20
+ <a:accent2>
21
+ <a:srgbClr val="C0504D"/>
22
+ </a:accent2>
23
+ <a:accent3>
24
+ <a:srgbClr val="9BBB59"/>
25
+ </a:accent3>
26
+ <a:accent4>
27
+ <a:srgbClr val="8064A2"/>
28
+ </a:accent4>
29
+ <a:accent5>
30
+ <a:srgbClr val="4BACC6"/>
31
+ </a:accent5>
32
+ <a:accent6>
33
+ <a:srgbClr val="F79646"/>
34
+ </a:accent6>
35
+ <a:hlink>
36
+ <a:srgbClr val="0000FF"/>
37
+ </a:hlink>
38
+ <a:folHlink>
39
+ <a:srgbClr val="800080"/>
40
+ </a:folHlink>
41
+ </a:clrScheme>
42
+ <a:fontScheme name="Office">
43
+ <a:majorFont>
44
+ <a:latin typeface="Calibri"/>
45
+ <a:ea typeface=""/>
46
+ <a:cs typeface=""/>
47
+ <a:font script="Jpan" typeface="MS ゴシック"/>
48
+ <a:font script="Hang" typeface="맑은 고딕"/>
49
+ <a:font script="Hans" typeface="宋体"/>
50
+ <a:font script="Hant" typeface="新細明體"/>
51
+ <a:font script="Arab" typeface="Times New Roman"/>
52
+ <a:font script="Hebr" typeface="Times New Roman"/>
53
+ <a:font script="Thai" typeface="Angsana New"/>
54
+ <a:font script="Ethi" typeface="Nyala"/>
55
+ <a:font script="Beng" typeface="Vrinda"/>
56
+ <a:font script="Gujr" typeface="Shruti"/>
57
+ <a:font script="Khmr" typeface="MoolBoran"/>
58
+ <a:font script="Knda" typeface="Tunga"/>
59
+ <a:font script="Guru" typeface="Raavi"/>
60
+ <a:font script="Cans" typeface="Euphemia"/>
61
+ <a:font script="Cher" typeface="Plantagenet Cherokee"/>
62
+ <a:font script="Yiii" typeface="Microsoft Yi Baiti"/>
63
+ <a:font script="Tibt" typeface="Microsoft Himalaya"/>
64
+ <a:font script="Thaa" typeface="MV Boli"/>
65
+ <a:font script="Deva" typeface="Mangal"/>
66
+ <a:font script="Telu" typeface="Gautami"/>
67
+ <a:font script="Taml" typeface="Latha"/>
68
+ <a:font script="Syrc" typeface="Estrangelo Edessa"/>
69
+ <a:font script="Orya" typeface="Kalinga"/>
70
+ <a:font script="Mlym" typeface="Kartika"/>
71
+ <a:font script="Laoo" typeface="DokChampa"/>
72
+ <a:font script="Sinh" typeface="Iskoola Pota"/>
73
+ <a:font script="Mong" typeface="Mongolian Baiti"/>
74
+ <a:font script="Viet" typeface="Times New Roman"/>
75
+ <a:font script="Uigh" typeface="Microsoft Uighur"/>
76
+ <a:font script="Geor" typeface="Sylfaen"/>
77
+ </a:majorFont>
78
+ <a:minorFont>
79
+ <a:latin typeface="Cambria"/>
80
+ <a:ea typeface=""/>
81
+ <a:cs typeface=""/>
82
+ <a:font script="Jpan" typeface="MS 明朝"/>
83
+ <a:font script="Hang" typeface="맑은 고딕"/>
84
+ <a:font script="Hans" typeface="宋体"/>
85
+ <a:font script="Hant" typeface="新細明體"/>
86
+ <a:font script="Arab" typeface="Arial"/>
87
+ <a:font script="Hebr" typeface="Arial"/>
88
+ <a:font script="Thai" typeface="Cordia New"/>
89
+ <a:font script="Ethi" typeface="Nyala"/>
90
+ <a:font script="Beng" typeface="Vrinda"/>
91
+ <a:font script="Gujr" typeface="Shruti"/>
92
+ <a:font script="Khmr" typeface="DaunPenh"/>
93
+ <a:font script="Knda" typeface="Tunga"/>
94
+ <a:font script="Guru" typeface="Raavi"/>
95
+ <a:font script="Cans" typeface="Euphemia"/>
96
+ <a:font script="Cher" typeface="Plantagenet Cherokee"/>
97
+ <a:font script="Yiii" typeface="Microsoft Yi Baiti"/>
98
+ <a:font script="Tibt" typeface="Microsoft Himalaya"/>
99
+ <a:font script="Thaa" typeface="MV Boli"/>
100
+ <a:font script="Deva" typeface="Mangal"/>
101
+ <a:font script="Telu" typeface="Gautami"/>
102
+ <a:font script="Taml" typeface="Latha"/>
103
+ <a:font script="Syrc" typeface="Estrangelo Edessa"/>
104
+ <a:font script="Orya" typeface="Kalinga"/>
105
+ <a:font script="Mlym" typeface="Kartika"/>
106
+ <a:font script="Laoo" typeface="DokChampa"/>
107
+ <a:font script="Sinh" typeface="Iskoola Pota"/>
108
+ <a:font script="Mong" typeface="Mongolian Baiti"/>
109
+ <a:font script="Viet" typeface="Arial"/>
110
+ <a:font script="Uigh" typeface="Microsoft Uighur"/>
111
+ <a:font script="Geor" typeface="Sylfaen"/>
112
+ </a:minorFont>
113
+ </a:fontScheme>
114
+ <a:fmtScheme name="Office">
115
+ <a:fillStyleLst>
116
+ <a:solidFill>
117
+ <a:schemeClr val="phClr"/>
118
+ </a:solidFill>
119
+ <a:gradFill rotWithShape="1">
120
+ <a:gsLst>
121
+ <a:gs pos="0">
122
+ <a:schemeClr val="phClr">
123
+ <a:tint val="50000"/>
124
+ <a:satMod val="300000"/>
125
+ </a:schemeClr>
126
+ </a:gs>
127
+ <a:gs pos="35000">
128
+ <a:schemeClr val="phClr">
129
+ <a:tint val="37000"/>
130
+ <a:satMod val="300000"/>
131
+ </a:schemeClr>
132
+ </a:gs>
133
+ <a:gs pos="100000">
134
+ <a:schemeClr val="phClr">
135
+ <a:tint val="15000"/>
136
+ <a:satMod val="350000"/>
137
+ </a:schemeClr>
138
+ </a:gs>
139
+ </a:gsLst>
140
+ <a:lin ang="16200000" scaled="1"/>
141
+ </a:gradFill>
142
+ <a:gradFill rotWithShape="1">
143
+ <a:gsLst>
144
+ <a:gs pos="0">
145
+ <a:schemeClr val="phClr">
146
+ <a:tint val="100000"/>
147
+ <a:shade val="100000"/>
148
+ <a:satMod val="130000"/>
149
+ </a:schemeClr>
150
+ </a:gs>
151
+ <a:gs pos="100000">
152
+ <a:schemeClr val="phClr">
153
+ <a:tint val="50000"/>
154
+ <a:shade val="100000"/>
155
+ <a:satMod val="350000"/>
156
+ </a:schemeClr>
157
+ </a:gs>
158
+ </a:gsLst>
159
+ <a:lin ang="16200000" scaled="0"/>
160
+ </a:gradFill>
161
+ </a:fillStyleLst>
162
+ <a:lnStyleLst>
163
+ <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr">
164
+ <a:solidFill>
165
+ <a:schemeClr val="phClr">
166
+ <a:shade val="95000"/>
167
+ <a:satMod val="105000"/>
168
+ </a:schemeClr>
169
+ </a:solidFill>
170
+ <a:prstDash val="solid"/>
171
+ </a:ln>
172
+ <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr">
173
+ <a:solidFill>
174
+ <a:schemeClr val="phClr"/>
175
+ </a:solidFill>
176
+ <a:prstDash val="solid"/>
177
+ </a:ln>
178
+ <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr">
179
+ <a:solidFill>
180
+ <a:schemeClr val="phClr"/>
181
+ </a:solidFill>
182
+ <a:prstDash val="solid"/>
183
+ </a:ln>
184
+ </a:lnStyleLst>
185
+ <a:effectStyleLst>
186
+ <a:effectStyle>
187
+ <a:effectLst>
188
+ <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0">
189
+ <a:srgbClr val="000000">
190
+ <a:alpha val="38000"/>
191
+ </a:srgbClr>
192
+ </a:outerShdw>
193
+ </a:effectLst>
194
+ </a:effectStyle>
195
+ <a:effectStyle>
196
+ <a:effectLst>
197
+ <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0">
198
+ <a:srgbClr val="000000">
199
+ <a:alpha val="35000"/>
200
+ </a:srgbClr>
201
+ </a:outerShdw>
202
+ </a:effectLst>
203
+ </a:effectStyle>
204
+ <a:effectStyle>
205
+ <a:effectLst>
206
+ <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0">
207
+ <a:srgbClr val="000000">
208
+ <a:alpha val="35000"/>
209
+ </a:srgbClr>
210
+ </a:outerShdw>
211
+ </a:effectLst>
212
+ <a:scene3d>
213
+ <a:camera prst="orthographicFront">
214
+ <a:rot lat="0" lon="0" rev="0"/>
215
+ </a:camera>
216
+ <a:lightRig rig="threePt" dir="t">
217
+ <a:rot lat="0" lon="0" rev="1200000"/>
218
+ </a:lightRig>
219
+ </a:scene3d>
220
+ <a:sp3d>
221
+ <a:bevelT w="63500" h="25400"/>
222
+ </a:sp3d>
223
+ </a:effectStyle>
224
+ </a:effectStyleLst>
225
+ <a:bgFillStyleLst>
226
+ <a:solidFill>
227
+ <a:schemeClr val="phClr"/>
228
+ </a:solidFill>
229
+ <a:gradFill rotWithShape="1">
230
+ <a:gsLst>
231
+ <a:gs pos="0">
232
+ <a:schemeClr val="phClr">
233
+ <a:tint val="40000"/>
234
+ <a:satMod val="350000"/>
235
+ </a:schemeClr>
236
+ </a:gs>
237
+ <a:gs pos="40000">
238
+ <a:schemeClr val="phClr">
239
+ <a:tint val="45000"/>
240
+ <a:shade val="99000"/>
241
+ <a:satMod val="350000"/>
242
+ </a:schemeClr>
243
+ </a:gs>
244
+ <a:gs pos="100000">
245
+ <a:schemeClr val="phClr">
246
+ <a:shade val="20000"/>
247
+ <a:satMod val="255000"/>
248
+ </a:schemeClr>
249
+ </a:gs>
250
+ </a:gsLst>
251
+ <a:path path="circle">
252
+ <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/>
253
+ </a:path>
254
+ </a:gradFill>
255
+ <a:gradFill rotWithShape="1">
256
+ <a:gsLst>
257
+ <a:gs pos="0">
258
+ <a:schemeClr val="phClr">
259
+ <a:tint val="80000"/>
260
+ <a:satMod val="300000"/>
261
+ </a:schemeClr>
262
+ </a:gs>
263
+ <a:gs pos="100000">
264
+ <a:schemeClr val="phClr">
265
+ <a:shade val="30000"/>
266
+ <a:satMod val="200000"/>
267
+ </a:schemeClr>
268
+ </a:gs>
269
+ </a:gsLst>
270
+ <a:path path="circle">
271
+ <a:fillToRect l="50000" t="50000" r="50000" b="50000"/>
272
+ </a:path>
273
+ </a:gradFill>
274
+ </a:bgFillStyleLst>
275
+ </a:fmtScheme>
276
+ </a:themeElements>
277
+ <a:objectDefaults>
278
+ <a:spDef>
279
+ <a:spPr/>
280
+ <a:bodyPr/>
281
+ <a:lstStyle/>
282
+ <a:style>
283
+ <a:lnRef idx="1">
284
+ <a:schemeClr val="accent1"/>
285
+ </a:lnRef>
286
+ <a:fillRef idx="3">
287
+ <a:schemeClr val="accent1"/>
288
+ </a:fillRef>
289
+ <a:effectRef idx="2">
290
+ <a:schemeClr val="accent1"/>
291
+ </a:effectRef>
292
+ <a:fontRef idx="minor">
293
+ <a:schemeClr val="lt1"/>
294
+ </a:fontRef>
295
+ </a:style>
296
+ </a:spDef>
297
+ <a:lnDef>
298
+ <a:spPr/>
299
+ <a:bodyPr/>
300
+ <a:lstStyle/>
301
+ <a:style>
302
+ <a:lnRef idx="2">
303
+ <a:schemeClr val="accent1"/>
304
+ </a:lnRef>
305
+ <a:fillRef idx="0">
306
+ <a:schemeClr val="accent1"/>
307
+ </a:fillRef>
308
+ <a:effectRef idx="1">
309
+ <a:schemeClr val="accent1"/>
310
+ </a:effectRef>
311
+ <a:fontRef idx="minor">
312
+ <a:schemeClr val="tx1"/>
313
+ </a:fontRef>
314
+ </a:style>
315
+ </a:lnDef>
316
+ </a:objectDefaults>
317
+ <a:extraClrSchemeLst/>
318
+ </a:theme>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <w:webSettings xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" mc:Ignorable="w14">
3
+ <w:allowPNG/>
4
+ <w:doNotSaveAsSingleFile/>
5
+ </w:webSettings>
@@ -0,0 +1,3 @@
1
+ module MarkdownToWord
2
+ VERSION = "0.1.5"
3
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'markdown_to_word/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "markdown_to_word"
8
+ spec.version = MarkdownToWord::VERSION
9
+ spec.authors = ["Ben Balter"]
10
+ spec.email = ["ben.balter@github.com"]
11
+ spec.summary = "Converts GitHub-flavored Markdown to a Word document"
12
+ spec.homepage = "https://github.com/benbalter/markdown_to_word"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "htmltoword", "~> 0.5"
21
+ spec.add_dependency "html-pipeline", "~> 2.2"
22
+ spec.add_dependency "github-markdown", "~> 0.6"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.6"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "pry", "~> 0.10"
27
+ spec.add_development_dependency "rspec", "~> 3.4"
28
+ spec.add_development_dependency "word-to-markdown", "~> 1.1"
29
+ end
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ bundle install
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ rm -f lib/markdown_to_word/default.docx
6
+ cwd=$(pwd)
7
+ cd lib/markdown_to_word/template
8
+
9
+ # Zip options:
10
+ # r - recursive
11
+ # l - convert LF to CR LF line endings
12
+ # D - Don't make entries for directories
13
+ # T - test the resulting zip
14
+ # 9 - Moar compression
15
+ # q - quiet
16
+ # o - make the file as old as the latest entry
17
+ zip -r -l -D -T -9 -q -o ../default.docx *
18
+
19
+ cd $cwd
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ bundle exec m2w --version
6
+
7
+ bundle exec rake spec
8
+
9
+ bundle exec gem build markdown_to_word.gemspec
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ bundle exec pry -r './lib/markdown_to_word.rb'
@@ -0,0 +1,4 @@
1
+ # Numbered lists
2
+
3
+ 1. One
4
+ 2. Two
@@ -0,0 +1,4 @@
1
+ # Unnumbered lists
2
+
3
+ - One
4
+ - Two
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe "MarkdownToWord binary" do
4
+ it "returns the help" do
5
+ output, status = Open3.capture2e "bundle", "exec", "m2w"
6
+ expect(output).to eql("Usage: bundle exec m2w [markdown]\n")
7
+ end
8
+
9
+ it "returns the version" do
10
+ output, status = Open3.capture2e "bundle", "exec", "m2w", "--version"
11
+ expect(output).to match(/MarkdownToWord v\d+\.\d+\.\d+/)
12
+ end
13
+
14
+ it "converts the document" do
15
+ content, status = Open3.capture2e "bundle", "exec", "m2w", "# Test"
16
+ as_markdown(content) { |md| expect(md).to eql("# Test") }
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+
3
+ describe "MarkdownToWord Conversion" do
4
+ it "converts unumbered lists" do
5
+ md = fixture("ul")
6
+ as_docx(md) do |docx|
7
+ as_markdown(docx) do |ouput|
8
+ expect(ouput).to eql(md.strip)
9
+ end
10
+ end
11
+ end
12
+
13
+ it "converts numbered lists" do
14
+ md = fixture("ol")
15
+ as_docx(md) do |docx|
16
+ as_markdown(docx) do |ouput|
17
+ expect(ouput).to eql(md.strip)
18
+ end
19
+ end
20
+ end
21
+ end