RedCloth 4.1.0-universal-java
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.
Potentially problematic release.
This version of RedCloth might be problematic. Click here for more details.
- data/CHANGELOG +103 -0
- data/COPYING +18 -0
- data/Manifest +57 -0
- data/README +156 -0
- data/Rakefile +205 -0
- data/RedCloth.gemspec +141 -0
- data/bin/redcloth +28 -0
- data/ext/mingw-rbconfig.rb +176 -0
- data/ext/redcloth_scan/extconf.rb +9 -0
- data/ext/redcloth_scan/redcloth.h +164 -0
- data/ext/redcloth_scan/redcloth_attributes.c.rl +56 -0
- data/ext/redcloth_scan/redcloth_attributes.java.rl +96 -0
- data/ext/redcloth_scan/redcloth_attributes.rl +33 -0
- data/ext/redcloth_scan/redcloth_common.c.rl +18 -0
- data/ext/redcloth_scan/redcloth_common.java.rl +18 -0
- data/ext/redcloth_scan/redcloth_common.rl +111 -0
- data/ext/redcloth_scan/redcloth_inline.c.rl +159 -0
- data/ext/redcloth_scan/redcloth_inline.java.rl +108 -0
- data/ext/redcloth_scan/redcloth_inline.rl +157 -0
- data/ext/redcloth_scan/redcloth_scan.c.rl +227 -0
- data/ext/redcloth_scan/redcloth_scan.java.rl +555 -0
- data/ext/redcloth_scan/redcloth_scan.rl +323 -0
- data/extras/ragel_profiler.rb +73 -0
- data/lib/case_sensitive_require/RedCloth.rb +6 -0
- data/lib/redcloth.rb +37 -0
- data/lib/redcloth/erb_extension.rb +27 -0
- data/lib/redcloth/formatters/base.rb +57 -0
- data/lib/redcloth/formatters/html.rb +349 -0
- data/lib/redcloth/formatters/latex.rb +249 -0
- data/lib/redcloth/formatters/latex_entities.yml +2414 -0
- data/lib/redcloth/textile_doc.rb +105 -0
- data/lib/redcloth/version.rb +28 -0
- data/lib/redcloth_scan.jar +0 -0
- data/setup.rb +1585 -0
- data/test/basic.yml +870 -0
- data/test/code.yml +229 -0
- data/test/definitions.yml +82 -0
- data/test/extra_whitespace.yml +64 -0
- data/test/filter_html.yml +177 -0
- data/test/filter_pba.yml +20 -0
- data/test/helper.rb +108 -0
- data/test/html.yml +305 -0
- data/test/images.yml +246 -0
- data/test/instiki.yml +38 -0
- data/test/links.yml +259 -0
- data/test/lists.yml +283 -0
- data/test/poignant.yml +89 -0
- data/test/sanitize_html.yml +42 -0
- data/test/table.yml +267 -0
- data/test/test_custom_tags.rb +46 -0
- data/test/test_erb.rb +13 -0
- data/test/test_extensions.rb +31 -0
- data/test/test_formatters.rb +24 -0
- data/test/test_parser.rb +73 -0
- data/test/test_restrictions.rb +41 -0
- data/test/textism.yml +480 -0
- data/test/threshold.yml +772 -0
- data/test/validate_fixtures.rb +73 -0
- metadata +139 -0
data/RedCloth.gemspec
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
|
2
|
+
# Gem::Specification for Redcloth-4.1.0
|
3
|
+
# Originally generated by Echoe
|
4
|
+
|
5
|
+
--- !ruby/object:Gem::Specification
|
6
|
+
extensions: []
|
7
|
+
|
8
|
+
homepage: http://redcloth.org
|
9
|
+
executables:
|
10
|
+
- redcloth
|
11
|
+
version: !ruby/object:Gem::Version
|
12
|
+
version: 4.1.0
|
13
|
+
post_install_message:
|
14
|
+
date: 2008-11-03 05:00:00 +00:00
|
15
|
+
files:
|
16
|
+
- bin/redcloth
|
17
|
+
- CHANGELOG
|
18
|
+
- COPYING
|
19
|
+
- ext/mingw-rbconfig.rb
|
20
|
+
- ext/redcloth_scan/extconf.rb
|
21
|
+
- ext/redcloth_scan/redcloth.h
|
22
|
+
- ext/redcloth_scan/redcloth_attributes.c.rl
|
23
|
+
- ext/redcloth_scan/redcloth_attributes.java.rl
|
24
|
+
- ext/redcloth_scan/redcloth_attributes.rl
|
25
|
+
- ext/redcloth_scan/redcloth_common.c.rl
|
26
|
+
- ext/redcloth_scan/redcloth_common.java.rl
|
27
|
+
- ext/redcloth_scan/redcloth_common.rl
|
28
|
+
- ext/redcloth_scan/redcloth_inline.c.rl
|
29
|
+
- ext/redcloth_scan/redcloth_inline.java.rl
|
30
|
+
- ext/redcloth_scan/redcloth_inline.rl
|
31
|
+
- ext/redcloth_scan/redcloth_scan.c.rl
|
32
|
+
- ext/redcloth_scan/redcloth_scan.java.rl
|
33
|
+
- ext/redcloth_scan/redcloth_scan.rl
|
34
|
+
- extras/ragel_profiler.rb
|
35
|
+
- lib/case_sensitive_require/RedCloth.rb
|
36
|
+
- lib/redcloth/erb_extension.rb
|
37
|
+
- lib/redcloth/formatters/base.rb
|
38
|
+
- lib/redcloth/formatters/html.rb
|
39
|
+
- lib/redcloth/formatters/latex.rb
|
40
|
+
- lib/redcloth/formatters/latex_entities.yml
|
41
|
+
- lib/redcloth/textile_doc.rb
|
42
|
+
- lib/redcloth/version.rb
|
43
|
+
- lib/redcloth.rb
|
44
|
+
- Manifest
|
45
|
+
- Rakefile
|
46
|
+
- README
|
47
|
+
- RedCloth.gemspec
|
48
|
+
- setup.rb
|
49
|
+
- test/basic.yml
|
50
|
+
- test/code.yml
|
51
|
+
- test/definitions.yml
|
52
|
+
- test/extra_whitespace.yml
|
53
|
+
- test/filter_html.yml
|
54
|
+
- test/filter_pba.yml
|
55
|
+
- test/helper.rb
|
56
|
+
- test/html.yml
|
57
|
+
- test/images.yml
|
58
|
+
- test/instiki.yml
|
59
|
+
- test/links.yml
|
60
|
+
- test/lists.yml
|
61
|
+
- test/poignant.yml
|
62
|
+
- test/sanitize_html.yml
|
63
|
+
- test/table.yml
|
64
|
+
- test/test_custom_tags.rb
|
65
|
+
- test/test_erb.rb
|
66
|
+
- test/test_extensions.rb
|
67
|
+
- test/test_formatters.rb
|
68
|
+
- test/test_parser.rb
|
69
|
+
- test/test_restrictions.rb
|
70
|
+
- test/textism.yml
|
71
|
+
- test/threshold.yml
|
72
|
+
- test/validate_fixtures.rb
|
73
|
+
- lib/redcloth_scan.jar
|
74
|
+
rubygems_version: 1.2.0
|
75
|
+
rdoc_options:
|
76
|
+
- --line-numbers
|
77
|
+
- --inline-source
|
78
|
+
- --title
|
79
|
+
- RedCloth
|
80
|
+
- --main
|
81
|
+
- README
|
82
|
+
|
83
|
+
name: RedCloth
|
84
|
+
has_rdoc: true
|
85
|
+
platform: universal-java
|
86
|
+
summary: RedCloth-4.1.0 - Textile parser for Ruby. http://redcloth.org/
|
87
|
+
default_executable:
|
88
|
+
bindir: bin
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
version:
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: "1.2"
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
version:
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 1.8.4
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
- ext
|
104
|
+
specification_version: 2
|
105
|
+
test_files:
|
106
|
+
- test/test_custom_tags.rb
|
107
|
+
- test/test_erb.rb
|
108
|
+
- test/test_extensions.rb
|
109
|
+
- test/test_formatters.rb
|
110
|
+
- test/test_parser.rb
|
111
|
+
- test/test_restrictions.rb
|
112
|
+
dependencies:
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
type: :development
|
115
|
+
name: echoe
|
116
|
+
version_requirement:
|
117
|
+
version_requirements: !ruby/object:Gem::Requirement
|
118
|
+
version:
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
123
|
+
description: RedCloth-4.1.0 - Textile parser for Ruby. http://redcloth.org/
|
124
|
+
email: redcloth-upwards@rubyforge.org
|
125
|
+
authors:
|
126
|
+
- Jason Garber
|
127
|
+
extra_rdoc_files:
|
128
|
+
- CHANGELOG
|
129
|
+
- lib/case_sensitive_require/RedCloth.rb
|
130
|
+
- lib/redcloth/erb_extension.rb
|
131
|
+
- lib/redcloth/formatters/base.rb
|
132
|
+
- lib/redcloth/formatters/html.rb
|
133
|
+
- lib/redcloth/formatters/latex.rb
|
134
|
+
- lib/redcloth/textile_doc.rb
|
135
|
+
- lib/redcloth/version.rb
|
136
|
+
- lib/redcloth.rb
|
137
|
+
- README
|
138
|
+
requirements: []
|
139
|
+
|
140
|
+
rubyforge_project: redcloth
|
141
|
+
autorequire:
|
data/bin/redcloth
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib/')
|
3
|
+
require 'optparse'
|
4
|
+
require 'redcloth'
|
5
|
+
|
6
|
+
if %w(--version -v).include? ARGV.first
|
7
|
+
puts "#{RedCloth::NAME} #{RedCloth::VERSION}"
|
8
|
+
exit(0)
|
9
|
+
end
|
10
|
+
|
11
|
+
output_as = "html"
|
12
|
+
opts = OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: redcloth [options] [redcloth_formatted.txt]"
|
14
|
+
opts.separator "If no file specified, STDIN will be used. If you are typing input, you can send an EOF by pressing ^D (^Z on Windows)"
|
15
|
+
opts.separator ""
|
16
|
+
opts.on("-o", "--output STYLE", "Output format (defaults to #{output_as})") do |o|
|
17
|
+
output_as = o
|
18
|
+
end
|
19
|
+
end
|
20
|
+
opts.parse! ARGV
|
21
|
+
|
22
|
+
red = RedCloth.new( ARGF.read )
|
23
|
+
out_meth = "to_#{ output_as }"
|
24
|
+
if red.respond_to? out_meth
|
25
|
+
puts red.method( out_meth ).call
|
26
|
+
else
|
27
|
+
abort "** No to_#{ output_as } method found for the `#{ output_as }' format"
|
28
|
+
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
|
2
|
+
# This rbconfig.rb corresponds to a Ruby installation for win32 cross-compiled
|
3
|
+
# with mingw under i686-linux. It can be used to cross-compile extensions for
|
4
|
+
# win32 using said toolchain.
|
5
|
+
#
|
6
|
+
# This file assumes that a cross-compiled mingw32 build (compatible with the
|
7
|
+
# mswin32 builds) is installed under $HOME/ruby-mingw32.
|
8
|
+
|
9
|
+
module Config
|
10
|
+
#RUBY_VERSION == "1.8.5" or
|
11
|
+
# raise "ruby lib version (1.8.5) doesn't match executable version (#{RUBY_VERSION})"
|
12
|
+
|
13
|
+
mingw32 = ENV['MINGW32_RUBY'] || "#{ENV["HOME"]}/ruby-mingw32"
|
14
|
+
mingwpre = ENV['MINGW32_PREFIX']
|
15
|
+
TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/i386-mingw32")
|
16
|
+
DESTDIR = '' unless defined? DESTDIR
|
17
|
+
CONFIG = {}
|
18
|
+
CONFIG["DESTDIR"] = DESTDIR
|
19
|
+
CONFIG["INSTALL"] = "/usr/bin/install -c"
|
20
|
+
CONFIG["prefix"] = (TOPDIR || DESTDIR + mingw32)
|
21
|
+
CONFIG["EXEEXT"] = ".exe"
|
22
|
+
CONFIG["ruby_install_name"] = "ruby"
|
23
|
+
CONFIG["RUBY_INSTALL_NAME"] = "ruby"
|
24
|
+
CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18"
|
25
|
+
CONFIG["SHELL"] = "/bin/sh"
|
26
|
+
CONFIG["PATH_SEPARATOR"] = ":"
|
27
|
+
CONFIG["PACKAGE_NAME"] = ""
|
28
|
+
CONFIG["PACKAGE_TARNAME"] = ""
|
29
|
+
CONFIG["PACKAGE_VERSION"] = ""
|
30
|
+
CONFIG["PACKAGE_STRING"] = ""
|
31
|
+
CONFIG["PACKAGE_BUGREPORT"] = ""
|
32
|
+
CONFIG["exec_prefix"] = "$(prefix)"
|
33
|
+
CONFIG["bindir"] = "$(exec_prefix)/bin"
|
34
|
+
CONFIG["sbindir"] = "$(exec_prefix)/sbin"
|
35
|
+
CONFIG["libexecdir"] = "$(exec_prefix)/libexec"
|
36
|
+
CONFIG["datadir"] = "$(prefix)/share"
|
37
|
+
CONFIG["sysconfdir"] = "$(prefix)/etc"
|
38
|
+
CONFIG["sharedstatedir"] = "$(prefix)/com"
|
39
|
+
CONFIG["localstatedir"] = "$(prefix)/var"
|
40
|
+
CONFIG["libdir"] = "$(exec_prefix)/lib"
|
41
|
+
CONFIG["includedir"] = "$(prefix)/include"
|
42
|
+
CONFIG["oldincludedir"] = "/usr/include"
|
43
|
+
CONFIG["infodir"] = "$(prefix)/info"
|
44
|
+
CONFIG["mandir"] = "$(prefix)/man"
|
45
|
+
CONFIG["build_alias"] = "i686-linux"
|
46
|
+
CONFIG["host_alias"] = "#{mingwpre}"
|
47
|
+
CONFIG["target_alias"] = "i386-mingw32"
|
48
|
+
CONFIG["ECHO_C"] = ""
|
49
|
+
CONFIG["ECHO_N"] = "-n"
|
50
|
+
CONFIG["ECHO_T"] = ""
|
51
|
+
CONFIG["LIBS"] = "-lwsock32 "
|
52
|
+
CONFIG["MAJOR"] = "1"
|
53
|
+
CONFIG["MINOR"] = "8"
|
54
|
+
CONFIG["TEENY"] = "4"
|
55
|
+
CONFIG["build"] = "i686-pc-linux"
|
56
|
+
CONFIG["build_cpu"] = "i686"
|
57
|
+
CONFIG["build_vendor"] = "pc"
|
58
|
+
CONFIG["build_os"] = "linux"
|
59
|
+
CONFIG["host"] = "i586-pc-mingw32msvc"
|
60
|
+
CONFIG["host_cpu"] = "i586"
|
61
|
+
CONFIG["host_vendor"] = "pc"
|
62
|
+
CONFIG["host_os"] = "mingw32msvc"
|
63
|
+
CONFIG["target"] = "i386-pc-mingw32"
|
64
|
+
CONFIG["target_cpu"] = "i386"
|
65
|
+
CONFIG["target_vendor"] = "pc"
|
66
|
+
CONFIG["target_os"] = "mingw32"
|
67
|
+
CONFIG["CC"] = "#{mingwpre}-gcc"
|
68
|
+
CONFIG["CFLAGS"] = "-g "
|
69
|
+
CONFIG["LDFLAGS"] = ""
|
70
|
+
CONFIG["CPPFLAGS"] = ""
|
71
|
+
CONFIG["OBJEXT"] = "o"
|
72
|
+
CONFIG["CPP"] = "#{mingwpre}-gcc -E"
|
73
|
+
CONFIG["EGREP"] = "grep -E"
|
74
|
+
CONFIG["GNU_LD"] = "yes"
|
75
|
+
CONFIG["CPPOUTFILE"] = "-o conftest.i"
|
76
|
+
CONFIG["OUTFLAG"] = "-o "
|
77
|
+
CONFIG["YACC"] = "bison -y"
|
78
|
+
CONFIG["RANLIB"] = "#{mingwpre}-ranlib"
|
79
|
+
CONFIG["AR"] = "#{mingwpre}-ar"
|
80
|
+
CONFIG["NM"] = "#{mingwpre}-nm"
|
81
|
+
CONFIG["WINDRES"] = "#{mingwpre}-windres"
|
82
|
+
CONFIG["DLLWRAP"] = "#{mingwpre}-dllwrap"
|
83
|
+
CONFIG["OBJDUMP"] = "#{mingwpre}-objdump"
|
84
|
+
CONFIG["LN_S"] = "ln -s"
|
85
|
+
CONFIG["SET_MAKE"] = ""
|
86
|
+
CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
|
87
|
+
CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
|
88
|
+
CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
|
89
|
+
CONFIG["RM"] = "rm -f"
|
90
|
+
CONFIG["CP"] = "cp"
|
91
|
+
CONFIG["MAKEDIRS"] = "mkdir -p"
|
92
|
+
CONFIG["LIBOBJS"] = " fileblocks$(U).o crypt$(U).o flock$(U).o acosh$(U).o win32$(U).o"
|
93
|
+
CONFIG["ALLOCA"] = ""
|
94
|
+
CONFIG["DLDFLAGS"] = " -Wl,--enable-auto-import,--export-all"
|
95
|
+
CONFIG["ARCH_FLAG"] = ""
|
96
|
+
CONFIG["STATIC"] = ""
|
97
|
+
CONFIG["CCDLFLAGS"] = ""
|
98
|
+
CONFIG["LDSHARED"] = "#{mingwpre}-gcc -shared -s"
|
99
|
+
CONFIG["DLEXT"] = "so"
|
100
|
+
CONFIG["DLEXT2"] = "dll"
|
101
|
+
CONFIG["LIBEXT"] = "a"
|
102
|
+
CONFIG["LINK_SO"] = ""
|
103
|
+
CONFIG["LIBPATHFLAG"] = " -L\"%s\""
|
104
|
+
CONFIG["RPATHFLAG"] = ""
|
105
|
+
CONFIG["LIBPATHENV"] = ""
|
106
|
+
CONFIG["TRY_LINK"] = ""
|
107
|
+
CONFIG["STRIP"] = "strip"
|
108
|
+
CONFIG["EXTSTATIC"] = ""
|
109
|
+
CONFIG["setup"] = "Setup"
|
110
|
+
CONFIG["MINIRUBY"] = "ruby -rfake"
|
111
|
+
CONFIG["PREP"] = "fake.rb"
|
112
|
+
CONFIG["RUNRUBY"] = "$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`"
|
113
|
+
CONFIG["EXTOUT"] = ".ext"
|
114
|
+
CONFIG["ARCHFILE"] = ""
|
115
|
+
CONFIG["RDOCTARGET"] = ""
|
116
|
+
CONFIG["XCFLAGS"] = " -DRUBY_EXPORT"
|
117
|
+
CONFIG["XLDFLAGS"] = " -Wl,--stack,0x02000000 -L."
|
118
|
+
CONFIG["LIBRUBY_LDSHARED"] = "#{mingwpre}-gcc -shared -s"
|
119
|
+
CONFIG["LIBRUBY_DLDFLAGS"] = " -Wl,--enable-auto-import,--export-all -Wl,--out-implib=$(LIBRUBY)"
|
120
|
+
CONFIG["rubyw_install_name"] = "rubyw"
|
121
|
+
CONFIG["RUBYW_INSTALL_NAME"] = "rubyw"
|
122
|
+
CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
|
123
|
+
CONFIG["LIBRUBY_SO"] = "$(RUBY_SO_NAME).dll"
|
124
|
+
CONFIG["LIBRUBY_ALIASES"] = ""
|
125
|
+
CONFIG["LIBRUBY"] = "lib$(LIBRUBY_SO).a"
|
126
|
+
CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
|
127
|
+
CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
|
128
|
+
CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
|
129
|
+
CONFIG["SOLIBS"] = "$(LIBS)"
|
130
|
+
CONFIG["DLDLIBS"] = ""
|
131
|
+
CONFIG["ENABLE_SHARED"] = "yes"
|
132
|
+
CONFIG["MAINLIBS"] = ""
|
133
|
+
CONFIG["COMMON_LIBS"] = "m"
|
134
|
+
CONFIG["COMMON_MACROS"] = ""
|
135
|
+
CONFIG["COMMON_HEADERS"] = "windows.h winsock.h"
|
136
|
+
CONFIG["EXPORT_PREFIX"] = ""
|
137
|
+
CONFIG["MINIOBJS"] = "dmydln.o"
|
138
|
+
CONFIG["MAKEFILES"] = "Makefile GNUmakefile"
|
139
|
+
CONFIG["arch"] = "i386-mingw32"
|
140
|
+
CONFIG["sitearch"] = "i386-msvcrt"
|
141
|
+
CONFIG["sitedir"] = "$(prefix)/lib/ruby/site_ruby"
|
142
|
+
CONFIG["configure_args"] = "'--host=#{mingwpre}' '--target=i386-mingw32' '--build=i686-linux' '--prefix=#{mingw32}' 'build_alias=i686-linux' 'host_alias=#{mingwpre}' 'target_alias=i386-mingw32'"
|
143
|
+
CONFIG["NROFF"] = "/usr/bin/nroff"
|
144
|
+
CONFIG["MANTYPE"] = "doc"
|
145
|
+
CONFIG["LTLIBOBJS"] = " fileblocks$(U).lo crypt$(U).lo flock$(U).lo acosh$(U).lo win32$(U).lo"
|
146
|
+
CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)"
|
147
|
+
CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
|
148
|
+
CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
|
149
|
+
CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
|
150
|
+
CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
|
151
|
+
CONFIG["topdir"] = File.dirname(__FILE__)
|
152
|
+
MAKEFILE_CONFIG = {}
|
153
|
+
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
154
|
+
def Config::expand(val, config = CONFIG)
|
155
|
+
val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var|
|
156
|
+
if !(v = $1 || $2)
|
157
|
+
'$'
|
158
|
+
elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
|
159
|
+
pat, sub = $1, $2
|
160
|
+
config[v] = false
|
161
|
+
Config::expand(key, config)
|
162
|
+
config[v] = key
|
163
|
+
key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
|
164
|
+
key
|
165
|
+
else
|
166
|
+
var
|
167
|
+
end
|
168
|
+
end
|
169
|
+
val
|
170
|
+
end
|
171
|
+
CONFIG.each_value do |val|
|
172
|
+
Config::expand(val)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
RbConfig = Config # compatibility for ruby-1.9
|
176
|
+
CROSS_COMPILING = nil unless defined? CROSS_COMPILING
|
@@ -0,0 +1,164 @@
|
|
1
|
+
#ifndef redcloth_h
|
2
|
+
#define redcloth_h
|
3
|
+
|
4
|
+
/* Backward compatibility with Ruby < 1.8.6 */
|
5
|
+
#ifndef RSTRING_LEN
|
6
|
+
#define RSTRING_LEN(x) (RSTRING(x)->len)
|
7
|
+
#endif
|
8
|
+
#ifndef RSTRING_PTR
|
9
|
+
#define RSTRING_PTR(x) (RSTRING(x)->ptr)
|
10
|
+
#endif
|
11
|
+
|
12
|
+
/* variable defs */
|
13
|
+
#ifndef redcloth_scan_c
|
14
|
+
extern VALUE super_ParseError, mRedCloth, super_RedCloth;
|
15
|
+
extern int SYM_escape_preformatted;
|
16
|
+
#endif
|
17
|
+
|
18
|
+
/* function defs */
|
19
|
+
void rb_str_cat_escaped(VALUE self, VALUE str, char *ts, char *te);
|
20
|
+
void rb_str_cat_escaped_for_preformatted(VALUE self, VALUE str, char *ts, char *te);
|
21
|
+
VALUE redcloth_inline(VALUE, char *, char *, VALUE);
|
22
|
+
VALUE redcloth_inline2(VALUE, VALUE, VALUE);
|
23
|
+
VALUE redcloth_attribute_parser(int, VALUE, char *, char *);
|
24
|
+
VALUE redcloth_attributes(VALUE, VALUE);
|
25
|
+
VALUE redcloth_link_attributes(VALUE, VALUE);
|
26
|
+
VALUE redcloth_transform(VALUE, char *, char *, VALUE);
|
27
|
+
VALUE redcloth_transform2(VALUE, VALUE);
|
28
|
+
void red_inc(VALUE, VALUE);
|
29
|
+
VALUE red_block(VALUE, VALUE, VALUE, VALUE);
|
30
|
+
VALUE red_blockcode(VALUE, VALUE, VALUE);
|
31
|
+
VALUE red_pass(VALUE, VALUE, VALUE, ID, VALUE);
|
32
|
+
VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
33
|
+
|
34
|
+
/* parser macros */
|
35
|
+
#define CLEAR_REGS() regs = rb_hash_new();
|
36
|
+
#define RESET_REG() reg = NULL
|
37
|
+
#define CAT(H) rb_str_cat(H, ts, te-ts)
|
38
|
+
#define CLEAR(H) H = rb_str_new2("")
|
39
|
+
#define SET_PLAIN_BLOCK(T) plain_block = rb_str_new2(T)
|
40
|
+
#define RESET_TYPE(T) rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block)
|
41
|
+
#define INLINE(H, T) rb_str_append(H, rb_funcall(self, rb_intern(T), 1, regs))
|
42
|
+
#define DONE(H) rb_str_append(html, H); CLEAR(H); CLEAR_REGS()
|
43
|
+
#define PASS(H, A, T) rb_str_append(H, red_pass(self, regs, ID2SYM(rb_intern(A)), rb_intern(T), refs))
|
44
|
+
#define PARSE_ATTR(A) red_parse_attr(self, regs, ID2SYM(rb_intern(A)))
|
45
|
+
#define PARSE_LINK_ATTR(A) red_parse_link_attr(self, regs, ID2SYM(rb_intern(A)))
|
46
|
+
#define PASS_CODE(H, A, T, O) rb_str_append(H, red_pass_code(self, regs, ID2SYM(rb_intern(A)), rb_intern(T)))
|
47
|
+
#define ADD_BLOCK() \
|
48
|
+
rb_str_append(html, red_block(self, regs, block, refs)); \
|
49
|
+
extend = Qnil; \
|
50
|
+
CLEAR(block); \
|
51
|
+
CLEAR_REGS()
|
52
|
+
#define ADD_EXTENDED_BLOCK() rb_str_append(html, red_block(self, regs, block, refs)); CLEAR(block);
|
53
|
+
#define END_EXTENDED() extend = Qnil; CLEAR_REGS();
|
54
|
+
#define IS_NOT_EXTENDED() NIL_P(extend)
|
55
|
+
#define ADD_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block); CLEAR_REGS()
|
56
|
+
#define ADD_EXTENDED_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block);
|
57
|
+
#define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(T)), rb_str_new2(V));
|
58
|
+
#define AINC(T) red_inc(regs, ID2SYM(rb_intern(T)));
|
59
|
+
#define SET_ATTRIBUTES() \
|
60
|
+
VALUE buf = Qnil; \
|
61
|
+
SET_ATTRIBUTE("class_buf", "class"); \
|
62
|
+
SET_ATTRIBUTE("id_buf", "id"); \
|
63
|
+
SET_ATTRIBUTE("lang_buf", "lang"); \
|
64
|
+
SET_ATTRIBUTE("style_buf", "style");
|
65
|
+
#define SET_ATTRIBUTE(B, A) \
|
66
|
+
buf = rb_hash_aref(regs, ID2SYM(rb_intern(B))); \
|
67
|
+
if (buf != Qnil) rb_hash_aset(regs, ID2SYM(rb_intern(A)), buf);
|
68
|
+
#define TRANSFORM(T) \
|
69
|
+
if (p > reg && reg >= ts) { \
|
70
|
+
VALUE str = redcloth_transform(self, reg, p, refs); \
|
71
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
72
|
+
/* printf("TRANSFORM(" T ") '%s' (p:'%d' reg:'%d')\n", RSTRING(str)->ptr, p, reg);*/ \
|
73
|
+
} else { \
|
74
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
75
|
+
}
|
76
|
+
#define STORE(T) \
|
77
|
+
if (p > reg && reg >= ts) { \
|
78
|
+
VALUE str = rb_str_new(reg, p-reg); \
|
79
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
80
|
+
/* printf("STORE(" T ") '%s' (p:'%d' reg:'%d')\n", RSTRING(str)->ptr, p, reg);*/ \
|
81
|
+
} else { \
|
82
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
83
|
+
}
|
84
|
+
#define STORE_B(T) \
|
85
|
+
if (p > bck && bck >= ts) { \
|
86
|
+
VALUE str = rb_str_new(bck, p-bck); \
|
87
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
88
|
+
/* printf("STORE_B(" T ") '%s' (p:'%d' reg:'%d')\n", RSTRING(str)->ptr, p, reg);*/ \
|
89
|
+
} else { \
|
90
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
91
|
+
}
|
92
|
+
#define STORE_URL(T) \
|
93
|
+
if (p > reg && reg >= ts) { \
|
94
|
+
char punct = 1; \
|
95
|
+
while (p > reg && punct == 1) { \
|
96
|
+
switch (*(p - 1)) { \
|
97
|
+
case '!': case '"': case '#': case '$': case '%': case ']': case '[': case '&': case '\'': \
|
98
|
+
case '*': case '+': case ',': case '-': case '.': case ')': case '(': case ':': \
|
99
|
+
case ';': case '=': case '?': case '@': case '\\': case '^': case '_': \
|
100
|
+
case '`': case '|': case '~': p--; break; \
|
101
|
+
default: punct = 0; \
|
102
|
+
} \
|
103
|
+
} \
|
104
|
+
te = p; \
|
105
|
+
} \
|
106
|
+
STORE(T); \
|
107
|
+
if ( !NIL_P(refs) && rb_funcall(refs, rb_intern("has_key?"), 1, rb_hash_aref(regs, ID2SYM(rb_intern(T)))) ) { \
|
108
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), rb_hash_aref(refs, rb_hash_aref(regs, ID2SYM(rb_intern(T))))); \
|
109
|
+
}
|
110
|
+
#define STORE_LINK_ALIAS() \
|
111
|
+
rb_hash_aset(refs_found, rb_hash_aref(regs, ID2SYM(rb_intern("text"))), rb_hash_aref(regs, ID2SYM(rb_intern("href"))))
|
112
|
+
#define CLEAR_LIST() list_layout = rb_ary_new()
|
113
|
+
#define LIST_ITEM() \
|
114
|
+
int aint = 0; \
|
115
|
+
VALUE aval = rb_ary_entry(list_index, nest-1); \
|
116
|
+
if (aval != Qnil) aint = NUM2INT(aval); \
|
117
|
+
if (strcmp(list_type, "ol") == 0) \
|
118
|
+
{ \
|
119
|
+
rb_ary_store(list_index, nest-1, INT2NUM(aint + 1)); \
|
120
|
+
} \
|
121
|
+
if (nest > RARRAY(list_layout)->len) \
|
122
|
+
{ \
|
123
|
+
sprintf(listm, "%s_open", list_type); \
|
124
|
+
if (list_continue == 1) \
|
125
|
+
{ \
|
126
|
+
list_continue = 0; \
|
127
|
+
rb_hash_aset(regs, ID2SYM(rb_intern("start")), rb_ary_entry(list_index, nest-1)); \
|
128
|
+
} \
|
129
|
+
else \
|
130
|
+
{ \
|
131
|
+
VALUE start = rb_hash_aref(regs, ID2SYM(rb_intern("start"))); \
|
132
|
+
if (NIL_P(start) ) \
|
133
|
+
{ \
|
134
|
+
rb_ary_store(list_index, nest-1, INT2NUM(1)); \
|
135
|
+
} \
|
136
|
+
else \
|
137
|
+
{ \
|
138
|
+
VALUE start_num = rb_funcall(start,rb_intern("to_i"),0); \
|
139
|
+
rb_ary_store(list_index, nest-1, start_num); \
|
140
|
+
} \
|
141
|
+
} \
|
142
|
+
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(nest)); \
|
143
|
+
rb_str_append(html, rb_funcall(self, rb_intern(listm), 1, regs)); \
|
144
|
+
rb_ary_store(list_layout, nest-1, rb_str_new2(list_type)); \
|
145
|
+
CLEAR_REGS(); \
|
146
|
+
ASET("first", "true"); \
|
147
|
+
} \
|
148
|
+
LIST_CLOSE(); \
|
149
|
+
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY(list_layout)->len)); \
|
150
|
+
ASET("type", "li_open")
|
151
|
+
#define LIST_CLOSE() \
|
152
|
+
while (nest < RARRAY(list_layout)->len) \
|
153
|
+
{ \
|
154
|
+
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY(list_layout)->len)); \
|
155
|
+
VALUE end_list = rb_ary_pop(list_layout); \
|
156
|
+
if (!NIL_P(end_list)) \
|
157
|
+
{ \
|
158
|
+
StringValue(end_list); \
|
159
|
+
sprintf(listm, "%s_close", RSTRING_PTR(end_list)); \
|
160
|
+
rb_str_append(html, rb_funcall(self, rb_intern(listm), 1, regs)); \
|
161
|
+
} \
|
162
|
+
}
|
163
|
+
|
164
|
+
#endif
|