jekyll-code-example-tag 0.0.1 → 0.0.2

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: cc6b3dbb5ed6465f5d964a2f14f42ee6024337a2
4
- data.tar.gz: 92deaf1d6c1133049877ea597c0c6fe28a0d67c9
3
+ metadata.gz: 3d2568731b120b0d05ce63de4c9eb9b5491359bf
4
+ data.tar.gz: e79cee683707cfa4fb444d8ba24d15516406e3d3
5
5
  SHA512:
6
- metadata.gz: 0c8f4f1d2cd4464713302dddb000755e6b32e14e86e38563cc64a7138a39102b3597b8b193544f5d253594b14edf049bda29002243070a976d87f6c7cca827cf
7
- data.tar.gz: fcae7f05e3ada2e1564c13adefd5b49dcc420fe0b8dad4a9c5de007146088cd753e31b98fb2c6bcd508aae644bcacd586ccd293d020e1a8be49eda861967a8b9
6
+ metadata.gz: c6fce169023e9390a079856ee410830e61cdf68d1a0684a0cff2d550d477bddcff1c45241ffce919d830f851389f0881961fcb094579845bbdb3cc6af2ba1937
7
+ data.tar.gz: fdf58c54050e0b968b7e46a53862114188c9d0525b56b896b05fe28162f3c9e3572f9597d2f1cb1ec9d448d5fc1ad1aadcc703246571ee5e394a59373fd261c0
data/README.md CHANGED
@@ -1 +1,122 @@
1
- Stuff!
1
+ jekyll-code-example-tag
2
+ =======================
3
+
4
+ Provides a tag that allows you to include in your posts and pages code examples
5
+ for multiple langagues that are kept in seperate files. Another tag allows you
6
+ to combine all code examples that are on a page.
7
+
8
+ ## Installation
9
+
10
+ Add the following to your application's Gemfile:
11
+
12
+ gem 'jekyll-code-example-tag'
13
+
14
+ and then execute:
15
+
16
+ bundle install
17
+
18
+ Or install it manually:
19
+
20
+ gem install jekyll-code-example-tag
21
+
22
+ ## Usage
23
+
24
+ ### code_example
25
+
26
+ First, select a folder to place your code examples in. By default, the top
27
+ level folder `code_examples` will be used. If you would like to store your
28
+ examples in a different folder, than create and set a `code_example_dir`
29
+ setting in your _config.yaml:
30
+
31
+ code_example_dir: assets/code/examples
32
+
33
+ Now, add some code examples. Create folders for each language you would like to
34
+ provide a code example for. Then, add files to each language folder that
35
+ contain language appropriate code examples.
36
+
37
+ For example, say we would like to include some Hello World examples in Ruby and
38
+ Python. First, assuming we are using the default code examples directory, we
39
+ would add the following to your project:
40
+
41
+ .
42
+ |-code_examples
43
+ |-ruby
44
+ |-hello_world
45
+ |-python
46
+ |-hello_world
47
+
48
+ `ruby/hello_world` could contain
49
+
50
+ puts "Hello World"
51
+
52
+ while `python/hello_world` could contain
53
+
54
+ print "Hello World"
55
+
56
+ Now, create a post that includes these code examples. Include a code example in
57
+ a page or posting with the *code_example* tag:
58
+
59
+ ---
60
+ title: Starting to Program
61
+ ---
62
+
63
+ Here is everybody's favorite first program, in Ruby and Python.
64
+
65
+ {% code_example hello_world %}
66
+
67
+ Build your site, and you will find a page that contains the following markup:
68
+
69
+ <p>Here is everybody's favorite first program, in Ruby and Python.</p>
70
+
71
+ <div class="code-examples">
72
+ <div class="buttons examples">
73
+ <ul>
74
+ <li><a href="#" class="button active" target="Python">Python</a></li>
75
+ <li><a href="#" class="button" target="ruby">Ruby</a></li>
76
+ </ul>
77
+ </div>
78
+ <div class="highlight example python" style="display: block;">
79
+ <pre><code class="language-python" data-lang="python">print "Hello World"</code></pre>
80
+ </div>
81
+ <div class="highlight example ruby" style="display: none;">
82
+ <pre><code class="language-ruby" data-lang="ruby">puts "Hello World"</code></pre>
83
+ </div>
84
+ </div>
85
+
86
+ The *code_example* tag will search the folders in your code examples directory
87
+ for files that match whatever string is given to it, and will include only
88
+ languages/files that match it. Thus, if you add a `goodbye_world` example in
89
+ just Ruby:
90
+
91
+ .
92
+ |-code_examples
93
+ |-ruby
94
+ |-goodbye_world
95
+ |-hello_world
96
+ |-python
97
+ |-hello_world
98
+
99
+ and include it in a post:
100
+
101
+ {% code_example goodbye_world %}
102
+
103
+ the resulting markup will include just the Ruby example:
104
+
105
+ <div class="code-examples">
106
+ <div class="buttons examples">
107
+ <ul>
108
+ <li><a href="#" class="button" target="ruby">Ruby</a></li>
109
+ </ul>
110
+ </div>
111
+ <div class="highlight example ruby" style="display: none;">
112
+ <pre><code class="language-ruby" data-lang="ruby">puts "Goodbye World"</code></pre>
113
+ </div>
114
+ </div>
115
+
116
+ ### all_page_code_examples
117
+
118
+ If you have included a few code examples on a page via the *code_example* tag,
119
+ you can provide your readers with an easy to copy version of all of your
120
+ examples by using the *all_page_code_examples* tag:
121
+
122
+ {% all_page_code_examples %}
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jekyll-code-example-tag'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.date = '2015-02-03'
5
5
  s.authors = ['GovDelivery']
6
6
  s.email = 'support@govdelivery.com'
7
- s.homepage = 'http://govdelivery.com'
7
+ s.homepage = 'https://github.com/govdelivery/jekyll-code-example-tag'
8
8
  s.license = 'BSD-3-Clause'
9
9
  s.summary = 'Tags for including code examples in posts and pages.'
10
10
  s.description = %q{Provides a tag that allows you to include in your posts
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-code-example-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GovDelivery
@@ -37,7 +37,7 @@ files:
37
37
  - README.md
38
38
  - jekyll-code-example-tag.gemspec
39
39
  - lib/jekyll-code-example-tag.rb
40
- homepage: http://govdelivery.com
40
+ homepage: https://github.com/govdelivery/jekyll-code-example-tag
41
41
  licenses:
42
42
  - BSD-3-Clause
43
43
  metadata: {}