Erubis.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE html
  3. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  4. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  6. <head>
  7. <title>Module: Erubis</title>
  8. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  9. <meta http-equiv="Content-Script-Type" content="text/javascript" />
  10. <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  11. <script type="text/javascript">
  12. // <![CDATA[
  13. function popupCode( url ) {
  14. window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  15. }
  16. function toggleCode( id ) {
  17. if ( document.getElementById )
  18. elem = document.getElementById( id );
  19. else if ( document.all )
  20. elem = eval( "document.all." + id );
  21. else
  22. return false;
  23. elemStyle = elem.style;
  24. if ( elemStyle.display != "block" ) {
  25. elemStyle.display = "block"
  26. } else {
  27. elemStyle.display = "none"
  28. }
  29. return true;
  30. }
  31. // Make codeblocks hidden by default
  32. document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  33. // ]]>
  34. </script>
  35. </head>
  36. <body>
  37. <div id="classHeader">
  38. <table class="header-table">
  39. <tr class="top-aligned-row">
  40. <td><strong>Module</strong></td>
  41. <td class="class-name-in-header">Erubis</td>
  42. </tr>
  43. <tr class="top-aligned-row">
  44. <td><strong>In:</strong></td>
  45. <td>
  46. <a href="../files/erubis/context_rb.html">
  47. erubis/context.rb
  48. </a>
  49. <br />
  50. <a href="../files/erubis/converter_rb.html">
  51. erubis/converter.rb
  52. </a>
  53. <br />
  54. <a href="../files/erubis/engine/ec_rb.html">
  55. erubis/engine/ec.rb
  56. </a>
  57. <br />
  58. <a href="../files/erubis/engine/ecpp_rb.html">
  59. erubis/engine/ecpp.rb
  60. </a>
  61. <br />
  62. <a href="../files/erubis/engine/ejava_rb.html">
  63. erubis/engine/ejava.rb
  64. </a>
  65. <br />
  66. <a href="../files/erubis/engine/ejavascript_rb.html">
  67. erubis/engine/ejavascript.rb
  68. </a>
  69. <br />
  70. <a href="../files/erubis/engine/enhanced_rb.html">
  71. erubis/engine/enhanced.rb
  72. </a>
  73. <br />
  74. <a href="../files/erubis/engine/eperl_rb.html">
  75. erubis/engine/eperl.rb
  76. </a>
  77. <br />
  78. <a href="../files/erubis/engine/ephp_rb.html">
  79. erubis/engine/ephp.rb
  80. </a>
  81. <br />
  82. <a href="../files/erubis/engine/eruby_rb.html">
  83. erubis/engine/eruby.rb
  84. </a>
  85. <br />
  86. <a href="../files/erubis/engine/escheme_rb.html">
  87. erubis/engine/escheme.rb
  88. </a>
  89. <br />
  90. <a href="../files/erubis/engine/optimized_rb.html">
  91. erubis/engine/optimized.rb
  92. </a>
  93. <br />
  94. <a href="../files/erubis/engine_rb.html">
  95. erubis/engine.rb
  96. </a>
  97. <br />
  98. <a href="../files/erubis/enhancer_rb.html">
  99. erubis/enhancer.rb
  100. </a>
  101. <br />
  102. <a href="../files/erubis/error_rb.html">
  103. erubis/error.rb
  104. </a>
  105. <br />
  106. <a href="../files/erubis/evaluator_rb.html">
  107. erubis/evaluator.rb
  108. </a>
  109. <br />
  110. <a href="../files/erubis/generator_rb.html">
  111. erubis/generator.rb
  112. </a>
  113. <br />
  114. <a href="../files/erubis/helper_rb.html">
  115. erubis/helper.rb
  116. </a>
  117. <br />
  118. <a href="../files/erubis/helpers/rails_form_helper_rb.html">
  119. erubis/helpers/rails_form_helper.rb
  120. </a>
  121. <br />
  122. <a href="../files/erubis/helpers/rails_helper_rb.html">
  123. erubis/helpers/rails_helper.rb
  124. </a>
  125. <br />
  126. <a href="../files/erubis/main_rb.html">
  127. erubis/main.rb
  128. </a>
  129. <br />
  130. <a href="../files/erubis/preprocessing_rb.html">
  131. erubis/preprocessing.rb
  132. </a>
  133. <br />
  134. <a href="../files/erubis/tiny_rb.html">
  135. erubis/tiny.rb
  136. </a>
  137. <br />
  138. <a href="../files/erubis_rb.html">
  139. erubis.rb
  140. </a>
  141. <br />
  142. </td>
  143. </tr>
  144. </table>
  145. </div>
  146. <!-- banner header -->
  147. <div id="bodyContent">
  148. <div id="contextContent">
  149. <div id="description">
  150. <p>
  151. an implementation of eRuby
  152. </p>
  153. <p>
  154. ex.
  155. </p>
  156. <pre>
  157. input = &lt;&lt;'END'
  158. &lt;ul&gt;
  159. &lt;% for item in @list %&gt;
  160. &lt;li&gt;&lt;%= item %&gt;
  161. &lt;%== item %&gt;&lt;/li&gt;
  162. &lt;% end %&gt;
  163. &lt;/ul&gt;
  164. END
  165. list = ['&lt;aaa&gt;', 'b&amp;b', '&quot;ccc&quot;']
  166. eruby = Erubis::Eruby.new(input)
  167. puts &quot;--- code ---&quot;
  168. puts eruby.src
  169. puts &quot;--- result ---&quot;
  170. context = Erubis::Context.new() # or new(:list=&gt;list)
  171. context[:list] = list
  172. puts eruby.evaluate(context)
  173. </pre>
  174. <p>
  175. result:
  176. </p>
  177. <pre>
  178. --- source ---
  179. _buf = ''; _buf &lt;&lt; '&lt;ul&gt;
  180. '; for item in @list
  181. _buf &lt;&lt; ' &lt;li&gt;'; _buf &lt;&lt; ( item ).to_s; _buf &lt;&lt; '
  182. '; _buf &lt;&lt; ' '; _buf &lt;&lt; Erubis::XmlHelper.escape_xml( item ); _buf &lt;&lt; '&lt;/li&gt;
  183. '; end
  184. _buf &lt;&lt; '&lt;/ul&gt;
  185. ';
  186. _buf.to_s
  187. --- result ---
  188. &lt;ul&gt;
  189. &lt;li&gt;&lt;aaa&gt;
  190. &amp;lt;aaa&amp;gt;&lt;/li&gt;
  191. &lt;li&gt;b&amp;b
  192. b&amp;amp;b&lt;/li&gt;
  193. &lt;li&gt;&quot;ccc&quot;
  194. &amp;quot;ccc&amp;quot;&lt;/li&gt;
  195. &lt;/ul&gt;
  196. </pre>
  197. </div>
  198. </div>
  199. </div>
  200. <!-- if includes -->
  201. <div id="section">
  202. <div id="class-list">
  203. <h3 class="section-bar">Classes and Modules</h3>
  204. Module <a href="Erubis/ArrayBufferEnhancer.html" class="link">Erubis::ArrayBufferEnhancer</a><br />
  205. Module <a href="Erubis/ArrayEnhancer.html" class="link">Erubis::ArrayEnhancer</a><br />
  206. Module <a href="Erubis/Basic.html" class="link">Erubis::Basic</a><br />
  207. Module <a href="Erubis/BiPatternEnhancer.html" class="link">Erubis::BiPatternEnhancer</a><br />
  208. Module <a href="Erubis/CGenerator.html" class="link">Erubis::CGenerator</a><br />
  209. Module <a href="Erubis/Converter.html" class="link">Erubis::Converter</a><br />
  210. Module <a href="Erubis/CppGenerator.html" class="link">Erubis::CppGenerator</a><br />
  211. Module <a href="Erubis/DeleteIndentEnhancer.html" class="link">Erubis::DeleteIndentEnhancer</a><br />
  212. Module <a href="Erubis/ErboutEnhancer.html" class="link">Erubis::ErboutEnhancer</a><br />
  213. Module <a href="Erubis/EscapeEnhancer.html" class="link">Erubis::EscapeEnhancer</a><br />
  214. Module <a href="Erubis/Evaluator.html" class="link">Erubis::Evaluator</a><br />
  215. Module <a href="Erubis/Generator.html" class="link">Erubis::Generator</a><br />
  216. Module <a href="Erubis/HeaderFooterEnhancer.html" class="link">Erubis::HeaderFooterEnhancer</a><br />
  217. Module <a href="Erubis/Helpers.html" class="link">Erubis::Helpers</a><br />
  218. Module <a href="Erubis/InterpolationEnhancer.html" class="link">Erubis::InterpolationEnhancer</a><br />
  219. Module <a href="Erubis/JavaGenerator.html" class="link">Erubis::JavaGenerator</a><br />
  220. Module <a href="Erubis/JavascriptGenerator.html" class="link">Erubis::JavascriptGenerator</a><br />
  221. Module <a href="Erubis/NoCodeEnhancer.html" class="link">Erubis::NoCodeEnhancer</a><br />
  222. Module <a href="Erubis/NoTextEnhancer.html" class="link">Erubis::NoTextEnhancer</a><br />
  223. Module <a href="Erubis/OptimizedGenerator.html" class="link">Erubis::OptimizedGenerator</a><br />
  224. Module <a href="Erubis/PI.html" class="link">Erubis::PI</a><br />
  225. Module <a href="Erubis/PercentLineEnhancer.html" class="link">Erubis::PercentLineEnhancer</a><br />
  226. Module <a href="Erubis/PerlGenerator.html" class="link">Erubis::PerlGenerator</a><br />
  227. Module <a href="Erubis/PhpGenerator.html" class="link">Erubis::PhpGenerator</a><br />
  228. Module <a href="Erubis/PrefixedLineEnhancer.html" class="link">Erubis::PrefixedLineEnhancer</a><br />
  229. Module <a href="Erubis/PreprocessingHelper.html" class="link">Erubis::PreprocessingHelper</a><br />
  230. Module <a href="Erubis/PrintEnabledEnhancer.html" class="link">Erubis::PrintEnabledEnhancer</a><br />
  231. Module <a href="Erubis/PrintOutEnhancer.html" class="link">Erubis::PrintOutEnhancer</a><br />
  232. Module <a href="Erubis/RubyEvaluator.html" class="link">Erubis::RubyEvaluator</a><br />
  233. Module <a href="Erubis/RubyGenerator.html" class="link">Erubis::RubyGenerator</a><br />
  234. Module <a href="Erubis/SchemeGenerator.html" class="link">Erubis::SchemeGenerator</a><br />
  235. Module <a href="Erubis/SimplifyEnhancer.html" class="link">Erubis::SimplifyEnhancer</a><br />
  236. Module <a href="Erubis/StdoutEnhancer.html" class="link">Erubis::StdoutEnhancer</a><br />
  237. Module <a href="Erubis/StringBufferEnhancer.html" class="link">Erubis::StringBufferEnhancer</a><br />
  238. Module <a href="Erubis/XmlHelper.html" class="link">Erubis::XmlHelper</a><br />
  239. Class <a href="Erubis/ArrayBufferEruby.html" class="link">Erubis::ArrayBufferEruby</a><br />
  240. Class <a href="Erubis/ArrayEruby.html" class="link">Erubis::ArrayEruby</a><br />
  241. Class <a href="Erubis/BiPatternEruby.html" class="link">Erubis::BiPatternEruby</a><br />
  242. Class <a href="Erubis/CommandOptionError.html" class="link">Erubis::CommandOptionError</a><br />
  243. Class <a href="Erubis/Context.html" class="link">Erubis::Context</a><br />
  244. Class <a href="Erubis/DeleteIndentEruby.html" class="link">Erubis::DeleteIndentEruby</a><br />
  245. Class <a href="Erubis/Ec.html" class="link">Erubis::Ec</a><br />
  246. Class <a href="Erubis/Ecpp.html" class="link">Erubis::Ecpp</a><br />
  247. Class <a href="Erubis/Ejava.html" class="link">Erubis::Ejava</a><br />
  248. Class <a href="Erubis/Ejavascript.html" class="link">Erubis::Ejavascript</a><br />
  249. Class <a href="Erubis/Engine.html" class="link">Erubis::Engine</a><br />
  250. Class <a href="Erubis/Eperl.html" class="link">Erubis::Eperl</a><br />
  251. Class <a href="Erubis/Ephp.html" class="link">Erubis::Ephp</a><br />
  252. Class <a href="Erubis/ErboutEruby.html" class="link">Erubis::ErboutEruby</a><br />
  253. Class <a href="Erubis/ErubisError.html" class="link">Erubis::ErubisError</a><br />
  254. Class <a href="Erubis/Eruby.html" class="link">Erubis::Eruby</a><br />
  255. Class <a href="Erubis/EscapedEc.html" class="link">Erubis::EscapedEc</a><br />
  256. Class <a href="Erubis/EscapedEcpp.html" class="link">Erubis::EscapedEcpp</a><br />
  257. Class <a href="Erubis/EscapedEjava.html" class="link">Erubis::EscapedEjava</a><br />
  258. Class <a href="Erubis/EscapedEjavascript.html" class="link">Erubis::EscapedEjavascript</a><br />
  259. Class <a href="Erubis/EscapedEperl.html" class="link">Erubis::EscapedEperl</a><br />
  260. Class <a href="Erubis/EscapedEphp.html" class="link">Erubis::EscapedEphp</a><br />
  261. Class <a href="Erubis/EscapedEruby.html" class="link">Erubis::EscapedEruby</a><br />
  262. Class <a href="Erubis/EscapedEscheme.html" class="link">Erubis::EscapedEscheme</a><br />
  263. Class <a href="Erubis/Escheme.html" class="link">Erubis::Escheme</a><br />
  264. Class <a href="Erubis/FastEruby.html" class="link">Erubis::FastEruby</a><br />
  265. Class <a href="Erubis/HeaderFooterEruby.html" class="link">Erubis::HeaderFooterEruby</a><br />
  266. Class <a href="Erubis/InterpolationEruby.html" class="link">Erubis::InterpolationEruby</a><br />
  267. Class <a href="Erubis/Main.html" class="link">Erubis::Main</a><br />
  268. Class <a href="Erubis/NoCodeEruby.html" class="link">Erubis::NoCodeEruby</a><br />
  269. Class <a href="Erubis/NoTextEruby.html" class="link">Erubis::NoTextEruby</a><br />
  270. Class <a href="Erubis/NotSupportedError.html" class="link">Erubis::NotSupportedError</a><br />
  271. Class <a href="Erubis/OptimizedEruby.html" class="link">Erubis::OptimizedEruby</a><br />
  272. Class <a href="Erubis/OptimizedXmlEruby.html" class="link">Erubis::OptimizedXmlEruby</a><br />
  273. Class <a href="Erubis/PercentLineEruby.html" class="link">Erubis::PercentLineEruby</a><br />
  274. Class <a href="Erubis/PrefixedLineEruby.html" class="link">Erubis::PrefixedLineEruby</a><br />
  275. Class <a href="Erubis/PreprocessingEruby.html" class="link">Erubis::PreprocessingEruby</a><br />
  276. Class <a href="Erubis/PrintEnabledEruby.html" class="link">Erubis::PrintEnabledEruby</a><br />
  277. Class <a href="Erubis/PrintOutEruby.html" class="link">Erubis::PrintOutEruby</a><br />
  278. Class <a href="Erubis/PrintOutSimplifiedEruby.html" class="link">Erubis::PrintOutSimplifiedEruby</a><br />
  279. Class <a href="Erubis/SimplifiedEruby.html" class="link">Erubis::SimplifiedEruby</a><br />
  280. Class <a href="Erubis/StdoutEruby.html" class="link">Erubis::StdoutEruby</a><br />
  281. Class <a href="Erubis/StdoutSimplifiedEruby.html" class="link">Erubis::StdoutSimplifiedEruby</a><br />
  282. Class <a href="Erubis/StringBufferEruby.html" class="link">Erubis::StringBufferEruby</a><br />
  283. Class <a href="Erubis/StringIOEruby.html" class="link">Erubis::StringIOEruby</a><br />
  284. Class <a href="Erubis/TinyEruby.html" class="link">Erubis::TinyEruby</a><br />
  285. Class <a href="Erubis/XmlEruby.html" class="link">Erubis::XmlEruby</a><br />
  286. </div>
  287. <div id="constants-list">
  288. <h3 class="section-bar">Constants</h3>
  289. <div class="name-list">
  290. <table summary="Constants">
  291. <tr class="top-aligned-row context-row">
  292. <td class="context-item-name">EMPTY_BINDING</td>
  293. <td>=</td>
  294. <td class="context-item-value">binding()</td>
  295. </tr>
  296. <tr class="top-aligned-row context-row">
  297. <td class="context-item-name">Ejs</td>
  298. <td>=</td>
  299. <td class="context-item-value">Ejavascript</td>
  300. </tr>
  301. <tr class="top-aligned-row context-row">
  302. <td class="context-item-name">EscapedEjs</td>
  303. <td>=</td>
  304. <td class="context-item-value">EscapedEjavascript</td>
  305. </tr>
  306. <tr class="top-aligned-row context-row">
  307. <td class="context-item-name">VERSION</td>
  308. <td>=</td>
  309. <td class="context-item-value">('$Release: 2.7.0 $' =~ /([.\d]+)/) &amp;&amp; $1</td>
  310. </tr>
  311. </table>
  312. </div>
  313. </div>
  314. <!-- if method_list -->
  315. </div>
  316. <div id="validator-badges">
  317. <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
  318. </div>
  319. </body>
  320. </html>