yard-pygmentsrb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in yard-pygmentsrb.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # YARD-Pygmentsrb
2
+
3
+ _This gems borrows code from nex3's [yard-pygments](https://github.com/nex3/yard-pygments)_
4
+
5
+ **yard-pygmentsrb** enables the nice Pygments syntax highlighting in [YARD](http://yardoc.org),
6
+ through [pygments.rb](https://github.com/tmm1/pygments.rb).
7
+
8
+ ## Usage
9
+
10
+ Install the gem
11
+
12
+ ```sh
13
+ gem install yard-pygmentsrb
14
+ ```
15
+
16
+ Write some code blocks in your documentation
17
+
18
+ `document.md`
19
+
20
+ ```
21
+ !!!python
22
+ def __call__(self, mom):
23
+ pass
24
+ ```
25
+
26
+ Tell YARD to generate docs using the plugin
27
+
28
+ ```sh
29
+ yard --plugin pygmentsrb document.md
30
+ ```
31
+
32
+ _And if you want YARD to always use it, write the `--plugin pygmentsrb` line to your
33
+ `.yardopts` file_
34
+
35
+ ## Requirements
36
+
37
+ None.
38
+
39
+ Obviously this gem requires YARD and pygments.rb, so you should have their
40
+ requirements met.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module YARDPygmentsrb
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,19 @@
1
+ require "yard-pygmentsrb/version"
2
+ require 'pygments.rb'
3
+ require 'yard'
4
+
5
+ YARD::Templates::Engine.register_template_path File.expand_path("../../templates", __FILE__)
6
+
7
+ module YARD::Templates::Helpers::HtmlSyntaxHighlightHelper
8
+ Pygments.lexers.map {|k,l| l[:aliases] }.each do |aliases|
9
+ class_eval <<-EOM
10
+ define_method("html_syntax_highlight_#{aliases.first}") do |source|
11
+ Pygments.highlight source, :lexer => "#{aliases.first}", :options => { :cssclass => 'pygments' }
12
+ end
13
+ EOM
14
+
15
+ aliases[1..-1].each do |lexer|
16
+ alias :"html_syntax_highlight_#{lexer}" :"html_syntax_highlight_#{aliases.first}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1 @@
1
+ <%= Pygments.css(".pygments") %>
@@ -0,0 +1,4 @@
1
+ def init
2
+ super
3
+ asset('css/pygments.css', erb(:pygments))
4
+ end
@@ -0,0 +1,2 @@
1
+ <%= superb :headers %>
2
+ <link rel="stylesheet" href="<%= url_for("css/pygments.css") %>" type="text/css" media="screen" charset="utf-8" />
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "yard-pygmentsrb/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "yard-pygmentsrb"
7
+ s.version = YARDPygmentsrb::VERSION
8
+ s.authors = ["Kiyoshi '13k' Murata"]
9
+ s.email = ["13k@linhareta.net"]
10
+ s.homepage = "http://github.com/13k/yard-pygmentsrb"
11
+ s.summary = %q{Adds pygments.rb syntax highlighting to YARD}
12
+ s.description = %q{Enables the syntax highligthing of a wide variety of languages through Pygments and its Ruby integration pygments.rb. This project borrows code from the yard-pygments gem.}
13
+
14
+ s.rubyforge_project = "yard-pygmentsrb"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_runtime_dependency "yard", "~> 0.7.5"
22
+ s.add_runtime_dependency "pygments.rb", "~> 0.2.4"
23
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yard-pygmentsrb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Kiyoshi '13k' Murata
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-25 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: yard
16
+ requirement: &7284100 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.7.5
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *7284100
25
+ - !ruby/object:Gem::Dependency
26
+ name: pygments.rb
27
+ requirement: &7283460 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.4
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *7283460
36
+ description: Enables the syntax highligthing of a wide variety of languages through
37
+ Pygments and its Ruby integration pygments.rb. This project borrows code from the
38
+ yard-pygments gem.
39
+ email:
40
+ - 13k@linhareta.net
41
+ executables: []
42
+ extensions: []
43
+ extra_rdoc_files: []
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - README.md
48
+ - Rakefile
49
+ - lib/yard-pygmentsrb.rb
50
+ - lib/yard-pygmentsrb/version.rb
51
+ - templates/default/fulldoc/html/pygments.erb
52
+ - templates/default/fulldoc/html/setup.rb
53
+ - templates/default/layout/html/headers.erb
54
+ - yard-pygmentsrb.gemspec
55
+ homepage: http://github.com/13k/yard-pygmentsrb
56
+ licenses: []
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project: yard-pygmentsrb
75
+ rubygems_version: 1.8.10
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: Adds pygments.rb syntax highlighting to YARD
79
+ test_files: []
80
+ has_rdoc: