jekyll-beastiepress 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ require 'jekyll-beastiepress/man_tag'
2
+ require 'jekyll-beastiepress/port_tag'
3
+ require 'jekyll-beastiepress/pr_tag'
4
+
@@ -0,0 +1,65 @@
1
+ # Title: FreeBSD manual tag for Jekyll
2
+ # Author: Nicole Reid http://cooltrainer.org
3
+ # Description: Easily link to BSD manpages.
4
+ #
5
+ # Syntax {% man [section] command ['release'] ['link text'] ['title text'] %}
6
+ #
7
+ # Examples:
8
+ # {% man 8 lpc "FreeBSD 8.1-RELEASE" "the manpage" "Section 8 of the lpc manpage" %}
9
+ # {% man 8 lpc "FreeBSD 8.1-RELEASE" %}
10
+ # {% man lpc %}
11
+ #
12
+ # Output:
13
+ # <a href='http://www.freebsd.org/cgi/man.cgi?query=lpc&sektion=8&manpath=FreeBSD 8.1-RELEASE' title='Section 8 of the lpc manpage'>the manpage</a>
14
+ # <a href='http://www.freebsd.org/cgi/man.cgi?query=lpc&sektion=8&manpath=FreeBSD 8.1-RELEASE' title='man lpc(8) from FreeBSD 8.1-RELEASE'>lpc(8)</a>
15
+ # <a href='http://www.freebsd.org/cgi/man.cgi?query=lpc&sektion=&manpath=' title='man lpc'>lpc</a>
16
+ #
17
+
18
+ module Jekyll
19
+
20
+ class ManTag < Liquid::Tag
21
+ @man = nil
22
+ @section = ''
23
+ @release = ''
24
+ @title = ''
25
+ @link = ''
26
+
27
+ def initialize(tag_name, markup, tokens)
28
+ if markup =~ /((\d+)\s+)?(\w+)(\s+((?:"|')([^"']+)(?:"|')))?(\s+((?:"|')([^"']+)(?:"|')))?(\s+((?:"|')([^"']+)(?:"|')))?/i
29
+ @section = $2
30
+ @man = $3
31
+ @release = $6
32
+ @link = $9
33
+ @title = $12
34
+ if !@link
35
+ @link = @man
36
+ if @section
37
+ @link += "(#{@section})"
38
+ end
39
+ if @release && @title
40
+ @title += " from #{@release}"
41
+ end
42
+ end
43
+ if !@title
44
+ @title = "man #{@man}"
45
+ if @release
46
+ @title += " from #{@release}"
47
+ end
48
+ end
49
+ end
50
+ super
51
+ end
52
+
53
+ def render(context)
54
+ output = super
55
+ if @man
56
+ man = "<a class='man' href='http://www.freebsd.org/cgi/man.cgi?query=#{@man}&amp;ektion=#{@section}&amp;manpath=#{@release}' title='#{@title}'>#{@link}</a>"
57
+ else
58
+ "Error processing input, expected syntax: {% port category/portname ['link text'] ['title text'] %}"
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ Liquid::Template.register_tag('man', Jekyll::ManTag)
65
+
@@ -0,0 +1,47 @@
1
+ # Title: FreeBSD port tag for Jekyll
2
+ # Author: Nicole Reid http://cooltrainer.org
3
+ # Description: Easily link to Freshports for FreeBSD ports.
4
+ #
5
+ # Syntax {% port portname ['link text'] ['title text'] %}
6
+ #
7
+ # Example:
8
+ # {% port www/subsonic "A link to www/subsonic on Freshports" "Subsonic" %}
9
+ #
10
+ # Output:
11
+ # <a href='http://freshports.org/www/subsonic' title='A link to www/subsonic on Freshports'>Subsonic</a>
12
+ #
13
+
14
+ module Jekyll
15
+
16
+ class PortTag < Liquid::Tag
17
+ @port = nil
18
+ @title = ''
19
+ @link = ''
20
+
21
+ def initialize(tag_name, markup, tokens)
22
+ if markup =~ /(\S+(?:\/\S+)?)(\s+((?:"|')([^"']+)(?:"|')))?(\s+((?:"|')([^"']+)(?:"|')))?/i
23
+ @port = $1
24
+ @link = $4
25
+ @title = $7
26
+ if !@link
27
+ @link = @port
28
+ end
29
+ if !@title
30
+ @title = @link
31
+ end
32
+ end
33
+ super
34
+ end
35
+
36
+ def render(context)
37
+ output = super
38
+ if @port
39
+ port = "<a class='port' href='http://freshports.org/#{@port}' title='#{@title}'>#{@link}</a>"
40
+ else
41
+ "Error processing input, expected syntax: {% port category/portname ['link text'] ['title text'] %}"
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ Liquid::Template.register_tag('port', Jekyll::PortTag)
@@ -0,0 +1,48 @@
1
+ # Title: FreeBSD PR tag for Jekyll
2
+ # Author: Nicole Reid http://cooltrainer.org
3
+ # Description: Easily link to FreeBSD problem reports.
4
+ #
5
+ # Syntax {% pr [category/]prnumber ['link text'] ['title text'] %}
6
+ #
7
+ # Example:
8
+ # {% pr ports/151677 'the fix' 'Filename handling fix for cuetools.sh' %}
9
+ # {% pr ports/151677 %}
10
+ #
11
+ # Output:
12
+ # <a href='http://freshports.org/www/subsonic' title='Filename handling fix for cuetools.sh'>the fix</a>
13
+ # <a href='http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/151677' title='Problem Report ports/151677'>ports/151677</a>
14
+ #
15
+
16
+ module Jekyll
17
+
18
+ class PRTag < Liquid::Tag
19
+ @pr = nil
20
+
21
+ def initialize(tag_name, markup, tokens)
22
+ if markup =~ /((\w+\/?)\d+)(\s+((?:"|')([^"']+)(?:"|')))?(\s+((?:"|')([^"']+)(?:"|')))?/i
23
+ @pr = $1
24
+ @link = $5
25
+ @title = $8
26
+ if !@link
27
+ @link = @pr
28
+ end
29
+ if !@title
30
+ @title = "Problem Report #{@pr}"
31
+ end
32
+ end
33
+ super
34
+ end
35
+
36
+ def render(context)
37
+ output = super
38
+ if @pr
39
+ pr = "<a class='pr' href='http://www.freebsd.org/cgi/query-pr.cgi?pr=#{@pr}' title='#{@title}'>#{@link}</a>"
40
+ else
41
+ "Error processing input, expected syntax: {% pr [category/]prnumber ['link text'] ['title text'] %}"
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ Liquid::Template.register_tag('pr', Jekyll::PRTag)
48
+
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-beastiepress
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Nicole Reid
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-02-21 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: jekyll
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 55
29
+ segments:
30
+ - 0
31
+ - 10
32
+ - 0
33
+ version: 0.10.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: liquid
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 2
47
+ - 2
48
+ - 2
49
+ version: 2.2.2
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ description: Extend Jekyll with easy tags for linking FreeBSD manual pages, ports, and problem reports.
53
+ email: root@cooltrainer.org
54
+ executables: []
55
+
56
+ extensions: []
57
+
58
+ extra_rdoc_files: []
59
+
60
+ files:
61
+ - lib/jekyll-beastiepress.rb
62
+ - lib/jekyll-beastiepress/man_tag.rb
63
+ - lib/jekyll-beastiepress/port_tag.rb
64
+ - lib/jekyll-beastiepress/pr_tag.rb
65
+ homepage: https://github.com/okeeblow/jekyll-beastiepress
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.8.11
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: FreeBSD community tags for Jekyll
98
+ test_files: []
99
+