octopress-render-code 1.0.3 → 1.0.4

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: 4a2cce1d5ad9923f037c06ecef99302289ec00c6
4
- data.tar.gz: 4613024760176101dbecce7b667506b01079bdca
3
+ metadata.gz: c6de4c8e2a679a77fd83ef479d359ee22acb0d0e
4
+ data.tar.gz: ed98d7a3f464cab57646c4dc48e62bc7e02549f8
5
5
  SHA512:
6
- metadata.gz: c9563775cfe8a3d3755529186387b0ecb2261d61cf5ea673c7eff3a142bf47f3091abbdcea4078abfeb7b47ee4663041a684473dae61477d2470888b0ccd0768
7
- data.tar.gz: 61067cf15889b6e0c07b753c7c453c8587545c712081bfa573b158e31abe887c8fc199a54d23e32713bebf54c410ed1e67f1c21777f1e005fe78a77b8d4b4b43
6
+ metadata.gz: 11cc8edaa2f56562b9d87cbd689a29b24f02251606a8d60d5fe7221df4d610dc133697087d3dfaf841d07b1ea8ebaf2760fa4ff778239a074554275cfb80bafe
7
+ data.tar.gz: 4c2337ce38d41c0850aec7e2d4a4b55ab69df6f6bd653ae8b84be294db6ca1fbc55077b1733d2ceb3fcae6b2b45a019f6a48fe10d5d6756d1ce42d9aeb0d1884
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## 1.0.2 - 2014-06-25
3
+ ## 1.0.4 - 2015-01-05
4
+
5
+ - Added usage documentation to the Readme.
6
+ - Now supporting Octopress docs.
7
+
8
+ ## 1.0.3 - 2014-06-25
4
9
  - Updated to the latest octopress-code-highlighter.
5
10
 
6
11
  ## 1.0.2 - 2014-06-25
data/README.md CHANGED
@@ -1,26 +1,77 @@
1
1
  # Octopress Render Code
2
2
 
3
- Write beautiful code snippets within any template.
3
+ Embed code snippets from the file system in your Jekyll site.
4
4
 
5
5
  [![Build Status](https://travis-ci.org/octopress/render-code.png?branch=master)](https://travis-ci.org/octopress/render-code)
6
+ [![Gem Version](https://badge.fury.io/rb/octopress-render-code.png)](http://badge.fury.io/rb/octopress-render-code)
6
7
 
7
8
  ## Installation
8
9
 
9
- Add this line to your application's Gemfile:
10
+ ### Using Bundler
10
11
 
11
- gem 'octopress-render-code'
12
+ Add this gem to your site's Gemfile in the `:jekyll_plugins` group:
12
13
 
13
- And then execute:
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
- Or install it yourself as:
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
- TODO: Write usage instructions here
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
+
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module RenderCode
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
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.3
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: 2014-06-29 00:00:00.000000000 Z
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: rspec
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
@@ -1,2 +0,0 @@
1
- --color
2
- --format progress
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 1.9.3
5
- script: cd test && bundle exec ruby test.rb
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in octopress-codefence.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
7
- task :test => :spec
@@ -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
@@ -1 +0,0 @@
1
- _site
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'pry-debugger'
4
- gem 'jekyll'
5
- gem 'jekyll-page-hooks'
6
- gem 'octopress-code-highlighter', :path => '../../code-highlighter'
7
- gem 'octopress-render-code', :path => '../'
@@ -1,9 +0,0 @@
1
- name: Your New Jekyll Site
2
- markdown: redcarpet
3
- highlighter: pygments
4
- exclude:
5
- - Gemfile*
6
- - expected.html
7
- - test.rb
8
- pygments_aliases:
9
- abc: ruby
@@ -1 +0,0 @@
1
- require 'octopress-render-code'
@@ -1,5 +0,0 @@
1
- # Given an alphabet:
2
- alphabet = 'abcdefghijklmnopqrstuvwxyz'
3
-
4
- # Iterate over part of the alphabet:
5
- console.log letter for letter in alphabet[4..8]
@@ -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">&#39;abcdefghijklmnopqrstuvwxyz&#39;</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">&#39;abcdefghijklmnopqrstuvwxyz&#39;</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">&#39;abcdefghijklmnopqrstuvwxyz&#39;</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>
@@ -1,6 +0,0 @@
1
- ---
2
- ---
3
-
4
- {% render_code Coffeescript Tricks tricks.coffee mark:1,2 %}
5
- {% render_code tricks.coffee Coffeescript Tricks link_text:"Download"%}
6
- {% render_code tricks.coffee Coffeescript Tricks range:2-4 %}
@@ -1,3 +0,0 @@
1
- system('jekyll build')
2
- diff = `diff _site/index.html expected.html`
3
- abort "Filed with diff: #{diff}" if diff.size > 0