wikitext 1.5.2 → 1.5.3
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.
- data/ext/ary.c +20 -11
- data/ext/ary.h +20 -11
- data/ext/extconf.rb +20 -11
- data/ext/parser.c +57 -17
- data/ext/parser.h +20 -11
- data/ext/ruby_compat.h +20 -11
- data/ext/str.c +20 -11
- data/ext/str.h +20 -11
- data/ext/token.c +20 -11
- data/ext/token.h +20 -11
- data/ext/wikitext.c +20 -11
- data/ext/wikitext.h +20 -11
- data/ext/wikitext_ragel.h +20 -11
- data/lib/wikitext/nil_class.rb +20 -11
- data/lib/wikitext/parser.rb +20 -11
- data/lib/wikitext/rails.rb +20 -11
- data/lib/wikitext/string.rb +20 -11
- data/lib/wikitext/version.rb +21 -12
- data/rails/init.rb +20 -11
- data/spec/autolinking_spec.rb +20 -11
- data/spec/base_heading_level_spec.rb +20 -11
- data/spec/blockquote_spec.rb +20 -11
- data/spec/em_spec.rb +20 -11
- data/spec/encoding_spec.rb +20 -11
- data/spec/entity_spec.rb +20 -11
- data/spec/external_link_spec.rb +20 -11
- data/spec/fulltext_spec.rb +20 -11
- data/spec/h1_spec.rb +20 -11
- data/spec/h2_spec.rb +20 -11
- data/spec/h3_spec.rb +20 -11
- data/spec/h4_spec.rb +20 -11
- data/spec/h5_spec.rb +20 -11
- data/spec/h6_spec.rb +20 -11
- data/spec/img_spec.rb +20 -11
- data/spec/indentation_spec.rb +20 -11
- data/spec/integration_spec.rb +20 -11
- data/spec/internal_link_spec.rb +20 -11
- data/spec/line_endings_spec.rb +20 -11
- data/spec/link_encoding_spec.rb +20 -11
- data/spec/link_sanitizing_spec.rb +20 -11
- data/spec/nil_class_spec.rb +20 -11
- data/spec/nowiki_spec.rb +20 -11
- data/spec/p_spec.rb +20 -11
- data/spec/parser_spec.rb +20 -11
- data/spec/pre_spec.rb +20 -11
- data/spec/rails_spec.rb +20 -11
- data/spec/regressions_spec.rb +42 -11
- data/spec/spec_helper.rb +20 -11
- data/spec/string_spec.rb +20 -11
- data/spec/strong_em_spec.rb +20 -11
- data/spec/strong_spec.rb +20 -11
- data/spec/tokenizing_spec.rb +20 -11
- data/spec/tt_spec.rb +20 -11
- data/spec/ul_spec.rb +20 -11
- data/spec/version_spec.rb +20 -11
- data/spec/wikitext_spec.rb +20 -11
- metadata +2 -2
data/ext/ary.c
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "ary.h"
|
16
25
|
|
data/ext/ary.h
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "ruby_compat.h"
|
16
25
|
|
data/ext/extconf.rb
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
# Copyright 2008 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
1
|
+
# Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
3
|
+
# Redistribution and use in source and binary forms, with or without
|
4
|
+
# modification, are permitted provided that the following conditions are met:
|
11
5
|
#
|
12
|
-
#
|
13
|
-
#
|
6
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
# this list of conditions and the following disclaimer.
|
8
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer in the documentation
|
10
|
+
# and/or other materials provided with the distribution.
|
11
|
+
|
12
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
require 'mkmf'
|
16
25
|
|
data/ext/parser.c
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2007-2009 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2007-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "parser.h"
|
16
25
|
#include "ary.h"
|
@@ -846,6 +855,22 @@ VALUE Wikitext_parser_encode_special_link_target(VALUE self, VALUE in)
|
|
846
855
|
return parser.link_target;
|
847
856
|
}
|
848
857
|
|
858
|
+
// returns 1 (true) if supplied string is blank (nil, empty, or all whitespace)
|
859
|
+
// returns 0 (false) otherwise
|
860
|
+
int _Wikitext_blank(VALUE str)
|
861
|
+
{
|
862
|
+
if (NIL_P(str) || RSTRING_LEN(str) == 0)
|
863
|
+
return 1;
|
864
|
+
for (char *ptr = RSTRING_PTR(str),
|
865
|
+
*end = RSTRING_PTR(str) + RSTRING_LEN(str);
|
866
|
+
ptr < end; ptr++)
|
867
|
+
{
|
868
|
+
if (*ptr != ' ')
|
869
|
+
return 0;
|
870
|
+
}
|
871
|
+
return 1;
|
872
|
+
}
|
873
|
+
|
849
874
|
void _Wikitext_rollback_failed_link(parser_t *parser)
|
850
875
|
{
|
851
876
|
if (!IN(LINK_START))
|
@@ -2124,13 +2149,22 @@ VALUE Wikitext_parser_parse(int argc, VALUE *argv, VALUE self)
|
|
2124
2149
|
rb_str_cat(parser->link_target, token->start, TOKEN_LEN(token));
|
2125
2150
|
}
|
2126
2151
|
else if (type == LINK_END)
|
2152
|
+
{
|
2153
|
+
if (NIL_P(parser->link_target)) // bail for inputs like "[[]]"
|
2154
|
+
_Wikitext_rollback_failed_link(parser);
|
2127
2155
|
break; // jump back to top of loop (will handle this in LINK_END case below)
|
2156
|
+
}
|
2128
2157
|
else if (type == SEPARATOR)
|
2129
2158
|
{
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2159
|
+
if (NIL_P(parser->link_target)) // bail for inputs like "[[|"
|
2160
|
+
_Wikitext_rollback_failed_link(parser);
|
2161
|
+
else
|
2162
|
+
{
|
2163
|
+
ary_push(parser->scope, SEPARATOR);
|
2164
|
+
parser->link_text = rb_str_new2("");
|
2165
|
+
parser->capture = parser->link_text;
|
2166
|
+
token = NULL;
|
2167
|
+
}
|
2134
2168
|
break;
|
2135
2169
|
}
|
2136
2170
|
else // unexpected token (syntax error)
|
@@ -2155,9 +2189,15 @@ VALUE Wikitext_parser_parse(int argc, VALUE *argv, VALUE self)
|
|
2155
2189
|
else if (IN(EXT_LINK_START))
|
2156
2190
|
// already in external link scope! (and in fact, must be capturing link_text right now)
|
2157
2191
|
rb_str_cat(i, link_end, sizeof(link_end) - 1);
|
2158
|
-
else if (IN(LINK_START))
|
2192
|
+
else if (IN(LINK_START)) // in internal link scope!
|
2159
2193
|
{
|
2160
|
-
|
2194
|
+
if (_Wikitext_blank(parser->link_target))
|
2195
|
+
{
|
2196
|
+
// special case for inputs like "[[ ]]"
|
2197
|
+
_Wikitext_rollback_failed_link(parser);
|
2198
|
+
rb_str_cat(parser->output, link_end, sizeof(link_end) - 1);
|
2199
|
+
break;
|
2200
|
+
}
|
2161
2201
|
if (NIL_P(parser->link_text) || RSTRING_LEN(parser->link_text) == 0)
|
2162
2202
|
// use link target as link text
|
2163
2203
|
parser->link_text = _Wikitext_parser_sanitize_link_target(parser, Qfalse);
|
data/ext/parser.h
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "ruby_compat.h"
|
16
25
|
|
data/ext/ruby_compat.h
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include <ruby.h>
|
16
25
|
|
data/ext/str.c
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "str.h"
|
16
25
|
|
data/ext/str.h
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "ruby_compat.h"
|
16
25
|
|
data/ext/token.c
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008-2009 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "token.h"
|
16
25
|
#include "wikitext.h"
|
data/ext/token.h
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008-2009 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "ruby_compat.h"
|
16
25
|
#include <stdint.h> /* uint32_t */
|
data/ext/wikitext.c
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008-2009 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "wikitext_ragel.h"
|
16
25
|
#include "parser.h"
|
data/ext/wikitext.h
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "ruby_compat.h"
|
16
25
|
#include <stdint.h>
|
data/ext/wikitext_ragel.h
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
// Copyright 2008 Wincent Colaiuta
|
2
|
-
// This program is free software: you can redistribute it and/or modify
|
3
|
-
// it under the terms of the GNU General Public License as published by
|
4
|
-
// the Free Software Foundation, either version 3 of the License, or
|
5
|
-
// (at your option) any later version.
|
1
|
+
// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
// GNU General Public License for more details.
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
11
5
|
//
|
12
|
-
//
|
13
|
-
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
// this list of conditions and the following disclaimer.
|
8
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer in the documentation
|
10
|
+
// and/or other materials provided with the distribution.
|
11
|
+
//
|
12
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
// POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
#include "token.h"
|
16
25
|
|
data/lib/wikitext/nil_class.rb
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
# Copyright 2008 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
1
|
+
# Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
|
6
2
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
3
|
+
# Redistribution and use in source and binary forms, with or without
|
4
|
+
# modification, are permitted provided that the following conditions are met:
|
11
5
|
#
|
12
|
-
#
|
13
|
-
#
|
6
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
# this list of conditions and the following disclaimer.
|
8
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer in the documentation
|
10
|
+
# and/or other materials provided with the distribution.
|
11
|
+
|
12
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
13
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
16
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
17
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
18
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
19
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
14
23
|
|
15
24
|
require 'wikitext'
|
16
25
|
|