octopress-render-code 1.0.3 → 1.0.4
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 +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +57 -6
- data/lib/octopress-render-code.rb +14 -0
- data/lib/octopress-render-code/version.rb +1 -1
- metadata +3 -17
- data/.gitignore +0 -21
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/Rakefile +0 -7
- data/octopress-render-code.gemspec +0 -24
- data/test/.gitignore +0 -1
- data/test/Gemfile +0 -7
- data/test/_config.yml +0 -9
- data/test/_plugins/render-code.rb +0 -1
- data/test/downloads/code/tricks.coffee +0 -5
- data/test/expected.html +0 -12
- data/test/index.md +0 -6
- data/test/test.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6de4c8e2a679a77fd83ef479d359ee22acb0d0e
|
4
|
+
data.tar.gz: ed98d7a3f464cab57646c4dc48e62bc7e02549f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11cc8edaa2f56562b9d87cbd689a29b24f02251606a8d60d5fe7221df4d610dc133697087d3dfaf841d07b1ea8ebaf2760fa4ff778239a074554275cfb80bafe
|
7
|
+
data.tar.gz: 4c2337ce38d41c0850aec7e2d4a4b55ab69df6f6bd653ae8b84be294db6ca1fbc55077b1733d2ceb3fcae6b2b45a019f6a48fe10d5d6756d1ce42d9aeb0d1884
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,26 +1,77 @@
|
|
1
1
|
# Octopress Render Code
|
2
2
|
|
3
|
-
|
3
|
+
Embed code snippets from the file system in your Jekyll site.
|
4
4
|
|
5
5
|
[](https://travis-ci.org/octopress/render-code)
|
6
|
+
[](http://badge.fury.io/rb/octopress-render-code)
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
9
|
-
|
10
|
+
### Using Bundler
|
10
11
|
|
11
|
-
|
12
|
+
Add this gem to your site's Gemfile in the `:jekyll_plugins` group:
|
12
13
|
|
13
|
-
|
14
|
+
group :jekyll_plugins do
|
15
|
+
gem 'octopress-render-code'
|
16
|
+
end
|
17
|
+
|
18
|
+
Then install the gem with Bundler
|
14
19
|
|
15
20
|
$ bundle
|
16
21
|
|
17
|
-
|
22
|
+
### Manual Installation
|
18
23
|
|
19
24
|
$ gem install octopress-render-code
|
20
25
|
|
26
|
+
Then add the gem to your Jekyll configuration.
|
27
|
+
|
28
|
+
gems:
|
29
|
+
-octopress-render-code
|
30
|
+
|
21
31
|
## Usage
|
22
32
|
|
23
|
-
|
33
|
+
{% render_code <FILE> [options] %}
|
34
|
+
|
35
|
+
### Configuration
|
36
|
+
|
37
|
+
In your site's configuration, you can set the directory for embedded code samples.
|
38
|
+
|
39
|
+
<!-- title:"In _config.yml" -->
|
40
|
+
```
|
41
|
+
code_dir: code-examples
|
42
|
+
```
|
43
|
+
|
44
|
+
The default directory is 'downloads/code'
|
45
|
+
|
46
|
+
### Options
|
47
|
+
|
48
|
+
Note that order does not matter.
|
49
|
+
|
50
|
+
| Options | Example | Description |
|
51
|
+
|:-------------|:-----------------------|:----------------------------------------------------------------------|
|
52
|
+
|`lang` | `lang:ruby` | Defaults to guessing from file name extension. |
|
53
|
+
|`title` | `title:"Figure 1.A"` | Add a figcaption title to your code block. |
|
54
|
+
|`link_text` | `link_text:"Download"` | Text for the link, default: `"Raw code"`. |
|
55
|
+
|`linenos` | `lineos:false` | Disable line numbering. |
|
56
|
+
|`start` | `start:5` | Start embedding the script from the 5th line number. |
|
57
|
+
|`end` | `end:15` | Stop embedding the script after 15th line number. |
|
58
|
+
|`range` | `range:5-15` | Embed lines 5-15 of the script. |
|
59
|
+
|`mark` | `mark:5-7,10` | Highlight lines of code. This example marks lines 5,6,7 and 10. |
|
60
|
+
|`class` | `class:"solution"` | Add CSS class name(s) to the code `<figure>` element. |
|
61
|
+
|
62
|
+
### Example
|
63
|
+
|
64
|
+
Given the existence of a file
|
65
|
+
|
66
|
+
```
|
67
|
+
{% render figure-1-a.js title:"Figure A: A Simple AJAX Request." mark:5-8
|
68
|
+
```
|
69
|
+
|
70
|
+
This will
|
71
|
+
|
72
|
+
- Embed and highlight a file at `[site_source]/downloads/code/figure-1-a.js`
|
73
|
+
- Give it a figcaption "Figure A: A Simple AJAX Request
|
74
|
+
- Visually mark lines 5,6,7, and 8.
|
24
75
|
|
25
76
|
## Contributing
|
26
77
|
|
@@ -95,3 +95,17 @@ end
|
|
95
95
|
|
96
96
|
Liquid::Template.register_tag('render_code', Octopress::RenderCode::Tag)
|
97
97
|
Liquid::Template.register_tag('include_code', Octopress::RenderCode::Tag)
|
98
|
+
|
99
|
+
|
100
|
+
if defined? Octopress::Docs
|
101
|
+
Octopress::Docs.add({
|
102
|
+
name: "Octopress Render Code",
|
103
|
+
gem: "octopress-render-code",
|
104
|
+
description: "Embed code snippets from the file system.",
|
105
|
+
path: File.expand_path(File.join(File.dirname(__FILE__), "../")),
|
106
|
+
type: "tag",
|
107
|
+
source_url: "https://github.com/octopress/render-code",
|
108
|
+
version: Octopress::RenderCode::VERSION
|
109
|
+
})
|
110
|
+
end
|
111
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-render-code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-code-highlighter
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: clash
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -73,25 +73,11 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- ".gitignore"
|
77
|
-
- ".rspec"
|
78
|
-
- ".travis.yml"
|
79
76
|
- CHANGELOG.md
|
80
|
-
- Gemfile
|
81
77
|
- LICENSE.txt
|
82
78
|
- README.md
|
83
|
-
- Rakefile
|
84
79
|
- lib/octopress-render-code.rb
|
85
80
|
- lib/octopress-render-code/version.rb
|
86
|
-
- octopress-render-code.gemspec
|
87
|
-
- test/.gitignore
|
88
|
-
- test/Gemfile
|
89
|
-
- test/_config.yml
|
90
|
-
- test/_plugins/render-code.rb
|
91
|
-
- test/downloads/code/tricks.coffee
|
92
|
-
- test/expected.html
|
93
|
-
- test/index.md
|
94
|
-
- test/test.rb
|
95
81
|
homepage: https://github.com/octopress/render-code
|
96
82
|
licenses:
|
97
83
|
- MIT
|
data/.gitignore
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
.DS_Store
|
19
|
-
.pygments-cache
|
20
|
-
_site
|
21
|
-
.code-highlighter-cache
|
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'octopress-render-code/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "octopress-render-code"
|
8
|
-
gem.version = Octopress::RenderCode::VERSION
|
9
|
-
gem.authors = ["Brandon Mathis"]
|
10
|
-
gem.email = ["brandon@imathis.com"]
|
11
|
-
gem.description = %q{Embed highlighted code snippets from a file.}
|
12
|
-
gem.summary = %q{Embed highlighted code snippets from a file.}
|
13
|
-
gem.homepage = "https://github.com/octopress/render-code"
|
14
|
-
gem.license = "MIT"
|
15
|
-
|
16
|
-
gem.add_runtime_dependency 'octopress-code-highlighter', '~> 4.2'
|
17
|
-
|
18
|
-
gem.add_development_dependency 'jekyll'
|
19
|
-
gem.add_development_dependency 'rake'
|
20
|
-
gem.add_development_dependency 'rspec'
|
21
|
-
|
22
|
-
gem.files = `git ls-files`.split($/)
|
23
|
-
gem.require_paths = ["lib"]
|
24
|
-
end
|
data/test/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
_site
|
data/test/Gemfile
DELETED
data/test/_config.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'octopress-render-code'
|
data/test/expected.html
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
<figure class='code-highlight-figure'><figcaption class='code-highlight-caption'><span class='code-highlight-caption-title'>Coffeescript Tricks</span></figcaption><div class='code-highlight'><pre class='code-highlight-pre'><div data-line='1' class='code-highlight-row numbered marked-line start-marked-line'><div class='code-highlight-line'># Given an alphabet:</span>
|
2
|
-
</div></div><div data-line='2' class='code-highlight-row numbered marked-line end-marked-line'><div class='code-highlight-line'><span class="nv">alphabet = </span><span class="s">'abcdefghijklmnopqrstuvwxyz'</span>
|
3
|
-
</div></div><div data-line='3' class='code-highlight-row numbered'><div class='code-highlight-line'> </div></div><div data-line='4' class='code-highlight-row numbered'><div class='code-highlight-line'><span class="c1"># Iterate over part of the alphabet:</span>
|
4
|
-
</div></div><div data-line='5' class='code-highlight-row numbered'><div class='code-highlight-line'><span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="nx">letter</span> <span class="k">for</span> <span class="nx">letter</span> <span class="k">in</span> <span class="nx">alphabet</span><span class="p">[</span><span class="mi">4</span><span class="p">..</span><span class="mi">8</span><span class="p">]</span></div></div></pre></div></figure>
|
5
|
-
|
6
|
-
<figure class='code-highlight-figure'><figcaption class='code-highlight-caption'><span class='code-highlight-caption-title'>Coffeescript Tricks</span></figcaption><div class='code-highlight'><pre class='code-highlight-pre'><div data-line='1' class='code-highlight-row numbered'><div class='code-highlight-line'># Given an alphabet:</span>
|
7
|
-
</div></div><div data-line='2' class='code-highlight-row numbered'><div class='code-highlight-line'><span class="nv">alphabet = </span><span class="s">'abcdefghijklmnopqrstuvwxyz'</span>
|
8
|
-
</div></div><div data-line='3' class='code-highlight-row numbered'><div class='code-highlight-line'> </div></div><div data-line='4' class='code-highlight-row numbered'><div class='code-highlight-line'><span class="c1"># Iterate over part of the alphabet:</span>
|
9
|
-
</div></div><div data-line='5' class='code-highlight-row numbered'><div class='code-highlight-line'><span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="nx">letter</span> <span class="k">for</span> <span class="nx">letter</span> <span class="k">in</span> <span class="nx">alphabet</span><span class="p">[</span><span class="mi">4</span><span class="p">..</span><span class="mi">8</span><span class="p">]</span></div></div></pre></div></figure>
|
10
|
-
|
11
|
-
<figure class='code-highlight-figure'><figcaption class='code-highlight-caption'><span class='code-highlight-caption-title'>Coffeescript Tricks</span></figcaption><div class='code-highlight'><pre class='code-highlight-pre'><div data-line='2' class='code-highlight-row numbered'><div class='code-highlight-line'>alphabet = </span><span class="s">'abcdefghijklmnopqrstuvwxyz'</span>
|
12
|
-
</div></div><div data-line='3' class='code-highlight-row numbered'><div class='code-highlight-line'> </div></div><div data-line='4' class='code-highlight-row numbered'><div class='code-highlight-line'><span class="c1"># Iterate over part of the alphabet:</span></div></div></pre></div></figure>
|
data/test/index.md
DELETED
data/test/test.rb
DELETED