nanoc-conref-fs 0.0.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c521a9f295c33c7aa6f4dc47ca92045539c467e5
4
- data.tar.gz: 42ac9a18696599fd0f298899f48b7f6b4484bd3f
3
+ metadata.gz: 3b9b74d13a2d5e87fcc3a90d5072c25ad3dd82b2
4
+ data.tar.gz: 0a943c2e008ecd7b8f22e0b4fc4f7fcac64e867e
5
5
  SHA512:
6
- metadata.gz: 3fad6cd16943d5e3b4cbda7579d7c0cc6b3b30b0ddf7194a9a198d2d2f01138ed564c3b353d510e78076f7b5c11fe35a088e06cf1332c7d0e1f883fb2525dd12
7
- data.tar.gz: ca660bcfaf0287c737ff8a50186d61196cae39b39861fffbb4925f62a2539e1cfa0a56d79c2ccd0bd71815a125a4c41e143e2dde2c9314cf52cb314e3221c7f5
6
+ metadata.gz: 51ce48cb1edf56f86eb87d398c8626ab38e437c9b41b790e9274624d666cfe254aaf41453fc9738b90363077144f6eed0533d249c01d70d9f23c627e9d4ee5cd
7
+ data.tar.gz: 1414c576b31ece94c1bc30c38e56b3a443a02407c0b75b6eb3b6783f351665134ee861dc391222d5057d81592858c732eb0c77d55496bfa7a6f3945d5d4050c9
data/README.md CHANGED
@@ -6,6 +6,21 @@ The idea is that you have a set of YAML files in a data folder which act as your
6
6
 
7
7
  [![Build Status](https://travis-ci.org/gjtorikian/nanoc-conref-fs.svg)](https://travis-ci.org/gjtorikian/nanoc-conref-fs)
8
8
 
9
+ **NOTE:** If you use this library with nanoc's ERB filter, and want to use `render`, you'll need to monkey-patch an alias to avoid conflicts:
10
+
11
+ ``` ruby
12
+ require 'nanoc-conref-fs'
13
+ include Nanoc::Helpers::Rendering
14
+ Nanoc::Helpers::Rendering.module_eval do
15
+ if respond_to? :render
16
+ alias_method :renderp, :render
17
+ remove_method :render
18
+ end
19
+ end
20
+ ```
21
+
22
+ Then, use `renderp` instead of `render`.
23
+
9
24
  ## Usage
10
25
 
11
26
  Nearly all the usage of this gem relies on a *data* folder, sibling to your *content* and *layouts* folders. See [the test fixture](test/fixtures/data) for an example.
@@ -8,8 +8,10 @@ class ConrefFS < Nanoc::DataSource
8
8
  # Before iterating over the file objects, this method loads the data folder
9
9
  # and applies to to an ivar for later usage.
10
10
  def load_objects(dir_name, kind, klass)
11
- data = Datafiles.process(@site_config)
12
- @vars = { 'site' => { 'config' => @site_config.to_h, 'data' => data } }
11
+ if klass == Nanoc::Int::Item && @vars.nil?
12
+ data = Datafiles.process(@site_config)
13
+ @vars = { 'site' => { 'config' => @site_config.to_h, 'data' => data } }
14
+ end
13
15
  super
14
16
  end
15
17
 
@@ -65,12 +67,15 @@ class ConrefFS < Nanoc::DataSource
65
67
  data = File.read(filename)
66
68
  return data unless filename.start_with?('content')
67
69
 
70
+ # we must obfuscate essential ExtendedMarkdownFilter content
71
+ data = data.gsub(/\{\{#/, '[[#').gsub(/\{\{ octicon-/, '[[ octicon-')
68
72
  # This first pass converts the frontmatter variables,
69
73
  # and inserts data variables into the body
70
74
  result = Conrefifier.apply_liquid(data, page_vars)
71
75
  # This second application renders the previously inserted
72
76
  # data conditionals within the body
73
77
  result = Conrefifier.apply_liquid(result, page_vars)
78
+ result.gsub('[[#', '{{#').gsub('{{ octicon-', '[[ octicon-')
74
79
  rescue => e
75
80
  raise RuntimeError.new("Could not read #{filename}: #{e.inspect}")
76
81
  end
@@ -1,5 +1,4 @@
1
1
  require 'yaml'
2
- require 'active_support'
3
2
  require 'active_support/core_ext/hash'
4
3
 
5
4
  require_relative 'conrefifier'
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'nanoc-conref-fs'
6
- spec.version = '0.0.1'
6
+ spec.version = '0.1.0'
7
7
  spec.authors = ['Garen Torikian']
8
8
  spec.email = ['gjtorikian@gmail.com']
9
9
  spec.summary = 'A Nanoc filesystem to permit using conrefs/reusables in your content.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-conref-fs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nanoc