309 |
309 |
retrieve text
|
310 |
310 |
|
311 |
311 |
text.gsub!( /<\/?notextile>/, '' )
|
312 |
|
text.gsub!( /x%x%/, '&' )
|
|
312 |
### Disabled as it just bugs in pre/code blocks!!
|
|
313 |
#text.gsub!( /x%x%/, '&' )
|
313 |
314 |
clean_html text if filter_html
|
314 |
315 |
text.strip!
|
315 |
316 |
text
|
... | ... | |
968 |
969 |
## turn any incoming ampersands into a dummy character for now.
|
969 |
970 |
## This uses a negative lookahead for alphanumerics followed by a semicolon,
|
970 |
971 |
## implying an incoming html entity, to be skipped
|
971 |
|
|
972 |
|
text.gsub!( /&(?![#a-z0-9]+;)/i, "x%x%" )
|
|
972 |
|
|
973 |
### Disabled as it just bugs in pre/code blocks
|
|
974 |
### try: blah.map(&:test) in a code block...
|
|
975 |
#text.gsub!( /&(?![#a-z0-9]+;)/i, "x%x%" )
|
973 |
976 |
end
|
974 |
977 |
|
975 |
978 |
def no_textile( text )
|
... | ... | |
1050 |
1053 |
codepre, used_offtags = 0, {}
|
1051 |
1054 |
text.gsub!( OFFTAG_MATCH ) do |line|
|
1052 |
1055 |
if $3
|
1053 |
|
offtag, aftertag = $4, $5
|
|
1056 |
first, offtag, aftertag = $3, $4, $5
|
1054 |
1057 |
codepre += 1
|
1055 |
1058 |
used_offtags[offtag] = true
|
1056 |
1059 |
if codepre - used_offtags.length > 0
|
... | ... | |
1058 |
1061 |
@pre_list.last << line
|
1059 |
1062 |
line = ""
|
1060 |
1063 |
else
|
1061 |
|
htmlesc( aftertag, :NoQuotes ) if aftertag
|
|
1064 |
### htmlesc is disabled between CODE tags which will be parsed with highlighter
|
|
1065 |
### Regexp in formatter.rb is : /<code\s+class="(\w+)">\s?(.+)/m
|
|
1066 |
### NB: some changes were made not to use $N variables, because we use "match"
|
|
1067 |
### and it breaks following lines
|
|
1068 |
htmlesc( aftertag, :NoQuotes ) if (aftertag && !first.match(/<code\s+class="(\w+)">/))
|
1062 |
1069 |
line = "<redpre##{ @pre_list.length }>"
|
1063 |
|
$3.match(/<#{ OFFTAGS }([^>]*)>/)
|
|
1070 |
first.match(/<#{ OFFTAGS }([^>]*)>/)
|
1064 |
1071 |
tag = $1
|
1065 |
1072 |
$2.to_s.match(/(class\=\S+)/i)
|
1066 |
1073 |
tag << " #{$1}" if $1
|