bluecloth 2.0.5-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +784 -0
- data/LICENSE +27 -0
- data/LICENSE.discount +47 -0
- data/README +81 -0
- data/Rakefile +346 -0
- data/Rakefile.local +63 -0
- data/bin/bluecloth +84 -0
- data/ext/Csio.c +61 -0
- data/ext/VERSION +1 -0
- data/ext/amalloc.h +29 -0
- data/ext/bluecloth.c +377 -0
- data/ext/config.h +51 -0
- data/ext/css.c +76 -0
- data/ext/cstring.h +74 -0
- data/ext/docheader.c +43 -0
- data/ext/extconf.rb +48 -0
- data/ext/generate.c +1481 -0
- data/ext/markdown.c +970 -0
- data/ext/markdown.h +145 -0
- data/ext/mkdio.c +303 -0
- data/ext/mkdio.h +78 -0
- data/ext/resource.c +155 -0
- data/ext/version.c +28 -0
- data/ext/xml.c +82 -0
- data/ext/xmlpage.c +48 -0
- data/lib/bluecloth.rb +161 -0
- data/rake/191_compat.rb +26 -0
- data/rake/dependencies.rb +76 -0
- data/rake/helpers.rb +412 -0
- data/rake/hg.rb +214 -0
- data/rake/manual.rb +782 -0
- data/rake/packaging.rb +135 -0
- data/rake/publishing.rb +321 -0
- data/rake/rdoc.rb +30 -0
- data/rake/style.rb +62 -0
- data/rake/svn.rb +668 -0
- data/rake/testing.rb +187 -0
- data/rake/verifytask.rb +64 -0
- data/rake/win32.rb +190 -0
- data/spec/bluecloth/101_changes_spec.rb +141 -0
- data/spec/bluecloth/autolinks_spec.rb +49 -0
- data/spec/bluecloth/blockquotes_spec.rb +143 -0
- data/spec/bluecloth/code_spans_spec.rb +164 -0
- data/spec/bluecloth/emphasis_spec.rb +164 -0
- data/spec/bluecloth/entities_spec.rb +65 -0
- data/spec/bluecloth/hrules_spec.rb +90 -0
- data/spec/bluecloth/images_spec.rb +92 -0
- data/spec/bluecloth/inline_html_spec.rb +238 -0
- data/spec/bluecloth/links_spec.rb +171 -0
- data/spec/bluecloth/lists_spec.rb +294 -0
- data/spec/bluecloth/paragraphs_spec.rb +75 -0
- data/spec/bluecloth/titles_spec.rb +305 -0
- data/spec/bluecloth_spec.rb +250 -0
- data/spec/bugfix_spec.rb +136 -0
- data/spec/contributions_spec.rb +85 -0
- data/spec/data/antsugar.txt +34 -0
- data/spec/data/markdowntest/Amps and angle encoding.html +17 -0
- data/spec/data/markdowntest/Amps and angle encoding.text +21 -0
- data/spec/data/markdowntest/Auto links.html +18 -0
- data/spec/data/markdowntest/Auto links.text +13 -0
- data/spec/data/markdowntest/Backslash escapes.html +118 -0
- data/spec/data/markdowntest/Backslash escapes.text +120 -0
- data/spec/data/markdowntest/Blockquotes with code blocks.html +15 -0
- data/spec/data/markdowntest/Blockquotes with code blocks.text +11 -0
- data/spec/data/markdowntest/Code Blocks.html +18 -0
- data/spec/data/markdowntest/Code Blocks.text +14 -0
- data/spec/data/markdowntest/Code Spans.html +5 -0
- data/spec/data/markdowntest/Code Spans.text +5 -0
- data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.html +8 -0
- data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.text +8 -0
- data/spec/data/markdowntest/Horizontal rules.html +71 -0
- data/spec/data/markdowntest/Horizontal rules.text +67 -0
- data/spec/data/markdowntest/Inline HTML (Advanced).html +15 -0
- data/spec/data/markdowntest/Inline HTML (Advanced).text +15 -0
- data/spec/data/markdowntest/Inline HTML (Simple).html +72 -0
- data/spec/data/markdowntest/Inline HTML (Simple).text +69 -0
- data/spec/data/markdowntest/Inline HTML comments.html +13 -0
- data/spec/data/markdowntest/Inline HTML comments.text +13 -0
- data/spec/data/markdowntest/Links, inline style.html +11 -0
- data/spec/data/markdowntest/Links, inline style.text +12 -0
- data/spec/data/markdowntest/Links, reference style.html +52 -0
- data/spec/data/markdowntest/Links, reference style.text +71 -0
- data/spec/data/markdowntest/Links, shortcut references.html +9 -0
- data/spec/data/markdowntest/Links, shortcut references.text +20 -0
- data/spec/data/markdowntest/Literal quotes in titles.html +3 -0
- data/spec/data/markdowntest/Literal quotes in titles.text +7 -0
- data/spec/data/markdowntest/Markdown Documentation - Basics.html +314 -0
- data/spec/data/markdowntest/Markdown Documentation - Basics.text +306 -0
- data/spec/data/markdowntest/Markdown Documentation - Syntax.html +942 -0
- data/spec/data/markdowntest/Markdown Documentation - Syntax.text +888 -0
- data/spec/data/markdowntest/Nested blockquotes.html +9 -0
- data/spec/data/markdowntest/Nested blockquotes.text +5 -0
- data/spec/data/markdowntest/Ordered and unordered lists.html +148 -0
- data/spec/data/markdowntest/Ordered and unordered lists.text +131 -0
- data/spec/data/markdowntest/Strong and em together.html +7 -0
- data/spec/data/markdowntest/Strong and em together.text +7 -0
- data/spec/data/markdowntest/Tabs.html +25 -0
- data/spec/data/markdowntest/Tabs.text +21 -0
- data/spec/data/markdowntest/Tidyness.html +8 -0
- data/spec/data/markdowntest/Tidyness.text +5 -0
- data/spec/data/ml-announce.txt +17 -0
- data/spec/data/re-overflow.txt +67 -0
- data/spec/data/re-overflow2.txt +281 -0
- data/spec/discount_spec.rb +67 -0
- data/spec/lib/constants.rb +5 -0
- data/spec/lib/helpers.rb +137 -0
- data/spec/lib/matchers.rb +235 -0
- data/spec/markdowntest_spec.rb +79 -0
- metadata +329 -0
data/ext/resource.c
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
/* markdown: a C implementation of John Gruber's Markdown markup language.
|
2
|
+
*
|
3
|
+
* Copyright (C) 2007 David L Parsons.
|
4
|
+
* The redistribution terms are provided in the COPYRIGHT file that must
|
5
|
+
* be distributed with this source code.
|
6
|
+
*/
|
7
|
+
#include <stdio.h>
|
8
|
+
#include <string.h>
|
9
|
+
#include <stdarg.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <time.h>
|
12
|
+
#include <ctype.h>
|
13
|
+
|
14
|
+
#include "config.h"
|
15
|
+
|
16
|
+
#include "cstring.h"
|
17
|
+
#include "markdown.h"
|
18
|
+
#include "amalloc.h"
|
19
|
+
|
20
|
+
/* free a (single) line
|
21
|
+
*/
|
22
|
+
void
|
23
|
+
___mkd_freeLine(Line *ptr)
|
24
|
+
{
|
25
|
+
DELETE(ptr->text);
|
26
|
+
free(ptr);
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
/* free a list of lines
|
31
|
+
*/
|
32
|
+
void
|
33
|
+
___mkd_freeLines(Line *p)
|
34
|
+
{
|
35
|
+
if (p->next)
|
36
|
+
___mkd_freeLines(p->next);
|
37
|
+
___mkd_freeLine(p);
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
/* bye bye paragraph.
|
42
|
+
*/
|
43
|
+
void
|
44
|
+
___mkd_freeParagraph(Paragraph *p)
|
45
|
+
{
|
46
|
+
if (p->next)
|
47
|
+
___mkd_freeParagraph(p->next);
|
48
|
+
if (p->down)
|
49
|
+
___mkd_freeParagraph(p->down);
|
50
|
+
if (p->text)
|
51
|
+
___mkd_freeLines(p->text);
|
52
|
+
if (p->ident)
|
53
|
+
free(p->ident);
|
54
|
+
free(p);
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
/* bye bye footnote.
|
59
|
+
*/
|
60
|
+
void
|
61
|
+
___mkd_freefootnote(Footnote *f)
|
62
|
+
{
|
63
|
+
DELETE(f->tag);
|
64
|
+
DELETE(f->link);
|
65
|
+
DELETE(f->title);
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
/* bye bye footnotes.
|
70
|
+
*/
|
71
|
+
void
|
72
|
+
___mkd_freefootnotes(MMIOT *f)
|
73
|
+
{
|
74
|
+
int i;
|
75
|
+
|
76
|
+
if ( f->footnotes ) {
|
77
|
+
for (i=0; i < S(*f->footnotes); i++)
|
78
|
+
___mkd_freefootnote( &T(*f->footnotes)[i] );
|
79
|
+
DELETE(*f->footnotes);
|
80
|
+
free(f->footnotes);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
/* initialize a new MMIOT
|
86
|
+
*/
|
87
|
+
void
|
88
|
+
___mkd_initmmiot(MMIOT *f, void *footnotes)
|
89
|
+
{
|
90
|
+
if ( f ) {
|
91
|
+
memset(f, 0, sizeof *f);
|
92
|
+
CREATE(f->in);
|
93
|
+
CREATE(f->out);
|
94
|
+
CREATE(f->Q);
|
95
|
+
if ( footnotes )
|
96
|
+
f->footnotes = footnotes;
|
97
|
+
else {
|
98
|
+
f->footnotes = malloc(sizeof f->footnotes[0]);
|
99
|
+
CREATE(*f->footnotes);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
/* free the contents of a MMIOT, but leave the object alone.
|
106
|
+
*/
|
107
|
+
void
|
108
|
+
___mkd_freemmiot(MMIOT *f, void *footnotes)
|
109
|
+
{
|
110
|
+
if ( f ) {
|
111
|
+
DELETE(f->in);
|
112
|
+
DELETE(f->out);
|
113
|
+
DELETE(f->Q);
|
114
|
+
if ( f->footnotes != footnotes )
|
115
|
+
___mkd_freefootnotes(f);
|
116
|
+
memset(f, 0, sizeof *f);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
/* free lines up to an barrier.
|
122
|
+
*/
|
123
|
+
void
|
124
|
+
___mkd_freeLineRange(Line *anchor, Line *stop)
|
125
|
+
{
|
126
|
+
Line *r = anchor->next;
|
127
|
+
|
128
|
+
if ( r != stop ) {
|
129
|
+
while ( r && (r->next != stop) )
|
130
|
+
r = r->next;
|
131
|
+
if ( r ) r->next = 0;
|
132
|
+
___mkd_freeLines(anchor->next);
|
133
|
+
}
|
134
|
+
anchor->next = 0;
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
/* clean up everything allocated in __mkd_compile()
|
139
|
+
*/
|
140
|
+
void
|
141
|
+
mkd_cleanup(Document *doc)
|
142
|
+
{
|
143
|
+
if ( doc ) {
|
144
|
+
if ( doc->ctx ) {
|
145
|
+
___mkd_freemmiot(doc->ctx, 0);
|
146
|
+
free(doc->ctx);
|
147
|
+
}
|
148
|
+
|
149
|
+
if ( doc->code) ___mkd_freeParagraph(doc->code);
|
150
|
+
if ( doc->headers ) ___mkd_freeLines(doc->headers);
|
151
|
+
if ( T(doc->content) ) ___mkd_freeLines(T(doc->content));
|
152
|
+
memset(doc, 0, sizeof doc[0]);
|
153
|
+
free(doc);
|
154
|
+
}
|
155
|
+
}
|
data/ext/version.c
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#include "config.h"
|
2
|
+
|
3
|
+
char markdown_version[] = VERSION
|
4
|
+
#if DL_TAG_EXTENSION
|
5
|
+
" DL_TAG"
|
6
|
+
#endif
|
7
|
+
#if PANDOC_HEADER
|
8
|
+
" HEADER"
|
9
|
+
#endif
|
10
|
+
#if 4 != 4
|
11
|
+
" TAB=4"
|
12
|
+
#endif
|
13
|
+
#if USE_AMALLOC
|
14
|
+
" DEBUG"
|
15
|
+
#endif
|
16
|
+
#if SUPERSCRIPT
|
17
|
+
" SUPERSCRIPT"
|
18
|
+
#endif
|
19
|
+
#if RELAXED_EMPHASIS
|
20
|
+
" RELAXED"
|
21
|
+
#endif
|
22
|
+
#if DIV_QUOTE
|
23
|
+
" DIV"
|
24
|
+
#endif
|
25
|
+
#if ALPHA_LIST
|
26
|
+
" AL"
|
27
|
+
#endif
|
28
|
+
;
|
data/ext/xml.c
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
/* markdown: a C implementation of John Gruber's Markdown markup language.
|
2
|
+
*
|
3
|
+
* Copyright (C) 2007 David L Parsons.
|
4
|
+
* The redistribution terms are provided in the COPYRIGHT file that must
|
5
|
+
* be distributed with this source code.
|
6
|
+
*/
|
7
|
+
#include <stdio.h>
|
8
|
+
#include <string.h>
|
9
|
+
#include <stdarg.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <time.h>
|
12
|
+
#include <ctype.h>
|
13
|
+
|
14
|
+
#include "config.h"
|
15
|
+
|
16
|
+
#include "cstring.h"
|
17
|
+
#include "markdown.h"
|
18
|
+
#include "amalloc.h"
|
19
|
+
|
20
|
+
/* return the xml version of a character
|
21
|
+
*/
|
22
|
+
static char *
|
23
|
+
mkd_xmlchar(unsigned char c)
|
24
|
+
{
|
25
|
+
switch (c) {
|
26
|
+
case '<': return "<";
|
27
|
+
case '>': return ">";
|
28
|
+
case '&': return "&";
|
29
|
+
case '"': return """;
|
30
|
+
case '\'': return "'";
|
31
|
+
default: if ( isascii(c) || (c & 0x80) )
|
32
|
+
return 0;
|
33
|
+
return "";
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
/* write output in XML format
|
39
|
+
*/
|
40
|
+
int
|
41
|
+
mkd_generatexml(char *p, int size, FILE *out)
|
42
|
+
{
|
43
|
+
unsigned char c;
|
44
|
+
char *entity;
|
45
|
+
|
46
|
+
while ( size-- > 0 ) {
|
47
|
+
c = *p++;
|
48
|
+
|
49
|
+
if ( entity = mkd_xmlchar(c) )
|
50
|
+
fputs(entity, out);
|
51
|
+
else
|
52
|
+
fputc(c, out);
|
53
|
+
}
|
54
|
+
return 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
/* build a xml'ed version of a string
|
59
|
+
*/
|
60
|
+
int
|
61
|
+
mkd_xml(char *p, int size, char **res)
|
62
|
+
{
|
63
|
+
unsigned char c;
|
64
|
+
char *entity;
|
65
|
+
Cstring f;
|
66
|
+
|
67
|
+
CREATE(f);
|
68
|
+
RESERVE(f, 100);
|
69
|
+
|
70
|
+
while ( size-- > 0 ) {
|
71
|
+
c = *p++;
|
72
|
+
if ( entity = mkd_xmlchar(c) )
|
73
|
+
Cswrite(&f, entity, strlen(entity));
|
74
|
+
else
|
75
|
+
Csputc(c, &f);
|
76
|
+
}
|
77
|
+
/* HACK ALERT! HACK ALERT! HACK ALERT! */
|
78
|
+
*res = T(f); /* we know that a T(Cstring) is a character pointer */
|
79
|
+
/* so we can simply pick it up and carry it away, */
|
80
|
+
return S(f); /* leaving the husk of the Ctring on the stack */
|
81
|
+
/* END HACK ALERT */
|
82
|
+
}
|
data/ext/xmlpage.c
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
* xmlpage -- write a skeletal xhtml page
|
3
|
+
*
|
4
|
+
* Copyright (C) 2007 David L Parsons.
|
5
|
+
* The redistribution terms are provided in the COPYRIGHT file that must
|
6
|
+
* be distributed with this source code.
|
7
|
+
*/
|
8
|
+
#include "config.h"
|
9
|
+
#include <stdio.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <ctype.h>
|
12
|
+
|
13
|
+
#include "cstring.h"
|
14
|
+
#include "markdown.h"
|
15
|
+
#include "amalloc.h"
|
16
|
+
|
17
|
+
|
18
|
+
int
|
19
|
+
mkd_xhtmlpage(Document *p, int flags, FILE *out)
|
20
|
+
{
|
21
|
+
char *title;
|
22
|
+
extern char *mkd_doc_title(Document *);
|
23
|
+
|
24
|
+
if ( mkd_compile(p, flags) ) {
|
25
|
+
fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
26
|
+
fprintf(out, "<!DOCTYPE html "
|
27
|
+
" PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
|
28
|
+
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
|
29
|
+
|
30
|
+
fprintf(out, "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n");
|
31
|
+
|
32
|
+
fprintf(out, "<head>\n");
|
33
|
+
if ( title = mkd_doc_title(p) )
|
34
|
+
fprintf(out, "<title>%s</title>\n", title);
|
35
|
+
mkd_generatecss(p, out);
|
36
|
+
fprintf(out, "</head>\n");
|
37
|
+
|
38
|
+
fprintf(out, "<body>\n");
|
39
|
+
mkd_generatehtml(p, out);
|
40
|
+
fprintf(out, "</body>\n");
|
41
|
+
fprintf(out, "</html>\n");
|
42
|
+
|
43
|
+
mkd_cleanup(p);
|
44
|
+
|
45
|
+
return 0;
|
46
|
+
}
|
47
|
+
return -1;
|
48
|
+
}
|
data/lib/bluecloth.rb
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
#
|
4
|
+
# Bluecloth is a Ruby implementation of Markdown, a text-to-HTML conversion
|
5
|
+
# tool.
|
6
|
+
#
|
7
|
+
# == Authors
|
8
|
+
#
|
9
|
+
# * Michael Granger <ged@FaerieMUD.org>
|
10
|
+
#
|
11
|
+
# == Contributors
|
12
|
+
#
|
13
|
+
# * Martin Chase <stillflame@FaerieMUD.org> - Peer review, helpful suggestions
|
14
|
+
# * Florian Gross <flgr@ccan.de> - Filter options, suggestions
|
15
|
+
#
|
16
|
+
# This product includes software developed by David Loren Parsons
|
17
|
+
# <http://www.pell.portland.or.us/~orc>.
|
18
|
+
#
|
19
|
+
# == Version
|
20
|
+
#
|
21
|
+
# $Id$
|
22
|
+
#
|
23
|
+
# == License
|
24
|
+
#
|
25
|
+
# :include: LICENSE
|
26
|
+
#--
|
27
|
+
# Please see the LICENSE file included in the distribution for copyright and licensing details.
|
28
|
+
#
|
29
|
+
class BlueCloth
|
30
|
+
|
31
|
+
# Release Version
|
32
|
+
VERSION = '2.0.5'
|
33
|
+
|
34
|
+
# SVN Revision
|
35
|
+
SVNREV = %q$Rev$
|
36
|
+
|
37
|
+
# SVN Id tag
|
38
|
+
SVNID = %q$Id$
|
39
|
+
|
40
|
+
# The defaults for all supported options.
|
41
|
+
DEFAULT_OPTIONS = {
|
42
|
+
:remove_links => false,
|
43
|
+
:remove_images => false,
|
44
|
+
:smartypants => true,
|
45
|
+
:pseudoprotocols => false,
|
46
|
+
:pandoc_headers => false,
|
47
|
+
:header_labels => false,
|
48
|
+
:escape_html => false,
|
49
|
+
:strict_mode => true,
|
50
|
+
:auto_links => false,
|
51
|
+
:safe_links => false,
|
52
|
+
}.freeze
|
53
|
+
|
54
|
+
# The number of characters of the original markdown source to include in the
|
55
|
+
# output of #inspect
|
56
|
+
INSPECT_TEXT_LENGTH = 50
|
57
|
+
|
58
|
+
|
59
|
+
#################################################################
|
60
|
+
### C L A S S M E T H O D S
|
61
|
+
#################################################################
|
62
|
+
|
63
|
+
### Convert the specified +opthash+ into a flags bitmask. If it's already a
|
64
|
+
### Fixnum (e.g., if someone passed in an ORed flags argument instead of an
|
65
|
+
### opthash), just return it as-is.
|
66
|
+
def self::flags_from_opthash( opthash={} )
|
67
|
+
return opthash if opthash.is_a?( Integer )
|
68
|
+
|
69
|
+
# Support BlueCloth1-style options
|
70
|
+
if opthash == :filter_html || opthash == [:filter_html]
|
71
|
+
opthash = { :escape_html => true }
|
72
|
+
elsif opthash == :filter_styles
|
73
|
+
opthash = {}
|
74
|
+
elsif !opthash.is_a?( Hash )
|
75
|
+
raise ArgumentError, "option %p not supported" % [ opthash ]
|
76
|
+
end
|
77
|
+
|
78
|
+
flags = 0
|
79
|
+
|
80
|
+
if opthash[:remove_links] then flags |= MKD_NOLINKS; end
|
81
|
+
if opthash[:remove_images] then flags |= MKD_NOIMAGE; end
|
82
|
+
if ! opthash[:smartypants] then flags |= MKD_NOPANTS; end
|
83
|
+
if ! opthash[:pseudoprotocols] then flags |= MKD_NO_EXT; end
|
84
|
+
if ! opthash[:pandoc_headers] then flags |= MKD_NOHEADER; end
|
85
|
+
if opthash[:header_labels] then flags |= MKD_TOC; end
|
86
|
+
if opthash[:mdtest_1_compat] then flags |= MKD_1_COMPAT; end
|
87
|
+
if opthash[:escape_html] then flags |= MKD_NOHTML; end
|
88
|
+
if opthash[:strict_mode] then flags |= MKD_STRICT; end
|
89
|
+
if opthash[:tagtext_mode] then flags |= MKD_TAGTEXT; end
|
90
|
+
if opthash[:auto_links] then flags |= MKD_AUTOLINK; end
|
91
|
+
if opthash[:safe_links] then flags |= MKD_SAFELINK; end
|
92
|
+
|
93
|
+
return flags
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
### Returns a Hash that reflects the settings from the specified +flags+ Integer.
|
98
|
+
def self::opthash_from_flags( flags=0 )
|
99
|
+
flags = flags.to_i
|
100
|
+
|
101
|
+
opthash = {}
|
102
|
+
if ( flags & MKD_NOLINKS ).nonzero? then opthash[:remove_links] = true; end
|
103
|
+
if ( flags & MKD_NOIMAGE ).nonzero? then opthash[:remove_images] = true; end
|
104
|
+
if !( flags & MKD_NOPANTS ).nonzero? then opthash[:smartypants] = true; end
|
105
|
+
if !( flags & MKD_NO_EXT ).nonzero? then opthash[:pseudoprotocols] = true; end
|
106
|
+
if !( flags & MKD_NOHEADER ).nonzero? then opthash[:pandoc_headers] = true; end
|
107
|
+
if ( flags & MKD_TOC ).nonzero? then opthash[:header_labels] = true; end
|
108
|
+
if ( flags & MKD_1_COMPAT ).nonzero? then opthash[:mdtest_1_compat] = true; end
|
109
|
+
if ( flags & MKD_NOHTML ).nonzero? then opthash[:escape_html] = true; end
|
110
|
+
if ( flags & MKD_STRICT ).nonzero? then opthash[:strict_mode] = true; end
|
111
|
+
if ( flags & MKD_TAGTEXT ).nonzero? then opthash[:tagtext_mode] = true; end
|
112
|
+
if ( flags & MKD_AUTOLINK ).nonzero? then opthash[:auto_links] = true; end
|
113
|
+
if ( flags & MKD_SAFELINK ).nonzero? then opthash[:safe_links] = true; end
|
114
|
+
|
115
|
+
return opthash
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
#################################################################
|
120
|
+
### I N S T A N C E M E T H O D S
|
121
|
+
#################################################################
|
122
|
+
|
123
|
+
### Return a human-readable representation of the object suitable for debugging.
|
124
|
+
def inspect
|
125
|
+
return "#<%s:0x%x text: %p; options: %p>" % [
|
126
|
+
self.class.name,
|
127
|
+
self.object_id / 2,
|
128
|
+
self.text.length > INSPECT_TEXT_LENGTH ?
|
129
|
+
self.text[ 0, INSPECT_TEXT_LENGTH - 5] + '[...]' :
|
130
|
+
self.text,
|
131
|
+
self.options,
|
132
|
+
]
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
### Backward-compatible method: return +true+ if the object's :escape_html option was
|
137
|
+
### set.
|
138
|
+
def filter_html
|
139
|
+
return self.options[:escape_html]
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
### Backward-compatible method: raises an appropriate error notifying the user that
|
144
|
+
### BlueCloth2 doesn't support this option.
|
145
|
+
def filter_html=( arg )
|
146
|
+
raise NotImplementedError,
|
147
|
+
"Sorry, this version of BlueCloth no longer supports toggling of HTML filtering" +
|
148
|
+
"via #filter_html=. You now must create the BlueCloth object with the :escape_html" +
|
149
|
+
"option set to true instead."
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
end # class BlueCloth
|
155
|
+
|
156
|
+
require 'bluecloth_ext'
|
157
|
+
|
158
|
+
# Set the top-level 'Markdown' constant if it isn't already set
|
159
|
+
::Markdown = ::BlueCloth unless defined?( ::Markdown )
|
160
|
+
|
161
|
+
|