"
} elseif {[string match "left-col*" $arg] \
|| [string match "right-col*" $arg] \
|| $arg eq "sidebar"} {
- return "$ch
"
+ return "
"
} elseif {$arg eq "box"} {
- return "$ch
"
+ return "
"
} elseif {$arg eq ""} {
- return "$ch
"
+ return "
"
} else {
- return $ch
+ return ""
}
}
- Page instproc anchor {ch arg} {
+ Page instproc anchor {arg} {
set label $arg
set link $arg
set options ""
@@ -710,27 +714,27 @@
switch -glob -- [::xowiki::guesstype $link] {
text/css {
::xo::Page requireCSS $link
- return $ch
+ return ""
}
application/x-javascript {
::xo::Page requireJS $link
- return $ch
+ return ""
}
image/* {
Link create [self]::link \
-page [self] \
-type localimage -label $label \
-href $link
eval [self]::link configure $options
- return $ch[[self]::link render]
+ return [[self]::link render]
}
}
}
set l [ExternalLink new -label $label -href $link]
eval $l configure $options
set html [$l render]
$l destroy
- return "$ch$html"
+ return $html
}
set name ""
@@ -796,36 +800,36 @@
if {[catch {eval [self]::link configure $options} error]} {
return "${ch}
Error during processing of options [list $options] of link of type [[self]::link info class]:
$error
"
} else {
- return $ch[[self]::link render]
+ return [[self]::link render]
}
}
+
+
Page instproc substitute_markup {source} {
set baseclass [expr {[[my info class] exists RE] ? [my info class] : [self class]}]
- $baseclass instvar RE
+ $baseclass instvar RE markupmap
#my log "-- baseclass for RE = $baseclass"
- if {[my set mime_type] eq "text/enhanced"} {
- set source [ad_enhanced_text_to_html $source]
- }
- if {![my do_substitutions]} {return [lindex $source 0]}
set content ""
set l " "; #use one byte trailer for regexps for escaped content
foreach l0 [split [lindex $source 0] \n] {
- append l $l0
+ append l [string map $markupmap(escape) $l0]
if {[string first \{\{ $l] > -1 && [string first \}\} $l] == -1} continue
- set l [my regsub_eval $RE(anchor) $l {my anchor "\1" "\2"}]
- set l [my regsub_eval $RE(div) $l {my div "\2" "\3"}]
- set l [my regsub_eval $RE(include) $l {my include_content "\\\1" "\2" "\3"}]
- regsub -all $RE(clean) $l {\1} l
+ set l [my regsub_eval $RE(anchor) $l {my anchor "\1"} "1"]
+ set l [my regsub_eval $RE(div) $l {my div "\1"}]
+ set l [my regsub_eval $RE(include) $l {my include_content "\1" "\2"}]
+ #regsub -all $RE(clean) $l {\1} l
regsub -all $RE(clean2) $l { \1} l
+ set l [string map $markupmap(unescape) $l]
append content [string range $l 1 end] \n
set l " "
}
#my log "--substitute_markup returns $content"
return $content
}
+
Page instproc adp_subst {content} {
#my log "--adp_subst in [my name]"
set __ignorelist [list RE __defaults name_method object_type_key db_slot]
@@ -1060,13 +1064,16 @@
{render_adp 0}
}
PlainPage array set RE {
- include {([^\\]){{(.+?)}}[ \n\r]}
- anchor {([^\\])\\\[\\\[([^\]]+?)\\\]\\\]}
- div {()([^\\])>>([^<]*?)<<}
+ include {{{(.+?)}}([ \n\r])}
+ anchor {\\\[\\\[([^\]]+?)\\\]\\\]}
+ div {()>>([^<]*?)<<}
clean {[\\](\{\{|>>|\[\[)}
clean2 {(--DUMMY NOT USED--)}
}
+ PlainPage set markupmap(escape) [list "\\\[\[" \01 "\\\{\{" \02 {\<<} \03]
+ PlainPage set markupmap(unescape) [list \01 "\[\[" \02 "\{\{" \03 {<<}]
+
PlainPage instproc get_content {} {
#my msg "-- my class=[my info class]"
return [my substitute_markup [my set text]]
@@ -1076,14 +1083,16 @@
}
PlainPage instproc substitute_markup {source} {
- [self class] instvar RE
+ [self class] instvar RE markupmap
set content ""
foreach l [split $source \n] {
set l " $l"
- set l [my regsub_eval $RE(anchor) $l {my anchor "\1" "\2"}]
- set l [my regsub_eval $RE(div) $l {my div "\2" "\3"}]
- set l [my regsub_eval $RE(include) $l {my include "\1" "\2" ""}]
- regsub -all $RE(clean) $l {\1} l
+ set l [string map $markupmap(escape) $l]
+ set l [my regsub_eval $RE(anchor) $l {my anchor "\1"}]
+ set l [my regsub_eval $RE(div) $l {my div "\1"}]
+ set l [my regsub_eval $RE(include) $l {my include_content "\1" ""}]
+ #regsub -all $RE(clean) $l {\1} l
+ set l [string map $markupmap(unescape) $l]
append content [string range $l 1 end] \n
}
return $content