middleman-plaintext 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/middleman-plaintext/extension.rb +2 -1
- data/lib/middleman-plaintext/version.rb +1 -1
- 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: 9399fbd5517fd246964c7041c70b880b1f4aac10
|
4
|
+
data.tar.gz: b831625b4a2973f1f3db401f84ddbc1f3948f6b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbb0592f76780922f7005913f9deb82e05459bf82b326a48c46c668b3ec04e50f5d1de9bbb1c0b42bfb46dafad386e0c453421a5fbfa230331749f215acf643c
|
7
|
+
data.tar.gz: 42935ca55e4d2c12655274a38b12b90cf56fae16ec12d6c2c0a56db737d980ea302376aea009becd93a41413bf6fe363fab11e60324b5d7c8437d92fbef9b90c
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Generate plaintext versions of resources. Inspired heavily by John Gruber at [daring fireball][], displaying the raw markdown used to generate a post by appending `.text` to the URL. (eg, <http://daringfireball.net/2010/07/improved_regex_for_matching_urls.text>)
|
4
4
|
|
5
|
+
[daring fireball]: https://daringfireball.net/
|
6
|
+
|
5
7
|
## Usage
|
6
8
|
|
7
9
|
Out of the box the extension expects `layout/layout.text.erb` to be the layout for plaintext rendering of resources, and it also will ignore all resources.
|
@@ -23,6 +25,8 @@ A slightly more real-world example overrides the template name, and only "plaint
|
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
28
|
+
You can also change the output filename with the `filename` option. Defaults to `index.text`.
|
29
|
+
|
26
30
|
## Helpful things to know
|
27
31
|
|
28
32
|
* Current resource is `current_page` in the layout as usual
|
@@ -33,3 +37,13 @@ A slightly more real-world example overrides the template name, and only "plaint
|
|
33
37
|
* Render the source file completely raw, without the frontmatter
|
34
38
|
|
35
39
|
Middleman::FileRenderer.new(@app, current_page.file_descriptor[:full_path].to_s).template_data_for_file
|
40
|
+
|
41
|
+
## Changelog
|
42
|
+
|
43
|
+
### v0.8.1
|
44
|
+
|
45
|
+
* Turn output filename into an option, `filename`
|
46
|
+
|
47
|
+
### v0.8.0
|
48
|
+
|
49
|
+
* Initial release. Generates index.text files based on handler with specified layout.
|
@@ -4,6 +4,7 @@ require "middleman-core"
|
|
4
4
|
module Middleman
|
5
5
|
class PlaintextExtension < Extension
|
6
6
|
|
7
|
+
option :filename, "index.text", "Name of file to output plaintext in"
|
7
8
|
option :layout, "layout.text", "Layout to use for text file"
|
8
9
|
option :handle_file, -> (resource) { false }, "block to decide whether to plaintext a resource"
|
9
10
|
|
@@ -23,7 +24,7 @@ module Middleman
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def textify(resource)
|
26
|
-
to = resource.destination_path.sub("/index.html", "
|
27
|
+
to = resource.destination_path.sub("/index.html", "/#{options[:filename]}")
|
27
28
|
source = resource.file_descriptor[:full_path].to_s
|
28
29
|
|
29
30
|
::Middleman::Sitemap::Resource.new(app.sitemap, to, source).tap do |r|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-plaintext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caius Durling
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|