html-pipeline-wiki-link 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ # CHANGELOG
2
+
3
+ ## 0.0.1 - *Initial Version*
4
+
5
+ * Built support for basic wiki links and wiki links with descriptions.
6
+ * Built the basic gem infrastructure.
@@ -0,0 +1,68 @@
1
+ # Adding new features
2
+
3
+ This section includes advice on how to build new features for the project & what kind of process it includes.
4
+
5
+ * This is how we like people to add new features:
6
+ * Add only one feature at a time each on a new branch
7
+ * Here are some specifics on the coding style we prefer:
8
+ * Write the code test first
9
+ * Document the code whether or not it is part of the public API
10
+ * We use [YARD documentation](http://yardoc.org/)
11
+ * Documentation comments are in [Markdown](http://daringfireball.net/projects/markdown/) format
12
+ * This is how you send your pull request:
13
+ * TBD
14
+ * You should include the following tests:
15
+ * Unit tests (including tests for failure cases and testing exception paths) at a bare minimum
16
+ * If creating a new chunk of code (rather than changing already existing code) include integration tests as well
17
+ * These are the updates we hope you make to the changelog:
18
+ * Create a header underneath the current version number with a brief description of the feature
19
+ * Document any new command-line options
20
+
21
+ Don’t get discouraged! We estimate that the response time from the maintainers is around: One week, perhaps longer in December.
22
+
23
+ # Bug triage
24
+
25
+ This section explains how bug triaging is done for your project. Help beginners by including examples to good bug reports and providing them questions they should look to answer.
26
+
27
+ * You can help report bugs by filing them here: [New Issue](https://github.com/lifted-studios/html-pipeline-wiki-link/issues/new)
28
+ * You can look through the existing bugs here: [Issues List](https://github.com/lifted-studios/html-pipeline-wiki-link/issues)
29
+
30
+ * Look at existing bugs and help us understand if
31
+ * The bug is reproducible? Is it reproducible in other environments (browsers)? What are the steps to reproduce?
32
+
33
+ * You can close fixed bugs by testing old tickets to see if they are happening
34
+ * You can update our change log here
35
+ * You can remove duplicate bug reports
36
+
37
+ # Translations
38
+
39
+ This section includes any instructions or translation needs your project has.
40
+
41
+ * You can help us translate our project here:
42
+
43
+ # Documentation
44
+
45
+ This section includes any help you need with the documentation and where it can be found. Code needs explanation, and sometimes those who know the code well have trouble explaining it to someone just getting into it.
46
+
47
+ * Help us with documentation here
48
+
49
+ # Community
50
+ This section includes ideas on how non-developers can help with the project. Here's a few examples:
51
+
52
+ * You can help us answer questions our users have here:
53
+ * You can help build and design our website here:
54
+ * You can help write blog posts about the project by:
55
+ * You can help with newsletters and internal communications by:
56
+
57
+ * Create an example of the project in real world by building something or
58
+ showing what others have built.
59
+ * Write about other people’s projects based on this project. Show how
60
+ it’s used in daily life. Take screenshots and make videos!
61
+
62
+
63
+ # Your first bugfix
64
+ This section should help a person get started with their very first bug fix and thinking through the problem.
65
+
66
+ * If you have further questions, contact:
67
+
68
+ This contributing file template is from [contribute.md](http://contribute.md/).
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,43 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ html-pipeline-wiki-link (0.0.1)
5
+ html-pipeline (>= 0.0.8)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (3.2.12)
11
+ i18n (~> 0.6)
12
+ multi_json (~> 1.0)
13
+ escape_utils (0.3.1)
14
+ gemoji (1.4.0)
15
+ github-markdown (0.5.3)
16
+ html-pipeline (0.0.8)
17
+ activesupport (>= 2)
18
+ escape_utils (~> 0.2)
19
+ gemoji (~> 1.0)
20
+ github-markdown (~> 0.5)
21
+ nokogiri (~> 1.4)
22
+ rinku (~> 1.7)
23
+ sanitize (~> 2.0)
24
+ i18n (0.6.4)
25
+ minitest (3.5.0)
26
+ multi_json (1.6.1)
27
+ nokogiri (1.5.6)
28
+ rake (10.0.2)
29
+ redcarpet (2.1.1)
30
+ rinku (1.7.2)
31
+ sanitize (2.0.3)
32
+ nokogiri (>= 1.4.4, < 1.6)
33
+ yard (0.8.3)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ html-pipeline-wiki-link!
40
+ minitest (~> 3.0)
41
+ rake (~> 10.0)
42
+ redcarpet
43
+ yard (~> 0.8)
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright © 2013 Lee Dohm, Lifted Studios
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the “Software”), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
@@ -0,0 +1,74 @@
1
+ [![Build Status](https://travis-ci.org/lifted-studios/html-pipeline-cite.png?branch=master)](https://travis-ci.org/lifted-studios/html-pipeline-cite)
2
+
3
+ # HTML::Pipeline WikiLink Gem
4
+
5
+ An HTML::Pipeline filter for handling WikiMedia-style wiki links.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'html-pipeline-wiki-link'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ ```sh
18
+ $ bundle
19
+ ```
20
+
21
+ Or install it yourself as:
22
+
23
+ ```sh
24
+ $ gem install html-pipeline-wiki-link
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ This library is designed as an extension of the [HTML::Pipeline]() system for creating pipelines of text conversions. It can work on its own or in conjunction with other filters descended from `HTML::Pipeline::Filter`.
30
+
31
+ To use this filter on its own:
32
+
33
+ ```ruby
34
+ require 'html/pipeline/wiki_link'
35
+
36
+ filter = HTML::Pipeline::WikiLinkFilter.new('Some text with a [[Link]] in it.')
37
+ filter.call
38
+ ```
39
+
40
+ Filters can be combined into a pipeline which causes each filter to hand its output to the next filter's input. For example, you could support wiki links in markdown by creating a pipeline like this:
41
+
42
+ ```ruby
43
+ pipeline = HTML::Pipeline.new [
44
+ HTML::Pipeline::MarkdownFilter,
45
+ HTML::Pipeline::WikiLinkFilter
46
+ ]
47
+
48
+ result = pipeline.call <<-CODE
49
+ This is some **Markdown** with a [[Link]] in it!
50
+ CODE
51
+ ```
52
+
53
+ ## Troubleshooting
54
+
55
+ ## Development
56
+
57
+ To see what has changed in recent versions of Lifted Wiki, see the [CHANGELOG](https://github.com/lifted-studios/html-pipeline-wiki-link/blob/master/CHANGELOG.md).
58
+
59
+ ## Core Team Members
60
+
61
+ * [Lee Dohm](https://github.com/lee-dohm/)
62
+
63
+ ## Resources
64
+
65
+ <!-- ### Other questions
66
+
67
+ Feel free to chat with the Lifted Wiki core team (and many other users) on IRC in the [#project](irc://irc.freenode.net/project) channel on Freenode, or via email on the [Project mailing list]().
68
+ -->
69
+
70
+ ## Copyright
71
+
72
+ Copyright © 2013 Lee Dohm, Lifted Studios. See [LICENSE](https://github.com/lifted-studios/html-pipeline-wiki-link/blob/master/LICENSE.md) for details.
73
+
74
+ Project is a member of the [OSS Manifesto](http://ossmanifesto.com/).
@@ -0,0 +1,66 @@
1
+ #
2
+ # Copyright (c) 2013 by Lifted Studios. All Rights Reserved.
3
+ #
4
+
5
+ require 'bundler/gem_tasks'
6
+ require 'html/pipeline/wiki_link/version'
7
+ require 'rake/clean'
8
+ require 'rake/testtask'
9
+ require 'yard'
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
13
+ end
14
+
15
+ def version
16
+ HTML::Pipeline::WikiLink::VERSION
17
+ end
18
+
19
+ def gemspec_file
20
+ "#{name}.gemspec"
21
+ end
22
+
23
+ def gem_file
24
+ "#{name}-#{version}.gem"
25
+ end
26
+
27
+ CLEAN.include('.yardoc')
28
+ CLOBBER.include('doc', 'pkg')
29
+
30
+ task :default => [:test, :yard]
31
+
32
+ desc "Execute all tests"
33
+ task :test => [:spec]
34
+
35
+ Rake::TestTask.new('spec') do |spec|
36
+ spec.libs << 'spec'
37
+ spec.test_files = Dir['spec/**/*_spec.rb']
38
+ # spec.warning = true
39
+ end
40
+
41
+ YARD::Rake::YardocTask.new
42
+
43
+ desc 'Build gem'
44
+ task :build do
45
+ sh "mkdir -p pkg"
46
+ sh "gem build #{gemspec_file}"
47
+ sh "mv #{gem_file} pkg"
48
+ end
49
+
50
+ desc 'Create a release build'
51
+ task :release => :build do
52
+ unless `git branch` =~ /^\* master$/
53
+ puts "You must be on the master branch to release!"
54
+ exit!
55
+ end
56
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
57
+ sh "git pull"
58
+ sh "git tag v#{version}"
59
+ sh "git push origin master"
60
+ sh "git push origin v#{version}"
61
+ sh "gem push pkg/#{name}-#{version}.gem"
62
+ end
63
+
64
+ task :install => :build do
65
+ sh "gem install pkg/#{gem_file}"
66
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # Copyright (c) 2012-2013 by Lifted Studios. All Rights Reserved.
3
+ #
4
+
5
+ require 'date'
6
+ require File.expand_path('../lib/html/pipeline/wiki_link/version', __FILE__)
7
+
8
+ Gem::Specification.new do |s|
9
+ s.specification_version = 2 if s.respond_to? :specification_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.rubygems_version = '1.3.5'
12
+ s.required_ruby_version = ">= 1.9.3"
13
+
14
+ s.name = 'html-pipeline-wiki-link'
15
+ s.version = HTML::Pipeline::WikiLink::VERSION
16
+ s.date = Date.today.to_s
17
+
18
+ s.summary = "A personal wiki solution"
19
+ s.description = "A personal wiki solution inspired by Gollum"
20
+
21
+ s.authors = ["Lee Dohm"]
22
+ s.email = 'lee@liftedstudios.com'
23
+ s.homepage = 'https://github.com/lifted-studios/html-pipeline-wiki-link'
24
+ s.license = 'MIT'
25
+
26
+ s.require_paths = ['lib']
27
+
28
+ s.add_dependency('html-pipeline', '>= 0.0.8')
29
+
30
+ s.add_development_dependency('minitest', '~> 3.0')
31
+ s.add_development_dependency('rake', '~> 10.0')
32
+ s.add_development_dependency('redcarpet')
33
+ s.add_development_dependency('yard', '~> 0.8')
34
+
35
+ s.files = `git ls-files`.
36
+ split("\n").
37
+ sort.
38
+ reject { |file| file =~ /^\./ }.
39
+ reject { |file| file =~ /^(rdoc|pkg)/ }
40
+
41
+ s.test_files = s.files.select { |path| path =~ /^spec\/.*_spec\.rb/ }
42
+ end
@@ -0,0 +1,6 @@
1
+ #
2
+ # Copyright (c) 2013 by Lifted Studios. All Rights Reserved.
3
+ #
4
+
5
+ require 'html/pipeline/wiki_link/version.rb'
6
+ require 'html/pipeline/wiki_link/wiki_link_filter.rb'
@@ -0,0 +1,12 @@
1
+ #
2
+ # Copyright (c) 2012-2013 by Lifted Studios. All Rights Reserved.
3
+ #
4
+
5
+ module HTML
6
+ class Pipeline
7
+ module WikiLink
8
+ # Version number for the Lifted Wiki gem.
9
+ VERSION = '0.0.1'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ #
2
+ # Copyright (c) 2012-2013 by Lifted Studios. All Rights Reserved.
3
+ #
4
+
5
+ require 'html/pipeline'
6
+
7
+ module HTML
8
+ class Pipeline
9
+ # An `HTML::Pipeline` filter class that detects wiki-style links and converts them to HTML links.
10
+ class WikiLinkFilter < Filter
11
+ # Performs the translation and returns the updated text.
12
+ #
13
+ # @return [String] Updated text with translated wiki links.
14
+ def call
15
+ text = html.gsub(/\[\[(.*)\|(.*)\]\]/, '<a href="/\1">\2</a>')
16
+ text.gsub(/\[\[(.*)\]\]/, '<a href="/\1">\1</a>')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,43 @@
1
+ #
2
+ # Copyright (c) 2012-2013 by Lifted Studios. All Rights Reserved.
3
+ #
4
+
5
+ gem 'minitest'
6
+
7
+ require 'minitest/spec'
8
+ require 'minitest/autorun'
9
+
10
+ require 'html/pipeline/wiki_link'
11
+ require 'nokogiri'
12
+
13
+ describe HTML::Pipeline::WikiLinkFilter do
14
+ # Creates a new `WikiLinkFilter` object.
15
+ #
16
+ # @param text Text for the filter to parse.
17
+ # @return [HTML::Pipeline::WikiLinkFilter] Newly created filter object.
18
+ def new_filter(text)
19
+ HTML::Pipeline::WikiLinkFilter.new(text)
20
+ end
21
+
22
+ it 'can be instantiated' do
23
+ filter = new_filter('Just some sample text')
24
+
25
+ filter.wont_be_nil
26
+ end
27
+
28
+ it 'converts a normal wiki link' do
29
+ filter = new_filter('[[Link]]')
30
+
31
+ text = filter.call
32
+
33
+ text.must_equal '<a href="/Link">Link</a>'
34
+ end
35
+
36
+ it 'converts a wiki link with a description' do
37
+ filter = new_filter('[[Link|Description]]')
38
+
39
+ text = filter.call
40
+
41
+ text.must_equal '<a href="/Link">Description</a>'
42
+ end
43
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: html-pipeline-wiki-link
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Lee Dohm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: html-pipeline
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.0.8
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.0.8
30
+ - !ruby/object:Gem::Dependency
31
+ name: minitest
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '10.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: redcarpet
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: yard
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '0.8'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '0.8'
94
+ description: A personal wiki solution inspired by Gollum
95
+ email: lee@liftedstudios.com
96
+ executables: []
97
+ extensions: []
98
+ extra_rdoc_files: []
99
+ files:
100
+ - CHANGELOG.md
101
+ - CONTRIBUTING.md
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - LICENSE.md
105
+ - README.md
106
+ - Rakefile
107
+ - html-pipeline-wiki-link.gemspec
108
+ - lib/html/pipeline/wiki_link.rb
109
+ - lib/html/pipeline/wiki_link/version.rb
110
+ - lib/html/pipeline/wiki_link/wiki_link_filter.rb
111
+ - spec/wiki_link_filter_spec.rb
112
+ homepage: https://github.com/lifted-studios/html-pipeline-wiki-link
113
+ licenses:
114
+ - MIT
115
+ post_install_message:
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.9.3
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 1.8.24
134
+ signing_key:
135
+ specification_version: 2
136
+ summary: A personal wiki solution
137
+ test_files:
138
+ - spec/wiki_link_filter_spec.rb
139
+ has_rdoc: