jekyll-viewsource 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfe5b3a8492efe8b96f105d0fae4520e30a61c6d
4
- data.tar.gz: d7706594cecfbcdce75868c3bba4fb05f9338aac
3
+ metadata.gz: 405f987cb2179dc287faa09164395009a4905663
4
+ data.tar.gz: f702c8e22fa490b5fec0c3125eb1b9c3b522f22d
5
5
  SHA512:
6
- metadata.gz: eeabd3bc6482ef6c6799f36a13b350a49e0fd035a872ac0523219ae18acf15bd50b0569b4315eecd3fed4b2915d29db608a2c47da783e33f0d0c2b808c7c3034
7
- data.tar.gz: 6c5b099a1edf932c4157d5f5fc7e61349b3158c2b9467e3523178a2d8fbe5493697492790f4d90da5267cbe13f14c68184609800169a0b25015e23eb6b396861
6
+ metadata.gz: 26f45da8f28d82013226db98bd0fc84e0211ce426dfc0d5668510a373555e8c71aa31e7d3cf69db8c6a453ee8d705cb2dbc3a8354b78980173a9cda3518f39b1
7
+ data.tar.gz: 633c9aebe11d17da0199469881420a99591bbf2765ecf01750271000a0ac5c0cb301dd1ccba49dc80c8ce340245413e8b9a8e521c03c3be509c59831f2921dc6
data/README.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  *Jekyll:ViewSource* is a plugin for [Jekyll](https://jekyllrb.com/) that generates plain or pretty Markdown and HTML source code pages from your content.
6
6
 
7
+ ## What's new?
8
+
9
+ *v1.0.1* Improvements to lexer; cache location; inclusion in `_config.yml`
10
+
7
11
  ## Installation
8
12
 
9
13
  Add the gem to your application's Gemfile:
@@ -126,7 +130,7 @@ e.g.
126
130
 
127
131
  ## Cache
128
132
 
129
- *ViewSource* maintains a cache in a hidden folder inside your site source: `.plugins/jekyll-viewsource`. If you encounter problems that you think may be related to the cache, you may remove this.
133
+ *ViewSource* maintains a cache in a hidden folder inside your home directory: `.jekyll-plugins/jekyll-viewsource`. If you encounter problems that you think may be related to the cache, you may remove this.
130
134
 
131
135
  ## Contributing
132
136
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "jekyll/viewsource"
4
+ require "jekyll-viewsource"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -1,7 +1,7 @@
1
1
 
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "jekyll/viewsource/version"
4
+ require "jekyll-viewsource/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "jekyll-viewsource"
@@ -1,6 +1,6 @@
1
- require 'jekyll/viewsource/constants'
2
- require 'jekyll/viewsource/cache'
3
- require 'jekyll/viewsource/renderer'
1
+ require 'jekyll-viewsource/constants'
2
+ require 'jekyll-viewsource/cache'
3
+ require 'jekyll-viewsource/renderer'
4
4
 
5
5
  module Jekyll
6
6
  module ViewSource
@@ -1,17 +1,16 @@
1
- require 'jekyll/viewsource/renderer'
1
+ require 'jekyll-viewsource/renderer'
2
2
 
3
3
  module Jekyll
4
4
  module ViewSource
5
5
 
6
6
  class Cache
7
- DEFAULT_CACHE = ".plugins/jekyll-viewsource/cache".freeze
7
+ DEFAULT_CACHE = File.join(Dir.home, '.jekyll-plugins', 'jekyll-viewsource', 'cache').freeze
8
8
 
9
9
  def self.setup(site, cache)
10
10
  @site = site
11
11
 
12
12
  if cache
13
- @cache_dir = File.join(@site.source,
14
- (cache.is_a?(String) ? cache : DEFAULT_CACHE))
13
+ @cache_dir = (cache.is_a?(String) ? cache : DEFAULT_CACHE)
15
14
 
16
15
  ViewSource.debug 'startup', "Setting up cache at #{@cache_dir}" if Renderer.first_run
17
16
 
@@ -0,0 +1,62 @@
1
+ require 'rouge'
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class ViewSource < Markdown
6
+ tag 'viewsource'
7
+
8
+ def liquid
9
+ @liquid ||= Liquid.new(options)
10
+ end
11
+
12
+ def javascript
13
+ @javascript ||= Javascript.new(options)
14
+ end
15
+
16
+ def html
17
+ @html ||= HTML.new(options)
18
+ end
19
+
20
+ prepend :root do
21
+ rule(%r[\s*(?<!:)//.*?$]) { delegate javascript }
22
+ rule(%r(\s*/[*].*?[*]/\s*)m) { delegate javascript }
23
+
24
+ rule(%r(\s*<!--.*?-->\s*)m) { delegate html }
25
+
26
+ rule %r(({%)(\s*)(macro)(\s+)(/.*?/\S*)(\s*)({)) do
27
+ groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Str::Double, Text::Whitespace, Punctuation
28
+ end
29
+
30
+ rule %r((})(\s*)(%})) do
31
+ groups Punctuation, Text::Whitespace, Punctuation
32
+ end
33
+
34
+ rule %r(({%)(\s*)(constant)(\s+)(\S+)(\s*)(=?)(\s*)(['"]?)(.*?)(['"]?)(\s*)(%})) do
35
+ groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace,
36
+ Name::Attribute, Text::Whitespace, Punctuation, Text::Whitespace,
37
+ Punctuation, Str::Double, Punctuation, Text::Whitespace, Punctuation
38
+ end
39
+
40
+ rule %r((\s*)({%)(\s*)(hashkeys)(\s+)(\S+)(\s*)(%})) do
41
+ groups Text::Whitespace, Punctuation, Text::Whitespace, Name::Tag,
42
+ Text::Whitespace, Name::Attribute, Text::Whitespace, Punctuation
43
+ end
44
+
45
+ rule %r((\s*)({%)(\s*)(hashkeys)(\s+)(\S+)(\s*)({)(.*?)(})(\s*)(%})) do
46
+ groups Text::Whitespace, Punctuation, Text::Whitespace,
47
+ Name::Tag, Text::Whitespace, Name::Attribute, Text::Whitespace,
48
+ Punctuation, Text, Punctuation, Text::Whitespace, Punctuation
49
+ end
50
+
51
+ rule %r(({%)(\s*)(project)(\s*)(.*?)(\s*)(%})) do
52
+ groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Text,
53
+ Text::Whitespace, Punctuation
54
+ end
55
+
56
+ rule(%r(.*?{%.*?%}.?)) { delegate liquid }
57
+ rule(%r(.*{{.*?}}.?)) { delegate liquid }
58
+ end
59
+
60
+ end
61
+ end
62
+ end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module ViewSource
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-viewsource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Ibrado
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-17 00:00:00.000000000 Z
11
+ date: 2018-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -119,13 +119,13 @@ files:
119
119
  - bin/console
120
120
  - bin/setup
121
121
  - jekyll-viewsource.gemspec
122
- - lib/jekyll/viewsource.rb
123
- - lib/jekyll/viewsource/cache.rb
124
- - lib/jekyll/viewsource/constants.rb
125
- - lib/jekyll/viewsource/lexer.rb
126
- - lib/jekyll/viewsource/renderer.rb
127
- - lib/jekyll/viewsource/utils.rb
128
- - lib/jekyll/viewsource/version.rb
122
+ - lib/jekyll-viewsource.rb
123
+ - lib/jekyll-viewsource/cache.rb
124
+ - lib/jekyll-viewsource/constants.rb
125
+ - lib/jekyll-viewsource/lexer.rb
126
+ - lib/jekyll-viewsource/renderer.rb
127
+ - lib/jekyll-viewsource/utils.rb
128
+ - lib/jekyll-viewsource/version.rb
129
129
  homepage: https://github.com/ibrado/jekyll-viewsource
130
130
  licenses:
131
131
  - MIT
@@ -1,32 +0,0 @@
1
- require 'rouge'
2
-
3
- module Rouge
4
- module Lexers
5
- class ViewSource < Markdown
6
- tag 'viewsource'
7
-
8
- def liquid
9
- @liquid ||= Liquid.new(options)
10
- end
11
-
12
- def javascript
13
- @javascript ||= Javascript.new(options)
14
- end
15
-
16
- def html
17
- @html ||= HTML.new(options)
18
- end
19
-
20
- prepend :root do
21
- rule(%r[\s*(?<!:)//.*?$]) { delegate javascript }
22
- rule(%r(\s*/[*].*?[*]/\s*)m) { delegate javascript }
23
-
24
- rule(%r(.*?%}.?)) { delegate liquid }
25
- rule(%r(.*{{.*?}}.?)) { delegate liquid }
26
-
27
- rule(%r(\s*<!--.*?-->\s*)m) { delegate html }
28
- end
29
-
30
- end
31
- end
32
- end