octopress-codefence 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +3 -0
- data/README.md +8 -5
- data/lib/octopress-codefence.rb +12 -22
- data/lib/octopress-codefence/version.rb +1 -1
- data/octopress-codefence.gemspec +1 -4
- metadata +6 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf168abaf067cae3f00fcce33588f6d15488b69c
|
4
|
+
data.tar.gz: 13a35b2a962d82286047b53752c23c6adbffd65e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9c88d260cca26c010d31846be0d5dfe320b3718b1bf6ece49f59827b6f1cb1fc04c9a674b21495a07df8bdae9b0340107dd4f610712f4be55239929b15aa605
|
7
|
+
data.tar.gz: bf9745981705b1b8f1995187dada2531ef4aaeb52459f28e445a880e588635d0de382c771ed75899d4983498d15988fe43e0a0b64fed9c83b899f860d32949b5
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Write beautiful fenced code snippets within any template.
|
4
4
|
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/octopress-codefence.
|
6
|
-
[![Build Status](https://travis-ci.org/octopress/codefence.
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/octopress-codefence.svg)](http://badge.fury.io/rb/octopress-codefence)
|
6
|
+
[![Build Status](https://travis-ci.org/octopress/codefence.svg?branch=master)](https://travis-ci.org/octopress/codefence)
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -47,7 +47,7 @@ Note that order does not matter.
|
|
47
47
|
|`lang` | `ruby` | Used by the syntax highlighter. Passing 'plain' disables highlighting.|
|
48
48
|
|`title` | `title:"Figure 1.A"` | Add a figcaption title to your code block. |
|
49
49
|
|`link_text` | `link_text:"Download"` | Text for the link, default: `"link"`. |
|
50
|
-
|`linenos` | `
|
50
|
+
|`linenos` | `linenos:false` | Disable line numbering. |
|
51
51
|
|`start` | `start:5` | Start the line numbering at the given value. |
|
52
52
|
|`mark` | `mark:1-4,8` | Highlight lines of code. This example marks lines 1,2,3,4 and 8 |
|
53
53
|
|`class` | `class:"css example"` | Add CSS class names to the code `<figure>` element |
|
@@ -112,11 +112,14 @@ end
|
|
112
112
|
```
|
113
113
|
Here's a themed sample:
|
114
114
|
|
115
|
-
|
115
|
+
Note: This plugin does not come with stylesheets. Check out [octopress solarized](https://github.com/octopress/solarized) for styling code
|
116
|
+
snippets.
|
117
|
+
|
118
|
+
<img src="http://cl.ly/TFCm/content.svg" alt='sample screenshot of the code snippet above renderd with the light theme' width="816px">
|
116
119
|
|
117
120
|
Here's a look at the dark theme:
|
118
121
|
|
119
|
-
<img src="http://cl.ly/TFPX/content.
|
122
|
+
<img src="http://cl.ly/TFPX/content.svg" alt='sample screenshot of the code snippet above renderd with the dark theme' width="816px">
|
120
123
|
|
121
124
|
More documentation coming soon.
|
122
125
|
|
data/lib/octopress-codefence.rb
CHANGED
@@ -3,29 +3,13 @@ require 'octopress-code-highlighter'
|
|
3
3
|
|
4
4
|
module Octopress
|
5
5
|
module Codefence
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require 'octopress-hooks'
|
12
|
-
class PageHook < Hooks::Page
|
13
|
-
def pre_render(page)
|
14
|
-
page.content = Codefence::Highlighter.new(page.content, page.ext, page.site.config['code_aliases']).render
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class PostHook < Hooks::Post
|
19
|
-
def pre_render(post)
|
20
|
-
post.content = Codefence::Highlighter.new(post.content, post.ext, post.site.config['code_aliases']).render
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class DocumentHook < Hooks::Document
|
25
|
-
def pre_render(document)
|
26
|
-
document.content = Codefence::Highlighter.new(document.content).render
|
27
|
-
end
|
6
|
+
Jekyll::Hooks.register [:posts, :pages, :documents], :pre_render do |item, payload|
|
7
|
+
if item.respond_to?(:ext)
|
8
|
+
ext = item.ext
|
9
|
+
else
|
10
|
+
ext = nil
|
28
11
|
end
|
12
|
+
item.content = Codefence::Highlighter.new(item.content, ext, item.site.config['code_aliases']).render
|
29
13
|
end
|
30
14
|
|
31
15
|
class Highlighter
|
@@ -41,8 +25,14 @@ module Octopress
|
|
41
25
|
def render
|
42
26
|
@input.encode!("UTF-8")
|
43
27
|
@input = sub_option_comment(@input)
|
28
|
+
|
29
|
+
# Match code bwteen backticks
|
30
|
+
#
|
44
31
|
@input.gsub /^`{3}(.+?)`{3}/m do
|
45
32
|
str = $1.to_s
|
33
|
+
|
34
|
+
# separate code from arguments after backticks
|
35
|
+
#
|
46
36
|
str.gsub /([^\n]+)?\n(.+?)\Z/m do
|
47
37
|
markup = $1 || ''
|
48
38
|
code = $2.to_s
|
data/octopress-codefence.gemspec
CHANGED
@@ -13,14 +13,11 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.license = "MIT"
|
14
14
|
|
15
15
|
gem.add_runtime_dependency 'octopress-code-highlighter', '~> 4.2'
|
16
|
-
gem.add_runtime_dependency '
|
16
|
+
gem.add_runtime_dependency 'jekyll', '~> 3.0'
|
17
17
|
|
18
|
-
gem.add_development_dependency 'octopress'
|
19
|
-
gem.add_development_dependency 'jekyll'
|
20
18
|
gem.add_development_dependency 'clash'
|
21
19
|
gem.add_development_dependency 'rake'
|
22
20
|
gem.add_development_dependency 'rouge'
|
23
|
-
gem.add_development_dependency 'octopress-solarized'
|
24
21
|
|
25
22
|
gem.files = `git ls-files`.split($/).reject {|f| f =~ /^test\// }
|
26
23
|
gem.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-codefence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-code-highlighter
|
@@ -25,47 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: jekyll
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: octopress
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: jekyll
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
40
|
+
version: '3.0'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
42
|
name: clash
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,20 +80,6 @@ dependencies:
|
|
108
80
|
- - ">="
|
109
81
|
- !ruby/object:Gem::Version
|
110
82
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: octopress-solarized
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
83
|
description:
|
126
84
|
email:
|
127
85
|
- brandon@imathis.com
|
@@ -159,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
117
|
version: '0'
|
160
118
|
requirements: []
|
161
119
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.4.
|
120
|
+
rubygems_version: 2.4.5
|
163
121
|
signing_key:
|
164
122
|
specification_version: 4
|
165
123
|
summary: Generate beautiful code snippets with advanced features on any Jekyll site.
|