jekyll-asciinema 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0fec16e3b8f4279602c8eddf9b6c18e95e7b7287
4
+ data.tar.gz: 808218e98114519a1ac699715e7ac4b3a65a83fd
5
+ SHA512:
6
+ metadata.gz: e510afc455b0be5900d065523fb1c82abc9e3ffa92c50c76f1904897d140077d14dd69dcd605074283fc8ca0b5260b6b93af9ec9fc4fef7d8e755b9e6e6d7a75
7
+ data.tar.gz: 85724493cf047b8b2f3a59efb093888ff54801ed5b7810c28cb1b48eb8a43fedbec8cc0d1e669bea47504ce9aaef41973fdd1c3ef8580025bc33e17fe996cce0
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1 @@
1
+ ruby-2.2.1
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ before_install: gem install bundler
3
+ rvm:
4
+ - 2.1
5
+ - 2.0
6
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'coveralls', require: false
7
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Matthias Nuessler
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ # Jekyll::Asciinema
2
+
3
+ [![Build Status][badge-travis]][travis]
4
+ [![Coverage Status][badge-coveralls]][coveralls]
5
+
6
+ Provides a [Liquid][liquid] tag for embedding asciicasts recorded with
7
+ [asciinema][asciinema] for use in [Jekyll][jekyll] sites.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'jekyll-asciinema'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install jekyll-asciinema
24
+
25
+ ## Usage
26
+
27
+ Use the tag as follow in your Jekyll pages and posts:
28
+
29
+ {% asciicast 123 %}
30
+
31
+ This will create the associated script tag:
32
+
33
+ <script type="text/javascript" src="https://asciinema.org/a/123.js" id="asciicast-123" async="async"></script>
34
+
35
+ Replace "123" with the real ID of the asciicast to embed.
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies.
40
+ Then, run `bin/console` for an interactive prompt that will allow you
41
+ to experiment.
42
+
43
+ To install this gem onto your local machine, run `bundle exec rake
44
+ install`. To release a new version, update the version number in
45
+ `version.rb`, and then run `bundle exec rake release` to create a git
46
+ tag for the version, push git commits and tags, and push the `.gem`
47
+ file to [rubygems.org](https://rubygems.org).
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it ( https://github.com/mnuessler/jekyll-asciinema/fork )
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create a new Pull Request
56
+
57
+
58
+ [badge-travis]: https://travis-ci.org/mnuessler/jekyll-asciinema.svg?branch=master
59
+ [badge-coveralls]: https://coveralls.io/repos/mnuessler/jekyll-asciinema/badge.svg
60
+ [travis]: https://travis-ci.org/mnuessler/jekyll-asciinema
61
+ [coveralls]: https://coveralls.io/r/mnuessler/jekyll-asciinema
62
+ [liquid]: http://liquidmarkup.org "Liquid templating language"
63
+ [asciinema]: https://asciinema.org "Asciinema"
64
+ [jekyll]: http://jekyllrb.com "Jekyll"
@@ -0,0 +1,14 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "rake/clean"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ # Execute tests per default
8
+ task :default => :spec
9
+
10
+ # The 'clobber' task removes the final product, compared to the
11
+ # 'clean' task which removes which removes all intermedidate files but
12
+ # not the final product.
13
+ CLEAN.include("pkg/*").exclude("pkg/*.gem")
14
+ CLOBBER << "pkg/jekyll-asciinema-#{Jekyll::Asciinema::VERSION}.gem"
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'bundler' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('bundler', 'bundler')
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jekyll/asciinema"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll/asciinema/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jekyll-asciinema"
8
+ spec.version = Jekyll::Asciinema::VERSION
9
+ spec.authors = ["Matthias Nüßler"]
10
+ spec.email = ["m.nuessler@web.de"]
11
+
12
+ spec.summary = %q{Liquid tag for embedding asciicasts in Jekyll sites.}
13
+ spec.description =
14
+ %q{Provides a Liquid tag for embedding asciicasts recorded with asciinema for use in Jekyll sites.}
15
+ spec.homepage = "https://github.com/mnuessler/jekyll-asciinema"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.8"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "jekyll", "~> 2.0"
27
+ spec.add_development_dependency "pry"
28
+ end
@@ -0,0 +1,7 @@
1
+ require "jekyll/asciinema/version"
2
+ require "jekyll/asciinema/asciicast_tag"
3
+
4
+ module Jekyll
5
+ module Asciinema
6
+ end
7
+ end
@@ -0,0 +1,36 @@
1
+ require 'jekyll'
2
+
3
+ module Jekyll
4
+ module Asciinema
5
+ class AsciicastTag < Liquid::Tag
6
+ def render(context)
7
+ if tag_contents = parse_tag(@markup.strip)
8
+ asciicast_id = tag_contents[0]
9
+ render_tag(asciicast_id)
10
+ else
11
+ raise ArgumentError.new <<-EOS.gsub(/^ {12}/, '')
12
+ Syntax error in tag 'asciicast' while parsing the following markup:
13
+
14
+ #{@markup}
15
+
16
+ Valid syntax:
17
+ {% asciicast 123456 %}
18
+ EOS
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def parse_tag(input)
25
+ matched = input.match(/\A\s*(\d+)\s*\Z/)
26
+ [matched[1].strip] if matched && matched.length >= 2
27
+ end
28
+
29
+ def render_tag(asciicast_id)
30
+ %Q{<script type="text/javascript" src="https://asciinema.org/a/#{asciicast_id}.js" id="asciicast-#{asciicast_id}" async="async"></script>}
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ Liquid::Template.register_tag('asciicast', Jekyll::Asciinema::AsciicastTag)
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Asciinema
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-asciinema
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthias Nüßler
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-03-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
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: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Provides a Liquid tag for embedding asciicasts recorded with asciinema
84
+ for use in Jekyll sites.
85
+ email:
86
+ - m.nuessler@web.de
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".ruby-version"
94
+ - ".travis.yml"
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/bundler
100
+ - bin/console
101
+ - bin/rake
102
+ - bin/setup
103
+ - jekyll-asciinema.gemspec
104
+ - lib/jekyll-asciinema.rb
105
+ - lib/jekyll/asciinema/asciicast_tag.rb
106
+ - lib/jekyll/asciinema/version.rb
107
+ homepage: https://github.com/mnuessler/jekyll-asciinema
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.4.6
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Liquid tag for embedding asciicasts in Jekyll sites.
131
+ test_files: []