yard-pygments 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.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ /pkg
2
+ /doc
3
+ /.yardoc
data/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ --markup markdown
2
+ --markup-provider maruku
3
+ --no-private
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Nathan Weizenbaum
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # yard-pygments
2
+
3
+ This is a plugin for the [YARD](http://yardoc.org) documentation system
4
+ that adds syntax highlighting for a wide variety of languages
5
+ using the [Pygments](http://pygments.org) syntax highlighter.
6
+
7
+ ## Usage
8
+
9
+ Once the gem is installed, YARD should automatically load it.
10
+ Then any block of code beginning with `!!!lang` that YARD doesn't recognize
11
+ will be highlighted using Pygments if possible.
12
+ Unless another highlighter is installed, in which case it might take precedence.
13
+
14
+ By default, YARD itself only recognizes Ruby.
15
+ The full list of languages recognized by Pygments is available [here](http://pygments.org/docs/lexers/).
16
+ The names that will be recognized for these languages are listed under "short names".
17
+
18
+ ## Requirements
19
+
20
+ yard-pygments requires [rb-pygments](http://github.com/nex3/rb-pygments),
21
+ which in turn requires Pygments itself.
22
+ Since Pygments is written in Python, it needs to be installed manually.
23
+ If you've got [`easy_install`](http://peak.telecommunity.com/DevCenter/EasyInstall), you can do
24
+
25
+ !!!sh
26
+ easy_install Pygments
27
+
28
+ Otherwise, it can be downloaded [here](http://pypi.python.org/pypi/Pygments).
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "yard-pygments"
8
+ gem.summary = %Q{Pygments-based syntax highlighting for YARD.}
9
+ gem.description = <<DESC
10
+ A plugin for the YARD documentation system that adds syntax highlighting
11
+ for a wide variety of languages using the Pygments highlighter.
12
+ DESC
13
+ gem.email = "nex342@gmail.com"
14
+ gem.homepage = "http://github.com/nex3/yard-pygments"
15
+ gem.authors = ["Nathan Weizenbaum"]
16
+ gem.add_dependency('yard', '~> 0.5.3')
17
+ gem.add_dependency('rb-pygments', '= 0.1.0')
18
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
+ end
24
+
25
+ begin
26
+ require 'yard'
27
+ YARD::Rake::YardocTask.new
28
+ rescue LoadError
29
+ task :yardoc do
30
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
31
+ end
32
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,21 @@
1
+ require 'rb-pygments'
2
+
3
+ YARD::Templates::Engine.register_template_path File.dirname(__FILE__) + '/../templates'
4
+
5
+ module YARD
6
+ # @private
7
+ module Templates::Helpers::HtmlSyntaxHighlightHelper
8
+ def method_missing(name, *args, &block)
9
+ type = name.to_s[/^html_syntax_highlight_(.*)/, 1]
10
+ type = type.downcase if type
11
+ return super unless type && Pygments.languages.include?(type)
12
+ source = args.first
13
+ Pygments.highlight(source, type, :html, :nowrap => true, :classprefix => "pyg-")
14
+ end
15
+
16
+ def respond_to?(name)
17
+ super || (name =~ /^html_syntax_highlight_(.*)/ &&
18
+ Pygments.languages.include?($1.downcase))
19
+ end
20
+ end
21
+ end
@@ -0,0 +1 @@
1
+ <%= Pygments.style(:default, :html, :classprefix => "pyg-") %>
@@ -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" />
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yard-pygments
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nathan Weizenbaum
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-24 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: yard
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 0.5.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rb-pygments
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.0
34
+ version:
35
+ description: |
36
+ A plugin for the YARD documentation system that adds syntax highlighting
37
+ for a wide variety of languages using the Pygments highlighter.
38
+
39
+ email: nex342@gmail.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files:
45
+ - README.md
46
+ files:
47
+ - .gitignore
48
+ - .yardopts
49
+ - MIT-LICENSE
50
+ - README.md
51
+ - Rakefile
52
+ - VERSION
53
+ - lib/yard-pygments.rb
54
+ - templates/default/fulldoc/html/pygments.erb
55
+ - templates/default/fulldoc/html/setup.rb
56
+ - templates/default/layout/html/headers.erb
57
+ has_rdoc: true
58
+ homepage: http://github.com/nex3/yard-pygments
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options:
63
+ - --charset=UTF-8
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ version:
78
+ requirements: []
79
+
80
+ rubyforge_project:
81
+ rubygems_version: 1.3.5
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Pygments-based syntax highlighting for YARD.
85
+ test_files: []
86
+