rubypants 0.2.0 → 0.7.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 766f0400e12ec2e5bb64917568fcf5dba1b7fdf7e31632c62144602e0b1bd674
4
+ data.tar.gz: 87de02ec38116b4d9d179e80f958f608101565a9724f63a751e7efb642dab7ff
5
+ SHA512:
6
+ metadata.gz: 543191639285ce9c53716b19fcbfa72dd6b14e96f53cb88b87a62f5cf4446725ceeb384c6ea3c7767c97409195d7e5cb11c8694d06eb93545284b230b2407bf0
7
+ data.tar.gz: ed420062908b83fa18c96bb8048870095350f4d9b45ac2294939a9265f775c04a1aa4c5d7e40ed8b3bee741a013103be0bf218e4d18e4e0e59dbbe3eb6cd2fc0
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ rvm:
2
+ - 2.4
3
+ - 2.5
4
+ - 2.6
5
+ - jruby
6
+
7
+ # Workaround for `NoMethodError: undefined method 'spec' for nil:NilClass`,
8
+ # see https://travis-ci.org/jmcnevin/rubypants/jobs/167182556
9
+ # and https://github.com/travis-ci/travis-ci/issues/5239
10
+ before_install:
11
+ - gem install bundler
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ gem "rake"
5
+ gem "codecov", :require => false, :group => :test
@@ -1,42 +1,15 @@
1
- = RubyPants -- SmartyPants ported to Ruby
1
+ = Copyright and License
2
+
3
+ == Copyright
2
4
 
3
5
  Ported by Christian Neukirchen <mailto:chneukirchen@gmail.com>
4
- Copyright (C) 2004 Christian Neukirchen
6
+ Copyright (C) 2004 Christian Neukirchen
5
7
 
6
- Incooporates ideas, comments and documentation by Chad Miller
7
- Copyright (C) 2004 Chad Miller
8
+ Incorporates ideas, comments and documentation by Chad Miller
9
+ Copyright (C) 2004 Chad Miller
8
10
 
9
11
  Original SmartyPants by John Gruber
10
- Copyright (C) 2003 John Gruber
11
-
12
-
13
- == RubyPants
14
-
15
- RubyPants is a Ruby port of the smart-quotes library SmartyPants.
16
-
17
- The original "SmartyPants" is a free web publishing plug-in for
18
- Movable Type, Blosxom, and BBEdit that easily translates plain ASCII
19
- punctuation characters into "smart" typographic punctuation HTML
20
- entities.
21
-
22
- See rubypants.rb for more information.
23
-
24
-
25
- == Incompatibilities
26
-
27
- RubyPants uses a different API than SmartyPants; it is compatible to
28
- Red- and BlueCloth. Usually, you call RubyPants like this:
29
-
30
- nicehtml = RubyPants.new(uglyhtml, options).to_html
31
-
32
- where +options+ is an Array of Integers and/or Symbols (if you don't
33
- pass any options, RubyPants will use <tt>[2]</tt> as default.)
34
-
35
- *Note*:: This is incompatible to SmartyPants, which uses <tt>[1]</tt>
36
- for default.
37
-
38
- The exact meaning of numbers and symbols is documented at RubyPants#new.
39
-
12
+ Copyright (C) 2003 John Gruber
40
13
 
41
14
  == SmartyPants license:
42
15
 
@@ -73,10 +46,7 @@ liability, or tort (including negligence or otherwise) arising in
73
46
  any way out of the use of this software, even if advised of the
74
47
  possibility of such damage.
75
48
 
76
-
77
- == RubyPants license
78
-
79
- Copyright (C) 2004 Christian Neukirchen
49
+ === RubyPants license
80
50
 
81
51
  RubyPants is a derivative work of SmartyPants and smartypants.py.
82
52
 
@@ -104,11 +74,3 @@ caused and on any theory of liability, whether in contract, strict
104
74
  liability, or tort (including negligence or otherwise) arising in
105
75
  any way out of the use of this software, even if advised of the
106
76
  possibility of such damage.
107
-
108
-
109
- == Links
110
-
111
- John Gruber:: http://daringfireball.net
112
- SmartyPants:: http://daringfireball.net/projects/smartypants
113
- Chad Miller:: http://web.chad.org
114
- Christian Neukirchen:: http://kronavita.de/chris
data/README.rdoc ADDED
@@ -0,0 +1,121 @@
1
+ = RubyPants: SmartyPants for Ruby
2
+
3
+ {<img src="https://img.shields.io/gem/v/rubypants.svg?maxAge=2592000&style=plastic" alt="Gem">}[https://rubygems.org/gems/rubypants]
4
+ {<img src="https://img.shields.io/travis/jmcnevin/rubypants.svg?maxAge=2592000&style=plastic" alt="Travis">}[https://travis-ci.org/jmcnevin/rubypants]
5
+ {<img src="https://img.shields.io/codecov/c/github/jmcnevin/rubypants.svg?maxAge=2592000&style=plastic" alt="CodeCov">}[https://codecov.io/gh/jmcnevin/rubypants]
6
+
7
+ == Synopsis
8
+
9
+ RubyPants is a Ruby port of the smart-quotes library SmartyPants.
10
+
11
+ The original "SmartyPants" is a free web publishing plug-in for
12
+ Movable Type, Blosxom, and BBEdit that easily translates plain ASCII
13
+ punctuation characters into "smart" typographic punctuation HTML
14
+ entities.
15
+
16
+
17
+ == Description
18
+
19
+ RubyPants can perform the following transformations:
20
+
21
+ * Straight quotes (<tt>"</tt> and <tt>'</tt>) into "curly" quote
22
+ HTML entities
23
+ * Backticks-style quotes (<tt>``like this''</tt>) into "curly" quote
24
+ HTML entities
25
+ * Dashes (<tt>--</tt> and <tt>---</tt>) into en- and em-dash
26
+ entities
27
+ * Three consecutive dots (<tt>...</tt> or <tt>. . .</tt>) into an
28
+ ellipsis entity
29
+
30
+ This means you can write, edit, and save your posts using plain old
31
+ ASCII straight quotes, plain dashes, and plain dots, but your
32
+ published posts (and final HTML output) will appear with smart
33
+ quotes, em-dashes, and proper ellipses.
34
+
35
+ RubyPants does not modify characters within <tt><pre></tt>,
36
+ <tt><code></tt>, <tt><kbd></tt>, <tt><math></tt>, <tt><style></tt> or
37
+ <tt><script></tt> tag blocks. Typically, these tags are used to
38
+ display text where smart quotes and other "smart punctuation" would
39
+ not be appropriate, such as source code or example markup.
40
+
41
+
42
+ == Installation
43
+
44
+ gem install rubypants
45
+
46
+ Or, in your application's Gemfile:
47
+
48
+ gem 'rubypants'
49
+
50
+
51
+ == Example of Usage
52
+
53
+ RubyPants.new("String with 'dumb' quotes.").to_html
54
+
55
+ For additional options, consult the documention in
56
+ <tt>lib/rubypants/core.rb</tt>.
57
+
58
+
59
+ == Backslash Escapes
60
+
61
+ If you need to use literal straight quotes (or plain hyphens and
62
+ periods), RubyPants accepts the following backslash escape sequences
63
+ to force non-smart punctuation. It does so by transforming the
64
+ escape sequence into a decimal-encoded HTML entity:
65
+
66
+ \\ \" \' \. \- \`
67
+
68
+ This is useful, for example, when you want to use straight quotes as
69
+ foot and inch marks: 6'2" tall; a 17" iMac. (Use <tt>6\'2\"</tt>
70
+ resp. <tt>17\"</tt>.)
71
+
72
+
73
+ == Algorithmic Shortcomings
74
+
75
+ One situation in which quotes will get curled the wrong way is when
76
+ apostrophes are used at the start of leading contractions. For
77
+ example:
78
+
79
+ 'Twas the night before Christmas.
80
+
81
+ In the case above, RubyPants will turn the apostrophe into an
82
+ opening single-quote, when in fact it should be a closing one. I
83
+ don't think this problem can be solved in the general case--every
84
+ word processor I've tried gets this wrong as well. In such cases,
85
+ it's best to use the proper HTML entity for closing single-quotes
86
+ ("<tt>&#8217;</tt>") by hand.
87
+
88
+
89
+ == Bugs
90
+
91
+ To file bug reports or feature requests, please create an issue in this gem's
92
+ GitHub repository.
93
+
94
+ If the bug involves quotes being curled the wrong way, please send
95
+ example text to illustrate.
96
+
97
+
98
+ == Authors
99
+
100
+ John Gruber did all of the hard work of writing this software in
101
+ Perl for Movable Type and almost all of this useful documentation.
102
+ Chad Miller ported it to Python to use with Pyblosxom.
103
+
104
+ Christian Neukirchen provided the Ruby port, as a general-purpose
105
+ library that follows the *Cloth API.
106
+
107
+ Jeremy McNevin posted this code to GitHub ages ago, but has recently
108
+ been trying to improve it where possible.
109
+
110
+ Aron Griffis made jekyll-pants[https://github.com/scampersand/jekyll-pants]
111
+ which depends on RubyPants, and consequently jumped in to help out with
112
+ issues and pull requests.
113
+
114
+
115
+ == Links
116
+
117
+ John Gruber :: http://daringfireball.net
118
+ SmartyPants :: http://daringfireball.net/projects/smartypants
119
+ Chad Miller :: http://web.chad.org
120
+ Christian Neukirchen :: http://kronavita.de/chris
121
+ Aron Griffis :: https://arongriffis.com
data/Rakefile CHANGED
@@ -1,84 +1,7 @@
1
- # Rakefile for rubypants -*-ruby-*-
2
- require 'rake/rdoctask'
3
- require 'rake/gempackagetask'
4
-
5
-
6
1
  desc "Run all the tests"
7
2
  task :default => [:test]
8
3
 
9
- desc "Do predistribution stuff"
10
- task :predist => [:doc]
11
-
12
-
13
4
  desc "Run all the tests"
14
5
  task :test do
15
- ruby 'test_rubypants.rb'
16
- end
17
-
18
- desc "Make an archive as .tar.gz"
19
- task :dist => :test do
20
- system "darcs dist -d rubypants#{get_darcs_tree_version}"
21
- end
22
-
23
-
24
- desc "Generate RDoc documentation"
25
- Rake::RDocTask.new(:doc) do |rdoc|
26
- rdoc.options << '--line-numbers --inline-source --all'
27
- rdoc.rdoc_files.include 'README'
28
- rdoc.rdoc_files.include 'rubypants.rb'
29
- end
30
-
31
-
32
- spec = Gem::Specification.new do |s|
33
- s.name = 'rubypants'
34
- s.version = '0.2.0'
35
- s.summary = "RubyPants is a Ruby port of the smart-quotes library SmartyPants."
36
- s.description = <<-EOF
37
- RubyPants is a Ruby port of the smart-quotes library SmartyPants.
38
-
39
- The original "SmartyPants" is a free web publishing plug-in for
40
- Movable Type, Blosxom, and BBEdit that easily translates plain ASCII
41
- punctuation characters into "smart" typographic punctuation HTML
42
- entities.
43
- EOF
44
- s.files = FileList['**/*rb', 'README', 'Rakefile'].to_a
45
- s.test_file = "test_rubypants.rb"
46
- s.extra_rdoc_files = ["README"]
47
- s.rdoc_options = ["--main", "README"]
48
- s.rdoc_options.concat ['--line-numbers', '--inline-source', '--all']
49
- s.rdoc_options.concat ['--exclude', 'test_rubypants.rb']
50
- s.require_path = '.'
51
- s.author = "Christian Neukirchen"
52
- s.email = "chneukirchen@gmail.com"
53
- s.homepage = "http://www.kronavita.de/chris/blog/projects/rubypants.html"
54
- end
55
-
56
- Rake::GemPackageTask.new(spec) do |pkg|
57
- end
58
-
59
-
60
- # Helper to retrieve the "revision number" of the darcs tree.
61
- def get_darcs_tree_version
62
- return "" unless File.directory? "_darcs"
63
-
64
- changes = `darcs changes`
65
- count = 0
66
- tag = "0.0"
67
-
68
- changes.each("\n\n") { |change|
69
- head, title, desc = change.split("\n", 3)
70
-
71
- if title =~ /^ \*/
72
- # Normal change.
73
- count += 1
74
- elsif title =~ /tagged (.*)/
75
- # Tag. We look for these.
76
- tag = $1
77
- break
78
- else
79
- warn "Unparsable change: #{change}"
80
- end
81
- }
82
-
83
- "-" + tag + "." + count.to_s
6
+ ruby 'test/rubypants_test.rb'
84
7
  end