bluecloth 2.0.10 → 2.0.11pre158

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gemtest +0 -0
  3. data/History.md +4 -0
  4. data/LICENSE +1 -1
  5. data/Manifest.txt +103 -0
  6. data/README.md +103 -0
  7. data/Rakefile +95 -324
  8. data/ext/VERSION +1 -1
  9. data/ext/bluecloth.c +1 -1
  10. data/ext/bluecloth.h +1 -1
  11. data/ext/extconf.rb +7 -9
  12. data/ext/generate.c +5 -6
  13. data/ext/markdown.c +12 -8
  14. data/lib/bluecloth.rb +14 -11
  15. data/spec/bluecloth/101_changes_spec.rb +0 -4
  16. data/spec/bluecloth/TEMPLATE +36 -0
  17. data/spec/bluecloth/autolinks_spec.rb +2 -6
  18. data/spec/bluecloth/blockquotes_spec.rb +1 -5
  19. data/spec/bluecloth/code_spans_spec.rb +0 -4
  20. data/spec/bluecloth/emphasis_spec.rb +0 -4
  21. data/spec/bluecloth/entities_spec.rb +0 -4
  22. data/spec/bluecloth/hrules_spec.rb +0 -4
  23. data/spec/bluecloth/images_spec.rb +0 -4
  24. data/spec/bluecloth/inline_html_spec.rb +0 -4
  25. data/spec/bluecloth/links_spec.rb +0 -4
  26. data/spec/bluecloth/lists_spec.rb +0 -4
  27. data/spec/bluecloth/paragraphs_spec.rb +0 -4
  28. data/spec/bluecloth/titles_spec.rb +0 -4
  29. data/spec/bluecloth_spec.rb +3 -5
  30. data/spec/bugfix_spec.rb +6 -8
  31. data/spec/contributions_spec.rb +0 -2
  32. data/spec/discount_spec.rb +2 -6
  33. data/spec/lib/helpers.rb +24 -0
  34. data/spec/lib/matchers.rb +1 -0
  35. data/spec/markdowntest_spec.rb +0 -4
  36. metadata +222 -139
  37. metadata.gz.sig +0 -0
  38. data/ChangeLog +0 -444
  39. data/README +0 -81
  40. data/Rakefile.local +0 -48
  41. data/rake/191_compat.rb +0 -26
  42. data/rake/dependencies.rb +0 -76
  43. data/rake/documentation.rb +0 -123
  44. data/rake/helpers.rb +0 -502
  45. data/rake/hg.rb +0 -318
  46. data/rake/manual.rb +0 -787
  47. data/rake/packaging.rb +0 -129
  48. data/rake/publishing.rb +0 -341
  49. data/rake/style.rb +0 -62
  50. data/rake/svn.rb +0 -668
  51. data/rake/testing.rb +0 -152
  52. data/rake/verifytask.rb +0 -64
data/ext/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.4
1
+ 2.0.5
data/ext/bluecloth.c CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * BlueCloth -- a Ruby implementation of Markdown
3
- * $Id: bluecloth.c,v a12b01a92197 2011/01/17 17:13:22 ged $
3
+ * $Id: bluecloth.c,v 0cda68a5fc00 2011/02/09 22:33:27 ged $
4
4
  *
5
5
  * = Authors
6
6
  *
data/ext/bluecloth.h CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * BlueCloth -- a Ruby implementation of Markdown
3
- * $Id: bluecloth.h,v 055519ec5f78 2010/09/17 20:42:27 ged $
3
+ * $Id: bluecloth.h,v 0cda68a5fc00 2011/02/09 22:33:27 ged $
4
4
  *
5
5
  */
6
6
 
data/ext/extconf.rb CHANGED
@@ -13,19 +13,17 @@ version = versionfile.read.chomp
13
13
  if CONFIG['host_os'].match( 'mswin' )
14
14
  $CFLAGS << ' -I.' << ' -W3' << ' -Zi'
15
15
  else
16
- $CFLAGS << ' -I.' << ' -Wall'
16
+ $CFLAGS << ' -I.'
17
17
  end
18
18
  $CPPFLAGS << %Q{ -DVERSION=\\"#{version}\\"}
19
19
 
20
20
  # Add my own debugging hooks if building for me
21
- if ENV['DEBUGGING_BUILD']
21
+ if ENV['MAINTAINER_MODE']
22
+ $stderr.puts "Maintainer mode enabled."
23
+ $CFLAGS << ' -Wall'
22
24
  $CFLAGS << ' -ggdb' << ' -DDEBUG'
23
25
  end
24
26
 
25
- def fail( *messages )
26
- $stderr.puts( *messages )
27
- exit( 1 )
28
- end
29
27
 
30
28
  # Stuff from configure.sh
31
29
  have_func( "srand" ) || have_func( "srandom" )
@@ -35,13 +33,13 @@ have_func( "random" ) || have_func( "rand" )
35
33
  have_func( "bzero", %w[string.h strings.h] )
36
34
 
37
35
  unless have_func( "strcasecmp" ) || have_func( "stricmp" )
38
- fail( "This extension requires either strcasecmp() or stricmp()" )
36
+ abort "This extension requires either strcasecmp() or stricmp()"
39
37
  end
40
38
  unless have_func( "strncasecmp" ) || have_func( "strnicmp" )
41
- fail( "This extensions requires either strncasecmp() or strnicmp()" )
39
+ abort "This extensions requires either strncasecmp() or strnicmp()"
42
40
  end
43
41
 
44
- have_header( 'mkdio.h' ) or fail( "missing mkdio.h" )
42
+ have_header( 'mkdio.h' ) or abort "missing mkdio.h"
45
43
 
46
44
  # Check for 1.9.xish encoding header
47
45
  have_header( 'ruby/encoding.h' )
data/ext/generate.c CHANGED
@@ -571,7 +571,7 @@ linkyformat(MMIOT *f, Cstring text, int image, Footnote *ref)
571
571
  {
572
572
  linkytype *tag;
573
573
 
574
- if ( image )
574
+ if ( image || (ref == 0) )
575
575
  tag = &imaget;
576
576
  else if ( tag = pseudo(ref->link) ) {
577
577
  if ( f->flags & (MKD_NO_EXT|MKD_SAFELINK) )
@@ -667,7 +667,7 @@ linkylinky(int image, MMIOT *f)
667
667
  sizeof key, (stfu)__mkd_footsort) )
668
668
  status = linkyformat(f, name, image, ref);
669
669
  else if ( f->flags & IS_LABEL )
670
- status = linkyformat(f, name, image, &imaget);
670
+ status = linkyformat(f, name, image, 0);
671
671
  }
672
672
  }
673
673
  }
@@ -1312,13 +1312,12 @@ text(MMIOT *f)
1312
1312
  static void
1313
1313
  printheader(Paragraph *pp, MMIOT *f)
1314
1314
  {
1315
- Qprintf(f, "<h%d", pp->hnumber);
1316
1315
  if ( f->flags & MKD_TOC ) {
1317
- Qprintf(f, " id=\"", pp->hnumber);
1316
+ Qstring("<a name=\"", f);
1318
1317
  mkd_string_to_anchor(T(pp->text->text), S(pp->text->text), Qchar, f, 1);
1319
- Qchar('"', f);
1318
+ Qstring("\"></a>\n", f);
1320
1319
  }
1321
- Qchar('>', f);
1320
+ Qprintf(f, "<h%d>", pp->hnumber);
1322
1321
  push(T(pp->text->text), S(pp->text->text), f);
1323
1322
  text(f);
1324
1323
  Qprintf(f, "</h%d>", pp->hnumber);
data/ext/markdown.c CHANGED
@@ -669,25 +669,29 @@ szmarkerclass(char *p)
669
669
  * check if the first line of a quoted block is the special div-not-quote
670
670
  * marker %[kind:]name%
671
671
  */
672
+ #define iscsschar(c) (isalpha(c) || (c == '-') || (c == '_') )
673
+
672
674
  static int
673
675
  isdivmarker(Line *p, int start, DWORD flags)
674
676
  {
675
677
  char *s;
676
- int len, i;
678
+ int last, i;
677
679
 
678
680
  if ( flags & (MKD_NODIVQUOTE|MKD_STRICT) )
679
681
  return 0;
680
682
 
681
- len = S(p->text);
682
- s = T(p->text);
683
+ last= S(p->text) - (1 + start);
684
+ s = T(p->text) + start;
683
685
 
684
- if ( !(len && s[start] == '%' && s[len-1] == '%') ) return 0;
686
+ if ( (last <= 0) || (*s != '%') || (s[last] != '%') )
687
+ return 0;
685
688
 
686
- i = szmarkerclass(s+start+1)+start;
687
- len -= start+1;
689
+ i = szmarkerclass(s+1);
688
690
 
689
- while ( ++i < len )
690
- if ( !isalnum(s[i]) )
691
+ if ( !iscsschar(s[i+1]) )
692
+ return 0;
693
+ while ( ++i < last )
694
+ if ( !(isdigit(s[i]) || iscsschar(s[i])) )
691
695
  return 0;
692
696
 
693
697
  return 1;
data/lib/bluecloth.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'pathname'
4
- require 'rbconfig'
5
-
6
3
  #
7
4
  # Bluecloth is a Ruby implementation of Markdown, a text-to-HTML conversion
8
5
  # tool.
@@ -21,7 +18,7 @@ require 'rbconfig'
21
18
  #
22
19
  # == Version
23
20
  #
24
- # $Id: bluecloth.rb,v 3dd45baec201 2011/01/17 17:14:20 ged $
21
+ # $Id: bluecloth.rb,v fd890510cecf 2011/02/10 15:39:54 ged $
25
22
  #
26
23
  # == License
27
24
  #
@@ -32,7 +29,7 @@ require 'rbconfig'
32
29
  class BlueCloth
33
30
 
34
31
  # Release Version
35
- VERSION = '2.0.10'
32
+ VERSION = '2.0.11'
36
33
 
37
34
  # The defaults for all supported options.
38
35
  DEFAULT_OPTIONS = {
@@ -179,17 +176,23 @@ class BlueCloth
179
176
 
180
177
  end # class BlueCloth
181
178
 
182
- # Load the correct version if it's a Windows binary gem
183
- if RUBY_PLATFORM =~/(mswin|mingw)/i
184
- major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
185
- raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
186
- require "#{major_minor}/bluecloth_ext"
187
- else
179
+ begin
188
180
  require 'bluecloth_ext'
181
+ rescue LoadError => err
182
+ # If it's a Windows binary gem, try the <major>.<minor> subdirectory
183
+ if RUBY_PLATFORM =~/(mswin|mingw)/i
184
+ major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
185
+ raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
186
+ require "#{major_minor}/bluecloth_ext"
187
+ else
188
+ raise
189
+ end
190
+
189
191
  end
190
192
 
191
193
 
192
194
 
195
+
193
196
  # Set the top-level 'Markdown' constant if it isn't already set
194
197
  ::Markdown = ::BlueCloth unless defined?( ::Markdown )
195
198
 
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "after the 1.0.1 changes" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  it "doesn't touch escapes in code blocks" do
33
29
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ BEGIN {
5
+ require 'pathname'
6
+ basedir = Pathname.new( __FILE__ ).dirname.parent.parent
7
+
8
+ libdir = basedir + 'lib'
9
+ extdir = basedir + 'ext'
10
+
11
+ $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
12
+ $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
13
+ $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
14
+ }
15
+
16
+ require 'rspec'
17
+ require 'bluecloth'
18
+
19
+ require 'spec/lib/helpers'
20
+
21
+
22
+ #####################################################################
23
+ ### C O N T E X T S
24
+ #####################################################################
25
+
26
+ describe BlueCloth, "" do
27
+
28
+ it "does something cool" do
29
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
30
+ ---
31
+ ---
32
+ end
33
+
34
+ end
35
+
36
+
@@ -4,10 +4,10 @@
4
4
  BEGIN {
5
5
  require 'pathname'
6
6
  basedir = Pathname.new( __FILE__ ).dirname.parent.parent
7
-
7
+
8
8
  libdir = basedir + 'lib'
9
9
  extdir = basedir + 'ext'
10
-
10
+
11
11
  $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
12
12
  $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
13
13
  $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "auto-links" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  it "supports HTTP auto-links" do
33
29
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "blockquotes" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  ### [Blockquotes]
33
29
 
@@ -113,7 +109,7 @@ describe BlueCloth, "blockquotes" do
113
109
  end
114
110
 
115
111
  # Blockquotes with a <pre> section
116
- it "supports block-level HTML inside of blockquotes" do
112
+ it "supports block-level HTML inside of blockquotes", :pedantic => true do
117
113
  pending "a fix in Discount" do
118
114
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
119
115
  > The best approximation of the problem is the following code:
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "that contains code blocks or spans" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  it "wraps CODE tags around backticked spans" do
33
29
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "emphasis" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  it "treats single asterisks as indicators of emphasis" do
33
29
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "document with entities" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  it "escapes special characters" do
33
29
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "horizontal rules" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  # Hrule -- three asterisks
33
29
  it "produces a horizontal rule tag from three asterisks on a line by themselves" do
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "images" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  ### [Images]
33
29
 
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "document with inline HTML" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  it "preserves TABLE block" do
33
29
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
@@ -16,8 +16,6 @@ require 'rspec'
16
16
  require 'bluecloth'
17
17
 
18
18
  require 'spec/lib/helpers'
19
- require 'spec/lib/constants'
20
- require 'spec/lib/matchers'
21
19
 
22
20
 
23
21
  #####################################################################
@@ -25,8 +23,6 @@ require 'spec/lib/matchers'
25
23
  #####################################################################
26
24
 
27
25
  describe BlueCloth, "links" do
28
- include BlueCloth::TestConstants,
29
- BlueCloth::Matchers
30
26
 
31
27
  it "supports inline links" do
32
28
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
@@ -17,8 +17,6 @@ require 'rspec'
17
17
  require 'bluecloth'
18
18
 
19
19
  require 'spec/lib/helpers'
20
- require 'spec/lib/constants'
21
- require 'spec/lib/matchers'
22
20
 
23
21
 
24
22
  #####################################################################
@@ -26,8 +24,6 @@ require 'spec/lib/matchers'
26
24
  #####################################################################
27
25
 
28
26
  describe BlueCloth, "lists" do
29
- include BlueCloth::TestConstants,
30
- BlueCloth::Matchers
31
27
 
32
28
  it "support unordered lists with asterisk bullets" do
33
29
  the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation