Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby18/lib64/ruby/1.8
File: erb.rb
# = ERB -- Ruby Templating
[0] Fix | Delete
#
[1] Fix | Delete
# Author:: Masatoshi SEKI
[2] Fix | Delete
# Documentation:: James Edward Gray II and Gavin Sinclair
[3] Fix | Delete
#
[4] Fix | Delete
# See ERB for primary documentation and ERB::Util for a couple of utility
[5] Fix | Delete
# routines.
[6] Fix | Delete
#
[7] Fix | Delete
# Copyright (c) 1999-2000,2002,2003 Masatoshi SEKI
[8] Fix | Delete
#
[9] Fix | Delete
# You can redistribute it and/or modify it under the same terms as Ruby.
[10] Fix | Delete
[11] Fix | Delete
#
[12] Fix | Delete
# = ERB -- Ruby Templating
[13] Fix | Delete
#
[14] Fix | Delete
# == Introduction
[15] Fix | Delete
#
[16] Fix | Delete
# ERB provides an easy to use but powerful templating system for Ruby. Using
[17] Fix | Delete
# ERB, actual Ruby code can be added to any plain text document for the
[18] Fix | Delete
# purposes of generating document information details and/or flow control.
[19] Fix | Delete
#
[20] Fix | Delete
# A very simple example is this:
[21] Fix | Delete
#
[22] Fix | Delete
# require 'erb'
[23] Fix | Delete
#
[24] Fix | Delete
# x = 42
[25] Fix | Delete
# template = ERB.new <<-EOF
[26] Fix | Delete
# The value of x is: <%= x %>
[27] Fix | Delete
# EOF
[28] Fix | Delete
# puts template.result(binding)
[29] Fix | Delete
#
[30] Fix | Delete
# <em>Prints:</em> The value of x is: 42
[31] Fix | Delete
#
[32] Fix | Delete
# More complex examples are given below.
[33] Fix | Delete
#
[34] Fix | Delete
#
[35] Fix | Delete
# == Recognized Tags
[36] Fix | Delete
#
[37] Fix | Delete
# ERB recognizes certain tags in the provided template and converts them based
[38] Fix | Delete
# on the rules below:
[39] Fix | Delete
#
[40] Fix | Delete
# <% Ruby code -- inline with output %>
[41] Fix | Delete
# <%= Ruby expression -- replace with result %>
[42] Fix | Delete
# <%# comment -- ignored -- useful in testing %>
[43] Fix | Delete
# % a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)
[44] Fix | Delete
# %% replaced with % if first thing on a line and % processing is used
[45] Fix | Delete
# <%% or %%> -- replace with <% or %> respectively
[46] Fix | Delete
#
[47] Fix | Delete
# All other text is passed through ERB filtering unchanged.
[48] Fix | Delete
#
[49] Fix | Delete
#
[50] Fix | Delete
# == Options
[51] Fix | Delete
#
[52] Fix | Delete
# There are several settings you can change when you use ERB:
[53] Fix | Delete
# * the nature of the tags that are recognized;
[54] Fix | Delete
# * the value of <tt>$SAFE</tt> under which the template is run;
[55] Fix | Delete
# * the binding used to resolve local variables in the template.
[56] Fix | Delete
#
[57] Fix | Delete
# See the ERB.new and ERB#result methods for more detail.
[58] Fix | Delete
#
[59] Fix | Delete
#
[60] Fix | Delete
# == Examples
[61] Fix | Delete
#
[62] Fix | Delete
# === Plain Text
[63] Fix | Delete
#
[64] Fix | Delete
# ERB is useful for any generic templating situation. Note that in this example, we use the
[65] Fix | Delete
# convenient "% at start of line" tag, and we quote the template literally with
[66] Fix | Delete
# <tt>%q{...}</tt> to avoid trouble with the backslash.
[67] Fix | Delete
#
[68] Fix | Delete
# require "erb"
[69] Fix | Delete
#
[70] Fix | Delete
# # Create template.
[71] Fix | Delete
# template = %q{
[72] Fix | Delete
# From: James Edward Gray II <james@grayproductions.net>
[73] Fix | Delete
# To: <%= to %>
[74] Fix | Delete
# Subject: Addressing Needs
[75] Fix | Delete
#
[76] Fix | Delete
# <%= to[/\w+/] %>:
[77] Fix | Delete
#
[78] Fix | Delete
# Just wanted to send a quick note assuring that your needs are being
[79] Fix | Delete
# addressed.
[80] Fix | Delete
#
[81] Fix | Delete
# I want you to know that my team will keep working on the issues,
[82] Fix | Delete
# especially:
[83] Fix | Delete
#
[84] Fix | Delete
# <%# ignore numerous minor requests -- focus on priorities %>
[85] Fix | Delete
# % priorities.each do |priority|
[86] Fix | Delete
# * <%= priority %>
[87] Fix | Delete
# % end
[88] Fix | Delete
#
[89] Fix | Delete
# Thanks for your patience.
[90] Fix | Delete
#
[91] Fix | Delete
# James Edward Gray II
[92] Fix | Delete
# }.gsub(/^ /, '')
[93] Fix | Delete
#
[94] Fix | Delete
# message = ERB.new(template, 0, "%<>")
[95] Fix | Delete
#
[96] Fix | Delete
# # Set up template data.
[97] Fix | Delete
# to = "Community Spokesman <spokesman@ruby_community.org>"
[98] Fix | Delete
# priorities = [ "Run Ruby Quiz",
[99] Fix | Delete
# "Document Modules",
[100] Fix | Delete
# "Answer Questions on Ruby Talk" ]
[101] Fix | Delete
#
[102] Fix | Delete
# # Produce result.
[103] Fix | Delete
# email = message.result
[104] Fix | Delete
# puts email
[105] Fix | Delete
#
[106] Fix | Delete
# <i>Generates:</i>
[107] Fix | Delete
#
[108] Fix | Delete
# From: James Edward Gray II <james@grayproductions.net>
[109] Fix | Delete
# To: Community Spokesman <spokesman@ruby_community.org>
[110] Fix | Delete
# Subject: Addressing Needs
[111] Fix | Delete
#
[112] Fix | Delete
# Community:
[113] Fix | Delete
#
[114] Fix | Delete
# Just wanted to send a quick note assuring that your needs are being addressed.
[115] Fix | Delete
#
[116] Fix | Delete
# I want you to know that my team will keep working on the issues, especially:
[117] Fix | Delete
#
[118] Fix | Delete
# * Run Ruby Quiz
[119] Fix | Delete
# * Document Modules
[120] Fix | Delete
# * Answer Questions on Ruby Talk
[121] Fix | Delete
#
[122] Fix | Delete
# Thanks for your patience.
[123] Fix | Delete
#
[124] Fix | Delete
# James Edward Gray II
[125] Fix | Delete
#
[126] Fix | Delete
# === Ruby in HTML
[127] Fix | Delete
#
[128] Fix | Delete
# ERB is often used in <tt>.rhtml</tt> files (HTML with embedded Ruby). Notice the need in
[129] Fix | Delete
# this example to provide a special binding when the template is run, so that the instance
[130] Fix | Delete
# variables in the Product object can be resolved.
[131] Fix | Delete
#
[132] Fix | Delete
# require "erb"
[133] Fix | Delete
#
[134] Fix | Delete
# # Build template data class.
[135] Fix | Delete
# class Product
[136] Fix | Delete
# def initialize( code, name, desc, cost )
[137] Fix | Delete
# @code = code
[138] Fix | Delete
# @name = name
[139] Fix | Delete
# @desc = desc
[140] Fix | Delete
# @cost = cost
[141] Fix | Delete
#
[142] Fix | Delete
# @features = [ ]
[143] Fix | Delete
# end
[144] Fix | Delete
#
[145] Fix | Delete
# def add_feature( feature )
[146] Fix | Delete
# @features << feature
[147] Fix | Delete
# end
[148] Fix | Delete
#
[149] Fix | Delete
# # Support templating of member data.
[150] Fix | Delete
# def get_binding
[151] Fix | Delete
# binding
[152] Fix | Delete
# end
[153] Fix | Delete
#
[154] Fix | Delete
# # ...
[155] Fix | Delete
# end
[156] Fix | Delete
#
[157] Fix | Delete
# # Create template.
[158] Fix | Delete
# template = %{
[159] Fix | Delete
# <html>
[160] Fix | Delete
# <head><title>Ruby Toys -- <%= @name %></title></head>
[161] Fix | Delete
# <body>
[162] Fix | Delete
#
[163] Fix | Delete
# <h1><%= @name %> (<%= @code %>)</h1>
[164] Fix | Delete
# <p><%= @desc %></p>
[165] Fix | Delete
#
[166] Fix | Delete
# <ul>
[167] Fix | Delete
# <% @features.each do |f| %>
[168] Fix | Delete
# <li><b><%= f %></b></li>
[169] Fix | Delete
# <% end %>
[170] Fix | Delete
# </ul>
[171] Fix | Delete
#
[172] Fix | Delete
# <p>
[173] Fix | Delete
# <% if @cost < 10 %>
[174] Fix | Delete
# <b>Only <%= @cost %>!!!</b>
[175] Fix | Delete
# <% else %>
[176] Fix | Delete
# Call for a price, today!
[177] Fix | Delete
# <% end %>
[178] Fix | Delete
# </p>
[179] Fix | Delete
#
[180] Fix | Delete
# </body>
[181] Fix | Delete
# </html>
[182] Fix | Delete
# }.gsub(/^ /, '')
[183] Fix | Delete
#
[184] Fix | Delete
# rhtml = ERB.new(template)
[185] Fix | Delete
#
[186] Fix | Delete
# # Set up template data.
[187] Fix | Delete
# toy = Product.new( "TZ-1002",
[188] Fix | Delete
# "Rubysapien",
[189] Fix | Delete
# "Geek's Best Friend! Responds to Ruby commands...",
[190] Fix | Delete
# 999.95 )
[191] Fix | Delete
# toy.add_feature("Listens for verbal commands in the Ruby language!")
[192] Fix | Delete
# toy.add_feature("Ignores Perl, Java, and all C variants.")
[193] Fix | Delete
# toy.add_feature("Karate-Chop Action!!!")
[194] Fix | Delete
# toy.add_feature("Matz signature on left leg.")
[195] Fix | Delete
# toy.add_feature("Gem studded eyes... Rubies, of course!")
[196] Fix | Delete
#
[197] Fix | Delete
# # Produce result.
[198] Fix | Delete
# rhtml.run(toy.get_binding)
[199] Fix | Delete
#
[200] Fix | Delete
# <i>Generates (some blank lines removed):</i>
[201] Fix | Delete
#
[202] Fix | Delete
# <html>
[203] Fix | Delete
# <head><title>Ruby Toys -- Rubysapien</title></head>
[204] Fix | Delete
# <body>
[205] Fix | Delete
#
[206] Fix | Delete
# <h1>Rubysapien (TZ-1002)</h1>
[207] Fix | Delete
# <p>Geek's Best Friend! Responds to Ruby commands...</p>
[208] Fix | Delete
#
[209] Fix | Delete
# <ul>
[210] Fix | Delete
# <li><b>Listens for verbal commands in the Ruby language!</b></li>
[211] Fix | Delete
# <li><b>Ignores Perl, Java, and all C variants.</b></li>
[212] Fix | Delete
# <li><b>Karate-Chop Action!!!</b></li>
[213] Fix | Delete
# <li><b>Matz signature on left leg.</b></li>
[214] Fix | Delete
# <li><b>Gem studded eyes... Rubies, of course!</b></li>
[215] Fix | Delete
# </ul>
[216] Fix | Delete
#
[217] Fix | Delete
# <p>
[218] Fix | Delete
# Call for a price, today!
[219] Fix | Delete
# </p>
[220] Fix | Delete
#
[221] Fix | Delete
# </body>
[222] Fix | Delete
# </html>
[223] Fix | Delete
#
[224] Fix | Delete
#
[225] Fix | Delete
# == Notes
[226] Fix | Delete
#
[227] Fix | Delete
# There are a variety of templating solutions available in various Ruby projects:
[228] Fix | Delete
# * ERB's big brother, eRuby, works the same but is written in C for speed;
[229] Fix | Delete
# * Amrita (smart at producing HTML/XML);
[230] Fix | Delete
# * cs/Template (written in C for speed);
[231] Fix | Delete
# * RDoc, distributed with Ruby, uses its own template engine, which can be reused elsewhere;
[232] Fix | Delete
# * and others; search the RAA.
[233] Fix | Delete
#
[234] Fix | Delete
# Rails, the web application framework, uses ERB to create views.
[235] Fix | Delete
#
[236] Fix | Delete
class ERB
[237] Fix | Delete
Revision = '$Date: 2009-02-24 02:44:50 +0900 (Tue, 24 Feb 2009) $' #'
[238] Fix | Delete
[239] Fix | Delete
# Returns revision information for the erb.rb module.
[240] Fix | Delete
def self.version
[241] Fix | Delete
"erb.rb [2.1.0 #{ERB::Revision.split[1]}]"
[242] Fix | Delete
end
[243] Fix | Delete
end
[244] Fix | Delete
[245] Fix | Delete
#--
[246] Fix | Delete
# ERB::Compiler
[247] Fix | Delete
class ERB
[248] Fix | Delete
class Compiler # :nodoc:
[249] Fix | Delete
class PercentLine # :nodoc:
[250] Fix | Delete
def initialize(str)
[251] Fix | Delete
@value = str
[252] Fix | Delete
end
[253] Fix | Delete
attr_reader :value
[254] Fix | Delete
alias :to_s :value
[255] Fix | Delete
[256] Fix | Delete
def empty?
[257] Fix | Delete
@value.empty?
[258] Fix | Delete
end
[259] Fix | Delete
end
[260] Fix | Delete
[261] Fix | Delete
class Scanner # :nodoc:
[262] Fix | Delete
@scanner_map = {}
[263] Fix | Delete
def self.regist_scanner(klass, trim_mode, percent)
[264] Fix | Delete
@scanner_map[[trim_mode, percent]] = klass
[265] Fix | Delete
end
[266] Fix | Delete
[267] Fix | Delete
def self.default_scanner=(klass)
[268] Fix | Delete
@default_scanner = klass
[269] Fix | Delete
end
[270] Fix | Delete
[271] Fix | Delete
def self.make_scanner(src, trim_mode, percent)
[272] Fix | Delete
klass = @scanner_map.fetch([trim_mode, percent], @default_scanner)
[273] Fix | Delete
klass.new(src, trim_mode, percent)
[274] Fix | Delete
end
[275] Fix | Delete
[276] Fix | Delete
def initialize(src, trim_mode, percent)
[277] Fix | Delete
@src = src
[278] Fix | Delete
@stag = nil
[279] Fix | Delete
end
[280] Fix | Delete
attr_accessor :stag
[281] Fix | Delete
[282] Fix | Delete
def scan; end
[283] Fix | Delete
end
[284] Fix | Delete
[285] Fix | Delete
class TrimScanner < Scanner # :nodoc:
[286] Fix | Delete
def initialize(src, trim_mode, percent)
[287] Fix | Delete
super
[288] Fix | Delete
@trim_mode = trim_mode
[289] Fix | Delete
@percent = percent
[290] Fix | Delete
if @trim_mode == '>'
[291] Fix | Delete
@scan_line = self.method(:trim_line1)
[292] Fix | Delete
elsif @trim_mode == '<>'
[293] Fix | Delete
@scan_line = self.method(:trim_line2)
[294] Fix | Delete
elsif @trim_mode == '-'
[295] Fix | Delete
@scan_line = self.method(:explicit_trim_line)
[296] Fix | Delete
else
[297] Fix | Delete
@scan_line = self.method(:scan_line)
[298] Fix | Delete
end
[299] Fix | Delete
end
[300] Fix | Delete
attr_accessor :stag
[301] Fix | Delete
[302] Fix | Delete
def scan(&block)
[303] Fix | Delete
@stag = nil
[304] Fix | Delete
if @percent
[305] Fix | Delete
@src.each do |line|
[306] Fix | Delete
percent_line(line, &block)
[307] Fix | Delete
end
[308] Fix | Delete
else
[309] Fix | Delete
@scan_line.call(@src, &block)
[310] Fix | Delete
end
[311] Fix | Delete
nil
[312] Fix | Delete
end
[313] Fix | Delete
[314] Fix | Delete
def percent_line(line, &block)
[315] Fix | Delete
if @stag || line[0] != ?%
[316] Fix | Delete
return @scan_line.call(line, &block)
[317] Fix | Delete
end
[318] Fix | Delete
[319] Fix | Delete
line[0] = ''
[320] Fix | Delete
if line[0] == ?%
[321] Fix | Delete
@scan_line.call(line, &block)
[322] Fix | Delete
else
[323] Fix | Delete
yield(PercentLine.new(line.chomp))
[324] Fix | Delete
end
[325] Fix | Delete
end
[326] Fix | Delete
[327] Fix | Delete
def scan_line(line)
[328] Fix | Delete
line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>|\n|\z)/m) do |tokens|
[329] Fix | Delete
tokens.each do |token|
[330] Fix | Delete
next if token.empty?
[331] Fix | Delete
yield(token)
[332] Fix | Delete
end
[333] Fix | Delete
end
[334] Fix | Delete
end
[335] Fix | Delete
[336] Fix | Delete
def trim_line1(line)
[337] Fix | Delete
line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens|
[338] Fix | Delete
tokens.each do |token|
[339] Fix | Delete
next if token.empty?
[340] Fix | Delete
if token == "%>\n"
[341] Fix | Delete
yield('%>')
[342] Fix | Delete
yield(:cr)
[343] Fix | Delete
else
[344] Fix | Delete
yield(token)
[345] Fix | Delete
end
[346] Fix | Delete
end
[347] Fix | Delete
end
[348] Fix | Delete
end
[349] Fix | Delete
[350] Fix | Delete
def trim_line2(line)
[351] Fix | Delete
head = nil
[352] Fix | Delete
line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens|
[353] Fix | Delete
tokens.each do |token|
[354] Fix | Delete
next if token.empty?
[355] Fix | Delete
head = token unless head
[356] Fix | Delete
if token == "%>\n"
[357] Fix | Delete
yield('%>')
[358] Fix | Delete
if is_erb_stag?(head)
[359] Fix | Delete
yield(:cr)
[360] Fix | Delete
else
[361] Fix | Delete
yield("\n")
[362] Fix | Delete
end
[363] Fix | Delete
head = nil
[364] Fix | Delete
else
[365] Fix | Delete
yield(token)
[366] Fix | Delete
head = nil if token == "\n"
[367] Fix | Delete
end
[368] Fix | Delete
end
[369] Fix | Delete
end
[370] Fix | Delete
end
[371] Fix | Delete
[372] Fix | Delete
def explicit_trim_line(line)
[373] Fix | Delete
line.scan(/(.*?)(^[ \t]*<%\-|<%\-|<%%|%%>|<%=|<%#|<%|-%>\n|-%>|%>|\z)/m) do |tokens|
[374] Fix | Delete
tokens.each do |token|
[375] Fix | Delete
next if token.empty?
[376] Fix | Delete
if @stag.nil? && /[ \t]*<%-/ =~ token
[377] Fix | Delete
yield('<%')
[378] Fix | Delete
elsif @stag && token == "-%>\n"
[379] Fix | Delete
yield('%>')
[380] Fix | Delete
yield(:cr)
[381] Fix | Delete
elsif @stag && token == '-%>'
[382] Fix | Delete
yield('%>')
[383] Fix | Delete
else
[384] Fix | Delete
yield(token)
[385] Fix | Delete
end
[386] Fix | Delete
end
[387] Fix | Delete
end
[388] Fix | Delete
end
[389] Fix | Delete
[390] Fix | Delete
ERB_STAG = %w(<%= <%# <%)
[391] Fix | Delete
def is_erb_stag?(s)
[392] Fix | Delete
ERB_STAG.member?(s)
[393] Fix | Delete
end
[394] Fix | Delete
end
[395] Fix | Delete
[396] Fix | Delete
Scanner.default_scanner = TrimScanner
[397] Fix | Delete
[398] Fix | Delete
class SimpleScanner < Scanner # :nodoc:
[399] Fix | Delete
def scan
[400] Fix | Delete
@src.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>|\n|\z)/m) do |tokens|
[401] Fix | Delete
tokens.each do |token|
[402] Fix | Delete
next if token.empty?
[403] Fix | Delete
yield(token)
[404] Fix | Delete
end
[405] Fix | Delete
end
[406] Fix | Delete
end
[407] Fix | Delete
end
[408] Fix | Delete
[409] Fix | Delete
Scanner.regist_scanner(SimpleScanner, nil, false)
[410] Fix | Delete
[411] Fix | Delete
begin
[412] Fix | Delete
require 'strscan'
[413] Fix | Delete
class SimpleScanner2 < Scanner # :nodoc:
[414] Fix | Delete
def scan
[415] Fix | Delete
stag_reg = /(.*?)(<%%|<%=|<%#|<%|\z)/m
[416] Fix | Delete
etag_reg = /(.*?)(%%>|%>|\z)/m
[417] Fix | Delete
scanner = StringScanner.new(@src)
[418] Fix | Delete
while ! scanner.eos?
[419] Fix | Delete
scanner.scan(@stag ? etag_reg : stag_reg)
[420] Fix | Delete
yield(scanner[1])
[421] Fix | Delete
yield(scanner[2])
[422] Fix | Delete
end
[423] Fix | Delete
end
[424] Fix | Delete
end
[425] Fix | Delete
Scanner.regist_scanner(SimpleScanner2, nil, false)
[426] Fix | Delete
[427] Fix | Delete
class ExplicitScanner < Scanner # :nodoc:
[428] Fix | Delete
def scan
[429] Fix | Delete
stag_reg = /(.*?)(^[ \t]*<%-|<%%|<%=|<%#|<%-|<%|\z)/m
[430] Fix | Delete
etag_reg = /(.*?)(%%>|-%>|%>|\z)/m
[431] Fix | Delete
scanner = StringScanner.new(@src)
[432] Fix | Delete
while ! scanner.eos?
[433] Fix | Delete
scanner.scan(@stag ? etag_reg : stag_reg)
[434] Fix | Delete
yield(scanner[1])
[435] Fix | Delete
[436] Fix | Delete
elem = scanner[2]
[437] Fix | Delete
if /[ \t]*<%-/ =~ elem
[438] Fix | Delete
yield('<%')
[439] Fix | Delete
elsif elem == '-%>'
[440] Fix | Delete
yield('%>')
[441] Fix | Delete
yield(:cr) if scanner.scan(/(\n|\z)/)
[442] Fix | Delete
else
[443] Fix | Delete
yield(elem)
[444] Fix | Delete
end
[445] Fix | Delete
end
[446] Fix | Delete
end
[447] Fix | Delete
end
[448] Fix | Delete
Scanner.regist_scanner(ExplicitScanner, '-', false)
[449] Fix | Delete
[450] Fix | Delete
rescue LoadError
[451] Fix | Delete
end
[452] Fix | Delete
[453] Fix | Delete
class Buffer # :nodoc:
[454] Fix | Delete
def initialize(compiler)
[455] Fix | Delete
@compiler = compiler
[456] Fix | Delete
@line = []
[457] Fix | Delete
@script = ""
[458] Fix | Delete
@compiler.pre_cmd.each do |x|
[459] Fix | Delete
push(x)
[460] Fix | Delete
end
[461] Fix | Delete
end
[462] Fix | Delete
attr_reader :script
[463] Fix | Delete
[464] Fix | Delete
def push(cmd)
[465] Fix | Delete
@line << cmd
[466] Fix | Delete
end
[467] Fix | Delete
[468] Fix | Delete
def cr
[469] Fix | Delete
@script << (@line.join('; '))
[470] Fix | Delete
@line = []
[471] Fix | Delete
@script << "\n"
[472] Fix | Delete
end
[473] Fix | Delete
[474] Fix | Delete
def close
[475] Fix | Delete
return unless @line
[476] Fix | Delete
@compiler.post_cmd.each do |x|
[477] Fix | Delete
push(x)
[478] Fix | Delete
end
[479] Fix | Delete
@script << (@line.join('; '))
[480] Fix | Delete
@line = nil
[481] Fix | Delete
end
[482] Fix | Delete
end
[483] Fix | Delete
[484] Fix | Delete
def content_dump(s)
[485] Fix | Delete
n = s.count("\n")
[486] Fix | Delete
if n > 0
[487] Fix | Delete
s.dump + "\n" * n
[488] Fix | Delete
else
[489] Fix | Delete
s.dump
[490] Fix | Delete
end
[491] Fix | Delete
end
[492] Fix | Delete
[493] Fix | Delete
def compile(s)
[494] Fix | Delete
out = Buffer.new(self)
[495] Fix | Delete
[496] Fix | Delete
content = ''
[497] Fix | Delete
scanner = make_scanner(s)
[498] Fix | Delete
scanner.scan do |token|
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function