summaryrefslogtreecommitdiff
path: root/lib/erubis/enhancer.rb
diff options
context:
space:
mode:
authormakoto kuwata <kwa@kuwata-lab.com>2006-05-27 03:47:44 +0000
committermakoto kuwata <kwa@kuwata-lab.com>2006-05-27 03:47:44 +0000
commitce9cf465cced27a076ad0523b23c176709034a03 (patch)
treea75028f90fc8c3cd0778bc289698dae6ab892fe2 /lib/erubis/enhancer.rb
parent942d331e7eb531a4d5f3782fcbab6a68a610d5d4 (diff)
downloaderubis-ce9cf465cced27a076ad0523b23c176709034a03.tar.gz
- [change] 'bin/noitem' uses pattern '<? !>' when lang is eperl
- [enhance] new enhancer NoCodeEnhander - [change] Erubis::Eperl#escaped_expr() prints 'encode_entities()' which is avairlable with HTML::Entities module - [bugfix] define_testmethods() (in 'test/testutil.rb') use 'module_eval' instead of 'eval' - [update] doc/users-guide.txt updated
Diffstat (limited to 'lib/erubis/enhancer.rb')
-rw-r--r--lib/erubis/enhancer.rb37
1 files changed, 36 insertions, 1 deletions
diff --git a/lib/erubis/enhancer.rb b/lib/erubis/enhancer.rb
index f27a450..a6f084a 100644
--- a/lib/erubis/enhancer.rb
+++ b/lib/erubis/enhancer.rb
@@ -252,7 +252,7 @@ module Erubis
## remove text and leave code, especially useful when debugging.
##
## ex.
- ## $ erubis -s -e NoText file.eruby | more
+ ## $ erubis -s -E NoText file.eruby | more
##
## this is language independent.
##
@@ -274,6 +274,41 @@ module Erubis
##
+ ## remove code and leave text, especially useful when validating HTML tags.
+ ##
+ ## ex.
+ ## $ erubis -s -E NoCode file.eruby | tidy -errors
+ ##
+ ## this is language independent.
+ ##
+ module NoCodeEnhancer
+
+ def self.desc # :nodoc:
+ "remove code and leave text (useful when validating HTML)"
+ end
+
+ def add_preamble(src)
+ end
+
+ def add_postamble(src)
+ end
+
+ def add_text(src, text)
+ src << text
+ end
+
+ def add_expr(src, code, indicator)
+ src << "\n" * code.count("\n")
+ end
+
+ def add_stmt(src, code)
+ src << "\n" * code.count("\n")
+ end
+
+ end
+
+
+ ##
## get compile faster, but spaces around '<%...%>' are not trimmed.
##
## this is language-independent.