enwrite 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +64 -28
- data/enwrite.gemspec +3 -3
- data/lib/enwrite.rb +1 -1
- data/lib/output/hugo.rb +11 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41ff65583cf68c9ac604768f8b61527ef296e2e0
|
4
|
+
data.tar.gz: a71a84427e5d203841a7f8be48a5cf72386604f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0ad71fde41b53fb975e1966ad07c62edcc874066cbf94eb7fc0fabd78cca3fa7089ed7c71d580bd4164cae2e48282433399a2f0d3cc46c20032a116061c0dd1
|
7
|
+
data.tar.gz: 3da4d70e1ddfddde94df2f9f41a6c7f3336120effde5aaacb1606c6dda9281b28c2b661442696278ca3b6d22b2980d6b56af1d6a066864a327835f9db9a641bb
|
data/README.md
CHANGED
@@ -15,13 +15,16 @@ provide the authentication code to Enwrite.
|
|
15
15
|
For now it produces output suitable for [Hugo](http://gohugo.io). You
|
16
16
|
need to have an existing Hugo install.
|
17
17
|
|
18
|
-
##
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
$ sudo gem install enwrite
|
19
21
|
|
20
|
-
|
22
|
+
Make sure you have Hugo installed:
|
23
|
+
http://gohugo.io/overview/installing/
|
21
24
|
|
22
|
-
|
25
|
+
## Getting started
|
23
26
|
|
24
|
-
Create a new Hugo site for testing
|
27
|
+
Create a new Hugo site for testing:
|
25
28
|
|
26
29
|
$ cd ~/tmp
|
27
30
|
$ hugo new site my-hugo-blog
|
@@ -30,7 +33,7 @@ Create a new Hugo site for testing (if you don't have one already):
|
|
30
33
|
Populate it with contents from Evernote:
|
31
34
|
|
32
35
|
$ enwrite --help
|
33
|
-
Enwrite v0.2.
|
36
|
+
Enwrite v0.2.3
|
34
37
|
|
35
38
|
Usage: /usr/local/bin/enwrite [options] (at least one of -n or -s has to be specified)
|
36
39
|
|
@@ -56,8 +59,8 @@ Populate it with contents from Evernote:
|
|
56
59
|
interactively.
|
57
60
|
--config-tag TAG Specify tag to determine config notes
|
58
61
|
(default: _enwrite_config)
|
59
|
-
|
60
|
-
-
|
62
|
+
-v, --verbose Verbose mode
|
63
|
+
-d, --debug Debug output mode
|
61
64
|
--version Show version
|
62
65
|
-h, --help Shows this help message
|
63
66
|
|
@@ -83,6 +86,8 @@ file types are stored and linked to with their filename.
|
|
83
86
|
The following tags trigger special behavior if found within the
|
84
87
|
selected notes:
|
85
88
|
|
89
|
+
### Globally-recognized tags
|
90
|
+
|
86
91
|
- `page`: publish the note as a page instead of a blog post.
|
87
92
|
- `post` (or none): publish the note as a blog post. This is the
|
88
93
|
default.
|
@@ -94,6 +99,7 @@ default.
|
|
94
99
|
about this will be written soon). For example, if you wanted blog
|
95
100
|
posts to be stored in the Hugo `blog` category instead of `post`,
|
96
101
|
you could include this:
|
102
|
+
|
97
103
|
```
|
98
104
|
hugo:
|
99
105
|
tag_to_type:
|
@@ -101,38 +107,68 @@ default.
|
|
101
107
|
post: blog/
|
102
108
|
page:
|
103
109
|
```
|
110
|
+
|
111
|
+
### Hugo-specific tags
|
112
|
+
|
113
|
+
The following tags are recognized by the Hugo output plugin (the only
|
114
|
+
one available at the moment):
|
115
|
+
|
104
116
|
- `_enwrite_files_hugo`: text in these notes is ignored, but any
|
105
117
|
attachments are stored under the Hugo output directory. `.tar.gz`
|
106
118
|
files will be unpacked under that directory, all others will be
|
107
|
-
stored as-is.
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
119
|
+
stored as-is. You can use this to have Hugo config files, themes,
|
120
|
+
static contents or anything else automatically installed by Enwrite
|
121
|
+
as well. Please note that any "files" notes *must also* be included
|
122
|
+
in the selection criteria specified by `-n`, `-t` or `-s` (e.g. if
|
123
|
+
you are using `-t published`, your files notes must also be tagged
|
124
|
+
`published` or they will be ignored).
|
125
|
+
|
126
|
+
Any text in files notes will be ignored, so you can use it to make
|
127
|
+
it human-readable. For example, I have the following note in the
|
128
|
+
notebook that powers http://zzamboni.org/new/, so I can start from a
|
129
|
+
plain Hugo site and have it fully customized after running
|
130
|
+
`enwrite`:
|
131
|
+
|
132
|
+
![Files note screenshot](https://www.evernote.com/shard/s2/sh/828dbfcd-83ff-493c-a247-493ed0704e73/fb8ffb0e1e417dd6/res/eaa1ca47-3cb1-4c4d-963e-815cfd83bd00/skitch.png)
|
116
133
|
|
117
|
-
-
|
118
|
-
|
119
|
-
|
120
|
-
|
134
|
+
- Any tags of the form `_foo=bar` are inserted into the frontmatter
|
135
|
+
for the generated posts as field `foo` with value `bar`. This might
|
136
|
+
be used to add information (e.g. a custom `slug`, specify `weight` for
|
137
|
+
ordeing of pages, or any other field which may control the behavior or
|
138
|
+
output produced.
|
121
139
|
|
140
|
+
## Other tags
|
141
|
+
|
142
|
+
All the special tags described above are removed from the post before
|
143
|
+
publishing (you can configure additional ones to remove with the
|
144
|
+
`--remove-tags` option). All other tags are passed through to the
|
145
|
+
produced posts. Of course, you could have some of those tags also
|
146
|
+
trigger special behavior within the output system. For example, my
|
147
|
+
[custom Hyde-X Hugo theme](https://github.com/zzamboni/new/tree/master/themes/hyde-x-zzamboni)
|
148
|
+
recognizes the following tags:
|
149
|
+
|
150
|
+
- `_home`: set this page as the default for the site.
|
151
|
+
- `_menu=main`: add this page to the top-level navigation menu.
|
152
|
+
|
122
153
|
## Shortcuts
|
123
154
|
|
124
|
-
|
155
|
+
Shortcuts are of the form `[shortcutname params]`. The following
|
156
|
+
shortcuts are currently recognized:
|
125
157
|
|
126
|
-
Embed Youtube video by URL or ID. You can optionally specify `width`
|
127
|
-
and `height`. All arguments must be enclosed in double quotes.
|
158
|
+
- Embed Youtube video by URL or ID. You can optionally specify `width`
|
159
|
+
and `height`. All arguments must be enclosed in double quotes.
|
128
160
|
|
129
|
-
|
130
|
-
|
131
|
-
|
161
|
+
```
|
162
|
+
[youtube url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"]
|
163
|
+
[youtube src="https://www.youtube.com/watch?v=dQw4w9WgXcQ"]
|
164
|
+
[youtube id="dQw4w9WgXcQ" width="640px" height="480px"]
|
165
|
+
```
|
132
166
|
|
133
|
-
Embed gist
|
167
|
+
- Embed gist.
|
134
168
|
|
135
|
-
|
169
|
+
```
|
170
|
+
[gist url="https://gist.github.com/zzamboni/843142d3f759e582fe8f"]
|
171
|
+
```
|
136
172
|
|
137
173
|
## Planned features/fixes
|
138
174
|
|
data/enwrite.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: enwrite 0.2.
|
5
|
+
# stub: enwrite 0.2.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "enwrite"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Diego Zamboni"]
|
14
|
-
s.date = "2015-05-
|
14
|
+
s.date = "2015-05-20"
|
15
15
|
s.description = "Enwrite allows you to generate a website from content stored in Evernote."
|
16
16
|
s.email = "diego@zzamboni.org"
|
17
17
|
s.executables = ["enwrite"]
|
data/lib/enwrite.rb
CHANGED
data/lib/output/hugo.rb
CHANGED
@@ -107,18 +107,12 @@ class Hugo < Output
|
|
107
107
|
return
|
108
108
|
end
|
109
109
|
|
110
|
-
# Determine if we should
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
# Determine if we should use a custom slug
|
117
|
-
slug = nil
|
118
|
-
note.tagNames.grep(/^_slug=(\S+)/) do |slugtag|
|
119
|
-
slug = $1
|
120
|
-
note.tagNames -= [ slugtag ]
|
121
|
-
verbose " Will use custom slug for this post: #{slug}"
|
110
|
+
# Determine if we should add custom frontmatter
|
111
|
+
custom_fm = {}
|
112
|
+
note.tagNames.grep(/^_(\S+)=(.*)/) do |tag|
|
113
|
+
custom_fm[$1] = $2
|
114
|
+
note.tagNames -= [ tag ]
|
115
|
+
verbose " Will use custom frontmatter entry for this post: #{$1} = #{custom_fm[$1]}"
|
122
116
|
end
|
123
117
|
|
124
118
|
# Get our note GUID-to-filename map
|
@@ -173,10 +167,12 @@ class Hugo < Output
|
|
173
167
|
# Update tags, for now set categories to the same
|
174
168
|
frontmatter['tags'] = note.tagNames
|
175
169
|
frontmatter['categories'] = note.tagNames
|
170
|
+
# Set custom frontmatter
|
171
|
+
custom_fm.each do |k,v|
|
172
|
+
frontmatter[k] = v
|
173
|
+
end
|
176
174
|
# Set slug to work around https://github.com/spf13/hugo/issues/1017
|
177
|
-
frontmatter['slug'] = slug ? slug : note.title.downcase.gsub(/\W+/, "-").gsub(/^-+/, "").gsub(/-+$/, "")
|
178
|
-
# Set main menu tag if needed
|
179
|
-
frontmatter['menu'] = 'main' if inmainmenu
|
175
|
+
frontmatter['slug'] = custom_fm['slug'] ? custom_fm['slug'] : note.title.downcase.gsub(/\W+/, "-").gsub(/^-+/, "").gsub(/-+$/, "")
|
180
176
|
break
|
181
177
|
elsif output =~ /ERROR: \S+ (.+) already exists/
|
182
178
|
# Get the full filename as reported by Hugo
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enwrite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diego Zamboni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|