redcarpet 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of redcarpet might be problematic. Click here for more details.

Files changed (4) hide show
  1. data/ext/xhtml.c +26 -9
  2. data/lib/redcarpet.rb +1 -1
  3. data/redcarpet.gemspec +2 -2
  4. metadata +4 -4
data/ext/xhtml.c CHANGED
@@ -68,17 +68,34 @@ lus_attr_escape(struct buf *ob, const char *src, size_t size)
68
68
  static int
69
69
  is_html_tag(struct buf *tag, const char *tagname)
70
70
  {
71
- size_t i;
71
+ size_t i = 0;
72
+
73
+ if (i < tag->size && tag->data[0] != '<')
74
+ return 0;
75
+
76
+ i++;
77
+
78
+ while (i < tag->size && isspace(tag->data[i]))
79
+ i++;
72
80
 
73
- for (i = 0; i < tag->size; ++i) {
74
- if (tagname[i] == '>')
81
+ if (i < tag->size && tag->data[i] == '/')
82
+ i++;
83
+
84
+ while (i < tag->size && isspace(tag->data[i]))
85
+ i++;
86
+
87
+ for (; i < tag->size; ++i, ++tagname) {
88
+ if (*tagname == 0)
75
89
  break;
76
90
 
77
- if (tag->data[i] != tagname[i])
91
+ if (tag->data[i] != *tagname)
78
92
  return 0;
79
93
  }
80
94
 
81
- return (i == tag->size || isspace(tag->data[i]) || tag->data[i] == '>');
95
+ if (i == tag->size)
96
+ return 0;
97
+
98
+ return (isspace(tag->data[i]) || tag->data[i] == '>');
82
99
  }
83
100
 
84
101
  /********************
@@ -261,7 +278,7 @@ rndr_paragraph(struct buf *ob, struct buf *text, void *opaque)
261
278
  if (i >= text->size)
262
279
  break;
263
280
 
264
- BUFPUTSL(ob, "<br/>");
281
+ BUFPUTSL(ob, "<br/>\n");
265
282
  i++;
266
283
  }
267
284
  } else {
@@ -339,13 +356,13 @@ rndr_raw_html(struct buf *ob, struct buf *text, void *opaque)
339
356
  if (options->flags & XHTML_SKIP_HTML)
340
357
  escape_html = 1;
341
358
 
342
- else if ((options->flags & XHTML_SKIP_STYLE) != 0 && is_html_tag(text, "<style>"))
359
+ else if ((options->flags & XHTML_SKIP_STYLE) != 0 && is_html_tag(text, "style"))
343
360
  escape_html = 1;
344
361
 
345
- else if ((options->flags & XHTML_SKIP_LINKS) != 0 && is_html_tag(text, "<a>"))
362
+ else if ((options->flags & XHTML_SKIP_LINKS) != 0 && is_html_tag(text, "a"))
346
363
  escape_html = 1;
347
364
 
348
- else if ((options->flags & XHTML_SKIP_IMAGES) != 0 && is_html_tag(text, "<img>"))
365
+ else if ((options->flags & XHTML_SKIP_IMAGES) != 0 && is_html_tag(text, "img"))
349
366
  escape_html = 1;
350
367
 
351
368
 
data/lib/redcarpet.rb CHANGED
@@ -26,7 +26,7 @@
26
26
  # end
27
27
  #
28
28
  class Redcarpet
29
- VERSION = '1.8.0'
29
+ VERSION = '1.8.1'
30
30
 
31
31
  # Original Markdown formatted text.
32
32
  attr_reader :text
data/redcarpet.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'redcarpet'
3
- s.version = '1.8.0'
3
+ s.version = '1.8.1'
4
4
  s.summary = "Ruby bindings for libupskirt"
5
5
  s.description = 'A fast and safe Markdown to (X)HTML parser'
6
- s.date = '2011-04-16'
6
+ s.date = '2011-04-17'
7
7
  s.email = 'vicent@github.com'
8
8
  s.homepage = 'http://github.com/tanoku/redcarpet'
9
9
  s.has_rdoc = true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redcarpet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 0
10
- version: 1.8.0
9
+ - 1
10
+ version: 1.8.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Natacha Port\xC3\xA9"
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-04-16 00:00:00 +03:00
19
+ date: 2011-04-17 00:00:00 +03:00
20
20
  default_executable:
21
21
  dependencies: []
22
22