rdiscount 1.2.6.2 → 1.2.7

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.
@@ -1,16 +1,20 @@
1
- = RDiscount - Discount Markdown For Ruby
1
+ Discount Markdown Processor for Ruby
2
+ ====================================
2
3
 
3
- Discount is an implementation of John Gruber's Markdown markup
4
- language in C. It implements all of the language as described in
5
- <http://daringfireball.net/projects/markdown/syntax>
6
- and passes the Markdown test suite at
7
- <http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip>
4
+ Discount is an implementation of John Gruber's Markdown markup language in C. It
5
+ implements all of the language described in [the markdown syntax document][1] and
6
+ passes the [Markdown 1.0 test suite][2].
8
7
 
9
- Discount was developed by
10
- {David Loren Parsons}[http://www.pell.portland.or.us/~orc]. The
11
- RDiscount extension was developed by {Ryan Tomayko}[http://tomayko.com/].
8
+ Discount was developed by [David Loren Parsons][3]. The Ruby extension was
9
+ developed by [Ryan Tomayko][4].
12
10
 
13
- == Installation, Hacking
11
+ [1]: http://daringfireball.net/projects/markdown/syntax
12
+ [2]: http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip
13
+ [3]: http://www.pell.portland.or.us/~orc
14
+ [4]: http://tomayko.com/
15
+
16
+ Installation, Hacking
17
+ ---------------------
14
18
 
15
19
  RDiscount Gem releases are published to RubyForge and can be installed as
16
20
  follows:
@@ -23,11 +27,10 @@ The RDiscount sources are available via Git:
23
27
  $ cd rdiscount
24
28
  $ rake --tasks
25
29
 
26
- For more information, see:
27
-
28
- http://github.com/rtomayko/rdiscount
30
+ For more information, see [the project page](http://github.com/rtomayko/rdiscount).
29
31
 
30
- == Usage
32
+ Usage
33
+ -----
31
34
 
32
35
  RDiscount implements the basic protocol popularized by RedCloth and adopted
33
36
  by BlueCloth:
@@ -46,7 +49,8 @@ require statements with the following:
46
49
  require 'bluecloth'
47
50
  end
48
51
 
49
- == License
52
+ COPYING
53
+ -------
50
54
 
51
55
  Discount is free software; it is released under a BSD-style license
52
56
  that allows you to do as you wish with it as long as you don't attempt
data/Rakefile CHANGED
@@ -5,18 +5,18 @@ require 'rake/gempackagetask'
5
5
  task :default => 'test:unit'
6
6
 
7
7
  DLEXT = Config::CONFIG['DLEXT']
8
- VERS = '1.2.6.2'
8
+ VERS = '1.2.7'
9
9
 
10
10
  spec =
11
11
  Gem::Specification.new do |s|
12
12
  s.name = "rdiscount"
13
13
  s.version = VERS
14
14
  s.summary = "Fast Implementation of Gruber's Markdown in C"
15
- s.files = FileList['README','COPYING','Rakefile','test/**','{lib,ext}/**.rb','ext/*.{c,h}']
15
+ s.files = FileList['README.markdown','COPYING','Rakefile','test/**','{lib,ext}/**.rb','ext/*.{c,h}']
16
16
  s.bindir = 'bin'
17
17
  s.require_path = 'lib'
18
18
  s.has_rdoc = true
19
- s.extra_rdoc_files = ['README', 'COPYING']
19
+ s.extra_rdoc_files = ['COPYING']
20
20
  s.test_files = FileList['test/*_test.rb']
21
21
  s.extensions = ['ext/extconf.rb']
22
22
 
@@ -62,7 +62,7 @@ task :build => "lib/rdiscount.#{DLEXT}"
62
62
 
63
63
  desc 'Run unit tests'
64
64
  task 'test:unit' => [:build] do |t|
65
- ruby 'test/rdiscount_test.rb'
65
+ ruby 'test/markdown_test.rb'
66
66
  end
67
67
 
68
68
  desc 'Run conformance tests (MARKDOWN_TEST_VER=1.0)'
@@ -99,7 +99,7 @@ end
99
99
  desc 'Generate API documentation'
100
100
  task :doc => 'doc/index.html'
101
101
 
102
- file 'doc/index.html' => FileList['lib/rdiscount.rb','README'] do |f|
102
+ file 'doc/index.html' => FileList['lib/*.rb'] do |f|
103
103
  sh((<<-end).gsub(/\s+/, ' '))
104
104
  hanna --charset utf8 \
105
105
  --fmt html \
@@ -129,6 +129,10 @@ task :release => [ "#{PKGNAME}.gem", "#{PKGNAME}.tar.gz" ] do |t|
129
129
  end
130
130
  end
131
131
 
132
+ desc 'Publish API docs to rubyforge'
133
+ task :publish => :doc do |t|
134
+ sh 'scp -rp doc/. rubyforge.org:/var/www/gforge-projects/wink/rdiscount'
135
+ end
132
136
 
133
137
  # ==========================================================
134
138
  # Discount Submodule
data/ext/dumptree.c CHANGED
File without changes
data/ext/generate.c CHANGED
@@ -701,7 +701,7 @@ maybe_tag_or_link(MMIOT *f)
701
701
 
702
702
  if ( maybetag || (size >= 3 && strncmp(cursor(f), "!--", 3) == 0) ) {
703
703
  Qstring(forbidden_tag(f) ? "&lt;" : "<", f);
704
- while ( ((c = peek(f, size+1)) != EOF) && (c != '>') )
704
+ while ( ((c = peek(f, 1)) != EOF) && (c != '>') )
705
705
  cputc(pull(f), f);
706
706
  return 1;
707
707
  }
@@ -925,6 +925,22 @@ text(MMIOT *f)
925
925
  case '[': if ( tag_text(f) || !linkylinky(0, f) )
926
926
  Qchar(c, f);
927
927
  break;
928
+ #if SUPERSCRIPT
929
+ case '^': if ( isthisspace(f,-1) || isthisspace(f,1) )
930
+ Qchar(c,f);
931
+ else {
932
+ char *sup = cursor(f);
933
+ int len = 0;
934
+ Qstring("<sup>",f);
935
+ while ( !isthisspace(f,1+len) ) {
936
+ ++len;
937
+ }
938
+ shift(f,len);
939
+ reparse(sup, len, 0, f);
940
+ Qstring("</sup>", f);
941
+ }
942
+ break;
943
+ #endif
928
944
  case '*':
929
945
  case '_': if ( tag_text(f) )
930
946
  Qchar(c, f);
data/ext/mkdio.c CHANGED
@@ -80,7 +80,7 @@ snip(Line *p)
80
80
 
81
81
  /* build a Document from any old input.
82
82
  */
83
- typedef unsigned int (*getc_func)(void*);
83
+ typedef int (*getc_func)(void*);
84
84
 
85
85
  Document *
86
86
  populate(getc_func getc, void* ctx, int flags)
@@ -156,7 +156,7 @@ struct string_ctx {
156
156
  } ;
157
157
 
158
158
 
159
- static char
159
+ static int
160
160
  strget(struct string_ctx *in)
161
161
  {
162
162
  if ( !in->size ) return EOF;
data/lib/markdown.rb ADDED
@@ -0,0 +1 @@
1
+ require 'rdiscount'
data/lib/rdiscount.rb CHANGED
@@ -59,15 +59,8 @@ class RDiscount
59
59
  extensions.each { |e| send("#{e}=", true) }
60
60
  end
61
61
 
62
- # Convert the Markdown #text to HTML.
63
- #--
64
- # This is method is replaced when the C extension is loaded.
65
- def to_html
66
- raise NotImplemented
67
- end
68
-
69
62
  end
70
63
 
71
- # Load the extension library. This replaces RDiscount#to_html with a real
72
- # implementation.
64
+ Markdown = RDiscount unless defined? Markdown
65
+
73
66
  require 'rdiscount.so'
data/test/benchmark.rb CHANGED
@@ -2,16 +2,23 @@ require 'rubygems'
2
2
 
3
3
  iterations = 100
4
4
  test_file = "#{File.dirname(__FILE__)}/benchmark.txt"
5
- implementations = %w[BlueCloth RDiscount Maruku Markdown]
5
+ implementations = %w[BlueCloth RDiscount Maruku PEGMarkdown]
6
6
 
7
7
  # Attempt to require each implementation and remove any that are not
8
8
  # installed.
9
9
  implementations.reject! do |class_name|
10
10
  begin
11
- require class_name.downcase
11
+ module_path =
12
+ if class_name == 'PEGMarkdown'
13
+ 'peg_markdown'
14
+ else
15
+ class_name.downcase
16
+ end
17
+ require module_path
12
18
  false
13
19
  rescue LoadError => boom
14
- puts "#{class_name} excluded from benchmark. (Try: gem install #{class_name.downcase})"
20
+ module_path.tr! '_', '-'
21
+ puts "#{class_name} excluded. Try: gem install #{module_path}"
15
22
  true
16
23
  end
17
24
  end
@@ -1,31 +1,31 @@
1
1
  $: << File.join(File.dirname(__FILE__), "../lib")
2
2
 
3
3
  require 'test/unit'
4
- require 'rdiscount'
4
+ require 'markdown'
5
5
 
6
6
  MARKDOWN_TEST_DIR = "#{File.dirname(__FILE__)}/MarkdownTest_1.0.3"
7
7
 
8
- class RDiscountTest < Test::Unit::TestCase
8
+ class MarkdownTest < Test::Unit::TestCase
9
9
 
10
- def test_that_extension_methods_are_present_on_rdiscount_class
11
- assert RDiscount.instance_methods.include?('to_html'),
12
- "RDiscount class should respond to #to_html"
10
+ def test_that_extension_methods_are_present_on_markdown_class
11
+ assert Markdown.instance_methods.include?('to_html'),
12
+ "Markdown class should respond to #to_html"
13
13
  end
14
14
 
15
15
  def test_that_simple_one_liner_goes_to_html
16
- markdown = RDiscount.new('Hello World.')
16
+ markdown = Markdown.new('Hello World.')
17
17
  assert_respond_to markdown, :to_html
18
- assert_equal "<p>Hello World.</p>\n", markdown.to_html
18
+ assert_equal "<p>Hello World.</p>", markdown.to_html.strip
19
19
  end
20
20
 
21
21
  def test_that_inline_markdown_goes_to_html
22
- markdown = RDiscount.new('_Hello World_!')
22
+ markdown = Markdown.new('_Hello World_!')
23
23
  assert_respond_to markdown, :to_html
24
- assert_equal "<p><em>Hello World</em>!</p>\n", markdown.to_html
24
+ assert_equal "<p><em>Hello World</em>!</p>", markdown.to_html.strip
25
25
  end
26
26
 
27
27
  def test_that_bluecloth_restrictions_are_supported
28
- markdown = RDiscount.new('Hello World.')
28
+ markdown = Markdown.new('Hello World.')
29
29
  [:filter_html, :filter_styles].each do |restriction|
30
30
  assert_respond_to markdown, restriction
31
31
  assert_respond_to markdown, "#{restriction}="
@@ -33,26 +33,27 @@ class RDiscountTest < Test::Unit::TestCase
33
33
  assert_not_equal true, markdown.filter_html
34
34
  assert_not_equal true, markdown.filter_styles
35
35
 
36
- markdown = RDiscount.new('Hello World.', :filter_html, :filter_styles)
36
+ markdown = Markdown.new('Hello World.', :filter_html, :filter_styles)
37
37
  assert_equal true, markdown.filter_html
38
38
  assert_equal true, markdown.filter_styles
39
39
  end
40
40
 
41
41
  def test_that_redcloth_attributes_are_supported
42
- markdown = RDiscount.new('Hello World.')
42
+ markdown = Markdown.new('Hello World.')
43
43
  assert_respond_to markdown, :fold_lines
44
44
  assert_respond_to markdown, :fold_lines=
45
45
  assert_not_equal true, markdown.fold_lines
46
46
 
47
- markdown = RDiscount.new('Hello World.', :fold_lines)
47
+ markdown = Markdown.new('Hello World.', :fold_lines)
48
48
  assert_equal true, markdown.fold_lines
49
49
  end
50
50
 
51
51
  def test_that_redcloth_to_html_with_single_arg_is_supported
52
- markdown = RDiscount.new('Hello World.')
52
+ markdown = Markdown.new('Hello World.')
53
53
  assert_nothing_raised(ArgumentError) { markdown.to_html(true) }
54
54
  end
55
55
 
56
+
56
57
  # Build tests for each file in the MarkdownTest test suite
57
58
 
58
59
  Dir["#{MARKDOWN_TEST_DIR}/Tests/*.text"].each do |text_file|
@@ -62,13 +63,13 @@ class RDiscountTest < Test::Unit::TestCase
62
63
  method_name = basename.gsub(/[-,]/, '').gsub(/\s+/, '_').downcase
63
64
 
64
65
  define_method "test_#{method_name}" do
65
- markdown = RDiscount.new(File.read(text_file))
66
+ markdown = Markdown.new(File.read(text_file))
66
67
  actual_html = markdown.to_html
67
68
  assert_not_nil actual_html
68
69
  end
69
70
 
70
71
  define_method "test_#{method_name}_with_smarty_enabled" do
71
- markdown = RDiscount.new(File.read(text_file), :smart)
72
+ markdown = Markdown.new(File.read(text_file), :smart)
72
73
  actual_html = markdown.to_html
73
74
  assert_not_nil actual_html
74
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdiscount
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6.2
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-03 00:00:00 -04:00
12
+ date: 2008-08-02 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -20,17 +20,17 @@ executables: []
20
20
  extensions:
21
21
  - ext/extconf.rb
22
22
  extra_rdoc_files:
23
- - README
24
23
  - COPYING
25
24
  files:
26
- - README
25
+ - README.markdown
27
26
  - COPYING
28
27
  - Rakefile
29
- - test/benchmark.rb
30
- - test/benchmark.txt
31
28
  - test/MarkdownTest_1.0
32
29
  - test/MarkdownTest_1.0.3
33
- - test/rdiscount_test.rb
30
+ - test/benchmark.rb
31
+ - test/benchmark.txt
32
+ - test/markdown_test.rb
33
+ - lib/markdown.rb
34
34
  - lib/rdiscount.rb
35
35
  - ext/extconf.rb
36
36
  - ext/docheader.c
@@ -69,9 +69,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  requirements: []
70
70
 
71
71
  rubyforge_project: wink
72
- rubygems_version: 1.1.1
72
+ rubygems_version: 1.2.0
73
73
  signing_key:
74
74
  specification_version: 2
75
75
  summary: Fast Implementation of Gruber's Markdown in C
76
76
  test_files:
77
- - test/rdiscount_test.rb
77
+ - test/markdown_test.rb