docx2gfm 0.2.0 → 0.3.0
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.
- checksums.yaml +5 -5
- data/LICENSE +21 -0
- data/README.md +12 -8
- data/lib/docx2gfm/docx_gfm_converter.rb +12 -12
- data/lib/docx2gfm/version.rb +1 -1
- data/lib/docx2gfm.rb +4 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 48b802854f6a5c4bb63e5f5ddfd7ef4842b29c4b
|
4
|
+
data.tar.gz: 39f9a4b1b9bc5a97cf4907c0d187fb5bbfa9be74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e13b9887d88360f5d134669a906ddd11a0bc5f37199b6064078e1fad18068764def38a1369b2951b3eabd0d07efb2a09102f36a8ae3104746104030302b3813e
|
7
|
+
data.tar.gz: 0b2657892ce806f007532c3a67691c99a4a7699c1198dee0275807dc67fa9499f89bd6b97f522ba7b736eac95a1dec3c244a171567773dbb64cb85278a04cbe2
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Sebastian Spier
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
# docx2gfm - docx to github-flavored-markdown converter
|
2
2
|
|
3
|
-
If you need to convert `.docx` documents to markdown, then `docx2gfm`
|
3
|
+
If you need to convert `.docx` documents to markdown, then `docx2gfm` helps you to make the process faster.
|
4
4
|
|
5
|
-
"Don't tell me, show
|
5
|
+
"Don't tell me, show me"! Ok ok! `docx2gfm` turns [this docx file](./examples/sample.docx) into [this markdown](./examples/sample.md). Also see the original [google Doc][gDoc].
|
6
6
|
|
7
|
-
|
7
|
+
For another example of `docx2gfm` in action, take a look at this blog post [docx2gfm - Your friendly docx to markdown converter][blog-post].
|
8
|
+
|
9
|
+
While some post-processing of the markdown is still required, `docx2gfm` already makes the conversion process much faster.
|
8
10
|
|
9
11
|
## The Long Story
|
10
12
|
|
11
|
-
I am maintaining an engineering blog, that uses [jekyll][jekyll] to generate static pages.
|
13
|
+
I am [maintaining an engineering blog][uth-tech-stack], that uses [jekyll][jekyll] to generate static pages.
|
12
14
|
|
13
15
|
In our blogging process, the authors write blog post as a Google Doc to collect feedback. Once the post is ready for publishing, they convert the Google Doc to [github-flavored-markdown][gfm], as that is what [jekyll][jekyll] needs as input to render the HTML for the blog.
|
14
16
|
|
@@ -50,10 +52,10 @@ Usage: docx2gfm [options]
|
|
50
52
|
The markdown produced by `docx2gfm` is good but not perfect. You still have to do some manual steps:
|
51
53
|
|
52
54
|
* Adapt the YAML Frontmatter (if you used the `--jekyll` option)
|
53
|
-
* Add the correct image
|
54
|
-
*
|
55
|
-
*
|
56
|
-
*
|
55
|
+
* Add the correct image paths
|
56
|
+
* Double check code blocks
|
57
|
+
* Double check quotes
|
58
|
+
* Double check tables
|
57
59
|
|
58
60
|
## Alternatives to docx2gfm
|
59
61
|
|
@@ -80,3 +82,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
80
82
|
[gDoc]: https://docs.google.com/document/d/16Kww2ic-YgFKskfDxYJu6o_ooSF3IORJh8Ho7XbgngI/edit
|
81
83
|
[pandoc]: https://pandoc.org/installing.html
|
82
84
|
[jekyll]: https://jekyllrb.com
|
85
|
+
[blog-post]: https://spier.hu/2018/12/docx2gfm-your-friendly-docx-to-markdown-converter
|
86
|
+
[uth-tech-stack]: https://spier.hu/2019/11/a-simple-tech-stack-for-your-engineering-blog
|
@@ -6,12 +6,12 @@ class DocxGfmConverter
|
|
6
6
|
end
|
7
7
|
|
8
8
|
# perform all conversation and cleanup steps
|
9
|
-
def process_gfm()
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
9
|
+
# def process_gfm()
|
10
|
+
# docx_2_gfm(@options[:file])
|
11
|
+
# cleanup_content_gfm()
|
12
|
+
# create_ref_style_links() if @options[:ref_style_links]
|
13
|
+
# add_frontmatter() if @options[:jekyll]
|
14
|
+
# end
|
15
15
|
|
16
16
|
def process_markdown()
|
17
17
|
docx_2_markdown(@options[:file])
|
@@ -26,16 +26,16 @@ class DocxGfmConverter
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# convert docx to initial markdown
|
29
|
-
def docx_2_gfm(file)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
29
|
+
# def docx_2_gfm(file)
|
30
|
+
# # TODO before reading the file, I could check if the file exists
|
31
|
+
# # TODO check out pandoc options that might be useful e.g. --extract-media='/images/own/'
|
32
|
+
# @content = `pandoc #{file} -f docx -t gfm --wrap=none`
|
33
|
+
# end
|
34
34
|
|
35
35
|
def docx_2_markdown(file)
|
36
36
|
# TODO before reading the file, I could check if the file exists
|
37
37
|
# TODO check out pandoc options that might be useful e.g. --extract-media='/images/own/'
|
38
|
-
@content = `pandoc #{file} --wrap=none --atx-headers -f docx -t markdown-bracketed_spans-link_attributes-smart-simple_tables -s`
|
38
|
+
@content = `pandoc '#{file}' --wrap=none --atx-headers -f docx -t markdown-bracketed_spans-link_attributes-smart-simple_tables -s`
|
39
39
|
end
|
40
40
|
|
41
41
|
# this removes all sorts of strange stuff that pandoc generates when
|
data/lib/docx2gfm/version.rb
CHANGED
data/lib/docx2gfm.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docx2gfm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Spier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -49,6 +49,7 @@ extra_rdoc_files: []
|
|
49
49
|
files:
|
50
50
|
- ".gitignore"
|
51
51
|
- Gemfile
|
52
|
+
- LICENSE
|
52
53
|
- LICENSE.txt
|
53
54
|
- MOTIVATION.md
|
54
55
|
- README.md
|
@@ -84,7 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
85
|
- !ruby/object:Gem::Version
|
85
86
|
version: '0'
|
86
87
|
requirements: []
|
87
|
-
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 2.6.14
|
88
90
|
signing_key:
|
89
91
|
specification_version: 4
|
90
92
|
summary: Convert a docx file, to github-flavored-markdown
|