Advertisement
gerkrt

RGSS HTML DOCUMENT

Sep 14th, 2011
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 22.73 KB | None | 0 0
  1. #==============================================================================
  2. # RGSS HTML DOCUMENT
  3. # By gerkrt/gerrtunk
  4. # Version: 1.13
  5. # License: MIT, credits
  6. # Date: 24/01/2011
  7. # IMPORTANT NOTE: to acces the more actualitzed or corrected version of this
  8. # script check here: http://usuarios.multimania.es/kisap/english_list.html
  9. #==============================================================================
  10.  
  11.  
  12. =begin
  13.  
  14.  
  15. ####################
  16. #RGSS HTML DOCUMENT#
  17. ####################
  18.  
  19. This object represents a html page in memory. You can open it, write, format
  20. and finally save to a file.
  21.  
  22. You only can write to the document throught the write methods, but you
  23. have a plenty of them, and a few shortcuts and automtism.
  24.  
  25. For last, the html code is in a single string called contents, that can
  26. only be readed. The save in a html file is done at the end, calling a closing
  27. method.
  28.  
  29.  
  30. #################################
  31. #####INTRODUCTION TUTORIAL#######
  32. #################################
  33.  
  34. 1. Creating the document.
  35.  
  36.  The best way of creating the document is passing to the constructor the title
  37.  and bgcolor (if you want to changue default ones) because it saves you a
  38.  lot of trouble.
  39.  
  40.  Although the example uses a the name doc, you may want to short these name so
  41.  it will be quickier to write html documents. Something like d is less readable but...
  42.  
  43. 2. Basic format options.
  44.  
  45.  Define your basic formating options for the text, thats the format options
  46.  for the core text and that will be most used. Set these options to default
  47.  changuing the initialize method of the class(that may be nice if you only
  48.  want to use one type of document) or call a Form method before doing nothing.
  49.  
  50. 3. Changuing the text format when you need it.
  51.  
  52.  When you need to changue the format of the text for whatever reason...
  53.  (a header, title, etc) use temporal formating. tForm method changues the format
  54.  for a limited number of wX calls so, you can use it by default to write in
  55.  different format a single line, or header.
  56.  
  57. 4. Understanding the difference bewteen wCode, wTxt, wLine and using shortcuts.
  58.  
  59.  These are you main ways of writing to the document. wLine is thee more usefol
  60.  for normal text writing because it appends a \n at the end of it. wTxt is like
  61.  wLine but without the \n. Finally wCode is used to add non formated codes to the
  62.  document, so you can add whatever you want to it.
  63.  Each of these three methods have a shorter alias, that are wC, wT, and wL
  64.  respecitbely.
  65.  
  66. 5. Ending the document.
  67.  
  68.  It will be very rare that you need to use some other method than endSave.
  69.  This is the better option because it  closes the document and writes it in one
  70.  step.
  71.  
  72.  
  73.  
  74. ##########################
  75. #####SAMPLE EXAMPLE#######
  76. ##########################
  77.  
  78. doc = HtmlDoc.new 'log', 'Title: You can set title through constructor also', 'black'
  79. doc.b=true
  80. doc.wH 'Combat against King Limo', 1
  81. doc.b=false
  82. doc.wTable ''
  83. doc.size=8
  84. doc.wP 'textoooooooooooooooooooooooooo', 'center'
  85. doc.tForm 'b,u,44,#red,Arial',4
  86. doc.wLine 'Testing line'
  87. doc.wBr
  88. doc.wBr
  89. doc.wList ['wep', 'wea', 'yu']#, type='ul', style='square'
  90. doc.wBr 15
  91. doc.wList [['wep', 'm'], ['wep','wea']], type='dl' #style='square'
  92.  
  93. doc.wImg 'wep.png', 'width=18 height= 22 border=5'
  94. doc.wLink 'www.google.es', 'test'
  95. doc.Form 'u,@blue'
  96.  
  97. doc.endSave
  98.  
  99.  
  100.  
  101. ####################
  102. #COMPLETE REFERENCE#
  103. ####################
  104.  
  105.  
  106. CREATING A NEW HTMLDOC OBJECT
  107.  
  108. The constructor needs the html filename (accepts path, but it puts
  109. automatically the extension .html when saving it), and accepts two extra
  110. parameters:
  111.  
  112. Note thats recommended to use all the arguments except the charset. The other
  113. way is more complex and slow.
  114.  
  115. title: you can pass the title of the HTML page. If you do, it will be called
  116. the wHead method and it will asigned automatically
  117.  
  118. bgcolor: in the same way, you can set the bgcolor of the body here. This
  119. will call the wBody method.
  120.  
  121. charset: for default it is utf8, but you can changue it.
  122.  
  123. Note that if you pass these two arguments, the creation of the starting part
  124. of the document is more quick.
  125.  
  126.  
  127. ------ATRIBUTES-------
  128.  
  129. You can set or get any of these atributes:
  130.  
  131. (text atributes in html)
  132. -b  (bold text sytle)
  133. -u  (underlined text sytle)
  134. -i  (italic cursive text sytle)
  135.  
  136. (font atributes in html)
  137. -size
  138. -name
  139. -color (html color names or hexadecimal code)
  140.  
  141. (background colors for page or other things in html)
  142. -bgcolor (html color names or hexadecimal code)
  143.  
  144. (the file where it will be sav ed)
  145. -filename
  146.  
  147. You can also read the string contents, that have all the html code.
  148.  
  149.  
  150. -------FORMATING--------
  151.  
  152. This object writes formated code using his owns previsously named atributes as
  153. a marks. So, if you have the b atribute to true, it will write   each
  154. time you write a text. It also writes all the font information that is font name,
  155. color and size.
  156.  
  157. The way for formating a htmldoc is to changue these values each time you need
  158. to modifiy the text format. But, for this task you have two options:
  159.  
  160.   A. You can use the atributes way, and just modifiy each time setting they.
  161.  
  162.   B. You can use the format method(Form) that interprets a string to changue the
  163.   state of the format atributes. So, for example if you call:
  164.  
  165.   doc.Form 'b,u,13,#red,Arial'
  166.  
  167.   You are changuing all these atributes. The b, i, u, etc work in a mechanism way,
  168.   so if its true it will be false, and if false, it will be true. The number is
  169.   for the font size.
  170.  
  171.   Note that font colors use the special code # to mark them and bg colors use @
  172.  
  173.  
  174. -------TEMPORAL FORMATING-------
  175.  
  176. Using this method(tFom) you can changue any atributes temporally, so that
  177. they only will be aplied to the next x write methods(default=1). Note that
  178. the methods endhtml, save, saveend, wLn, format and tformat dont reduce
  179. the count.
  180.  
  181. doc.tForm 'b u 13 #red Arial', 3
  182.  
  183.  
  184. ------GENERAL WRITE METHODS------
  185.  
  186. These are. They are abreviated like wX
  187.  
  188. wLine: Writes a string of text and appends a final <br>
  189.  
  190. wH: Writes a formated header. Accepts a string name and a addiotional integer value 1-6. Note
  191. that font size formating is skiped here. Default=2.
  192.  
  193. wTxt: Writes a formated string of text.
  194.  
  195. wList: Writes a list based on a given array. The natural is a string array,
  196. but it forces the to_s of the object so if you have these implemented, it will
  197. work.
  198.  
  199. You can pass two extra parameters:
  200.  
  201. type: 'dl', 'ul', 'ol' for each of the posible html lists. Default is ul.
  202.   ul --> unordened list that uses simbols as entry marks
  203.   ol --> here the entry marks vary to ordered numbers, letters, roman numbers, etc
  204.  
  205. style: 'square' or 'i'(and others) for each of the posible graphics for the lists. Default are
  206. 1, circle.
  207.  
  208. Note that for dl you have to pass a array of two elements arrays, like:
  209. [[1, 'wep'], ['test', 'fooop']]
  210.  
  211. wBr: writes a single <BR>. You can also set and extra numeric argument so
  212. it writes all that BR's.
  213.  
  214. wHr: Like the Wbr, but with <hr>
  215.  
  216. wTable(info, border=5, param='', names='', bold=true):
  217. This method can write a table showing the values of of a rgss table with
  218. two dimensions. Table writing is the more complex thing of these script. It haves
  219. these parameters
  220.  
  221.   border: by default 5, it adds the atribute border width 5 to the table. This
  222.   is vital to make the table borders visibles.
  223.  
  224.   param: this is a string that may contain any extra atributes for the table, the
  225.   text is concatenated just before the border atribute.
  226.  
  227.   names: this is a string that defines the columns names in the table.
  228.     names = 'a,b,c,ddddd '
  229.     The string is splitted by , and applied in order to the columns
  230.     col1 = 'a' col2 = 'b' col3 = 'c', etc
  231.  
  232.   bold: this boolean sets the font of the names list to bold, so it looks better.
  233.  
  234. wP(text, align): You can write a new paragraph with setting the alignement
  235. for it. The default align is left.
  236.  
  237. wLink(link, description): Writes a html link with optional description text.
  238. If not passed, description is the link dir.
  239.  
  240. wImg(img, width, height): Writes a image, and also you can set optionally
  241. the width and height. Default values are 100
  242.  
  243.  
  244. --------STARTING METHODS---------
  245.  
  246. wHead(title): This method  writes all the header. You have to pass
  247. a optional string for the title of the page. The default is ''
  248.  
  249. wBody(bgcolor): This starts the body, fixing the bgcolor. If not bgcolor
  250. is passed, it will use the atribute defined one.
  251.  
  252. Note that is better to not use this methods and send this options in the
  253. constructor.
  254.  
  255.  
  256. -------ENDING AND SAVING METHODS--------
  257.  
  258. endSave: Use this method if you just want to end a html document and save
  259. it directly to the file. No other uses for it.
  260.  
  261. wEnd: This writes the ending of html, but it dont save it.
  262.  
  263. saveDoc: This save the document to the specified file.
  264.  
  265.  
  266. -------OTHER METHODS---------
  267.  
  268. wNl: Used internally for the program. A abbreviation to append \n in some parts.
  269. redCount: This method is called at the end of some methods and it checks and reduces
  270. the temporal formating count.
  271.  
  272.  
  273. -------SHORTED METHODS----------
  274.  
  275. wLine, wTxt and wCode have shortened methods that work like
  276. the same:
  277.  
  278. wL : wLine
  279. wT : WTxt
  280. wC : wCode
  281.  
  282.  
  283. -------NON FORMATED TEXT AND EXTRA CODE-----------
  284.  
  285. If you want to show a non formated text, or a add a completely yours thing
  286. to the code, or make any other special thing, you have to use the write code
  287. method(wCode)
  288.  
  289. This dont add any extra code to the string you pass, so its a clean way of adding
  290. some things to the contents.
  291.  
  292.  
  293. --------PASSING EXTRA ATRIBUTES TO HTML TAGS (param string)--------
  294.  
  295. You know that in html for example you can define the widht and height of a picture
  296. or the border.
  297.  
  298. You can pass to some wMethods a extra parameter called param. This
  299. string is addedd after the start of the html tag, so per example:
  300.  
  301. doc.wImg 'wep.png', 'width=18 height= 22 border=5'
  302.  
  303. Will result in the code :
  304.  
  305. <img src=wep.png width=18 height= 22 border=5>
  306.  
  307. Note that not all of the methods accept this. Its been implemented in
  308. that have interesting html tags for the purpose of the script. For now they are
  309. wImg and wTable.
  310.  
  311. Finally, the more common functions are passed as single arguments, thought you
  312. can pass like this if you want. They are passed as signle arguments because
  313. they are quicker to write.
  314.  
  315.  
  316. --------ADDING SPECIAL FORMATINGS----------
  317.  
  318. The way of adding extra formating is calling wTxt sending the text with
  319. the special html tags. Example:
  320.  
  321. doc.wTxt [sub] example text [/sub]
  322.  
  323.  
  324. =end
  325.  
  326.  
  327.  
  328. #==============================================================================
  329. # ** HtmlDoc
  330. #------------------------------------------------------------------------------
  331. #  This represents a Html Document in RGSS
  332. #==============================================================================
  333.  
  334. class HtmlDoc
  335.    
  336.   attr_accessor  :b
  337.   attr_accessor  :u
  338.   attr_accessor  :i
  339.      
  340.   attr_accessor  :size
  341.   attr_accessor  :color
  342.   attr_accessor  :name
  343.  
  344.   attr_accessor  :filename
  345.  
  346.   attr_reader    :contents
  347.  
  348.   #--------------------------------------------------------------------------
  349.   # * Object Initialization
  350.   #--------------------------------------------------------------------------
  351.   def initialize(filename, title='', bgcolor='', charset='utf-8')
  352.     @filename = filename    # The name of the file. Is added +.txt later
  353.     @contents = ""          # String that contain all the html contents
  354.     @form_count = 0         # The counter used for temporal formating
  355.     @count_active = false   # Mark used by the temporal formating
  356.     @temporal_codes = ''    # This is used to save the reverse codes for temporalformating
  357.    
  358.     # HTML and font atributes and their default values
  359.     @name = 'Arial'
  360.     @b = false  
  361.     @u = false
  362.     @i = false
  363.     @size = '8'
  364.     @color = 'black'
  365.     @bgcolor = 'blue'
  366.    
  367.     # Write title if passed
  368.     if title
  369.       wHead(title)
  370.     end
  371.    
  372.     # Write bgcolor if passed
  373.     if bgcolor
  374.       @bgcolor = bgcolor
  375.       wBody
  376.     end
  377.    
  378.     # Write charset
  379.     if charset
  380.       "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=#{charset}\" \n"
  381.     end
  382.  
  383.   #--------------------------------------------------------------------------
  384.   # * wTable
  385.   #--------------------------------------------------------------------------
  386.   def wTable (info, border=5, param='', names='', bold=true)
  387.  
  388.     @contents+="<table border= #{border.to_s} #{param.to_s}>"
  389.    
  390.     # When is a rgss table(x,y)
  391.     if info.is_a? Table
  392.       # If atributes names parameter is passed
  393.       if names
  394.         # Split names
  395.         splitted = names.split(',')
  396.        
  397.         # Starts a mechanism to changue bold if true and backup it
  398.         # after the table is writed
  399.         dont_remove_bold = false
  400.        
  401.         if bold and not @b
  402.           @b = true
  403.         elsif bold and @b
  404.           dont_remove_bold = true
  405.         end
  406.        
  407.         # Writes a first row with the atributes names
  408.         @contents+='<tr>'
  409.         for j in 0...info.ysize
  410.           @contents+='<td>'
  411.           wTxt splitted[j], false
  412.           @contents+='</td>'
  413.         end
  414.        
  415.         # Ends bold mechanism
  416.         if bold and not dont_remove_bold
  417.           @b = false
  418.         end
  419.       end
  420.      
  421.    
  422.       # Writes the html table
  423.       for i in 0...info.xsize
  424.         @contents+='<tr>'
  425.         for j in 0...info.ysize
  426.           @contents+='<td>'
  427.           wTxt info[i,j].to_s, false
  428.           @contents+='</td>'
  429.         end
  430.       end
  431.      
  432.  
  433.     end
  434.     @contents+='</table>'
  435.     #Check for count and reduce it
  436.     redCount
  437.   end
  438.  
  439.   #--------------------------------------------------------------------------
  440.   # * wP
  441.   #--------------------------------------------------------------------------
  442.   def wP (text, align='left')
  443.     @contents += "<p align=#{align}>"
  444.     wTxt text
  445.     @contents += "</p>"
  446.   end
  447.  
  448.  
  449.   #--------------------------------------------------------------------------
  450.   # * tForm
  451.   #--------------------------------------------------------------------------
  452.   def tForm(origcodes, count=1)
  453.     # Active count
  454.     @form_count = count
  455.     @count_active = true
  456.    
  457.    
  458.     temp = ''
  459.     # Split codes to extract they
  460.     codes = origcodes.split(',')  
  461.     # Constructs a form code that redo the temporal one
  462.     for code in codes
  463.       # The format functions in a mechanism way for these
  464.       if code == 'b'
  465.         temp += 'b'
  466.      
  467.       elsif code == 'i'
  468.         temp += 'i'
  469.  
  470.       elsif code == 'u'
  471.         temp += 'u'
  472.      
  473.       # For the others it have to write the font name
  474.       elsif code.to_i.to_s == code
  475.         temp += @size.to_s
  476.        
  477.       elsif code.include? '#'
  478.         temp += '#'+@color
  479.        
  480.       elsif code.include? '@'
  481.         temp += '@'+@bgcolor
  482.        
  483.       else
  484.         temp += @name
  485.        
  486.       end
  487.       temp+=','
  488.     end
  489.    
  490.     # Backup that reversing codes
  491.     @temporal_codes = temp
  492.    
  493.     # Call normal formating to apply the format
  494.     Form origcodes
  495.  
  496.   end
  497.    
  498.   #--------------------------------------------------------------------------
  499.   # * Form
  500.   #--------------------------------------------------------------------------
  501.   def Form(string)
  502.     # Split string to extract codes
  503.     codes = string.split(',')   #=> ["now's", "the", "time"]
  504.    
  505.     # Iterate in each code and apply it
  506.     for code in codes
  507.       if code == 'b'
  508.         @b ? @b = false : @b = true
  509.      
  510.       elsif code == 'i'
  511.         @i ? @i = false : @i = true
  512.  
  513.       elsif code == 'u'
  514.         @u ? @u = false : @u = true
  515.      
  516.       elsif code.to_i.to_s == code
  517.         @size = code
  518.        
  519.       elsif code.include? '#'
  520.         @color = code
  521.        
  522.       elsif code.include? '@'
  523.         @bgcolor = code
  524.        
  525.       else
  526.         @name = code
  527.        
  528.       end
  529.     end
  530.  
  531.   end
  532.  
  533.  
  534.  
  535.   #--------------------------------------------------------------------------
  536.   # * wHead
  537.   #--------------------------------------------------------------------------
  538.   def wHead(title='')
  539.       @contents += "<html><head><title> #{@title} </title></head> \n"
  540.      
  541.       # Check for count and reduce it
  542.       redCount
  543.   end
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # * wCode
  547.   #--------------------------------------------------------------------------
  548.   def wCode(code)
  549.     @contents += code
  550.            
  551.     # Check for count and reduce it
  552.     redCount
  553.   end
  554.  
  555.   #--------------------------------------------------------------------------
  556.   # * wC
  557.   #--------------------------------------------------------------------------
  558.   def wC(code)
  559.     wCode(code)
  560.   end
  561.  
  562.   #--------------------------------------------------------------------------
  563.   # * wBr
  564.   #--------------------------------------------------------------------------
  565.   def wBr(num=1)
  566.     num.times{|i|@contents += '<br>'}
  567.     wNl
  568.            
  569.     # Check for count and reduce it
  570.     redCount
  571.   end
  572.  
  573.   #--------------------------------------------------------------------------
  574.   # * wHr
  575.   #--------------------------------------------------------------------------
  576.   def wHr(num=1)
  577.     num.times{|i|@contents += '<hr>'}
  578.     wNl
  579.            
  580.     # Check for count and reduce it
  581.     redCount
  582.   end
  583.  
  584.   #--------------------------------------------------------------------------
  585.   # * wNl
  586.   #--------------------------------------------------------------------------
  587.   def wNl
  588.     @contents += "\n"
  589.   end
  590.  
  591.   #--------------------------------------------------------------------------
  592.   # * wH
  593.   #--------------------------------------------------------------------------
  594.   def wH(text, num=2)
  595.     @contents += " <h#{num.to_s}> "
  596.     @contents += text
  597.     @contents += " </h#{num.to_s}> <br> \n "
  598.        
  599.     # Check for count and reduce it
  600.     redCount
  601.   end
  602.  
  603.   #--------------------------------------------------------------------------
  604.   # * wBody
  605.   #--------------------------------------------------------------------------
  606.   def wBody(bgcolor='')
  607.       if bgcolor
  608.         @contents += "<body bgcolor=#{bgcolor}> \n"
  609.       else
  610.         @contents += "<body bgcolor=#{@bgcolor}> \n"
  611.       end
  612.          
  613.     # Check for count and reduce it
  614.     redCount
  615.   end
  616.    
  617.   #--------------------------------------------------------------------------
  618.   # * wList
  619.   #--------------------------------------------------------------------------
  620.   def wList(array, type='ol', style='1')
  621.     # Set the entry mark text based on the list type pased
  622.     if type=='ol'
  623.       entry='li'
  624.      
  625.     elsif type=='dl'
  626.       entry='dt'
  627.      
  628.     end
  629.  
  630.     # Start list
  631.     @contents += "<#{type} type=#{style} >"
  632.    
  633.     # Write each entry
  634.     for o in array
  635.       # If its ol or li
  636.       if type == 'ol' or type == 'li'
  637.         @contents += "<#{entry}>"
  638.         wTxt(o.to_s)
  639.         @contents += "</#{entry}>"
  640.        
  641.       else
  642.       # If its a dictionary
  643.         @contents += "<#{entry}>"
  644.         wTxt(o[0].to_s)
  645.         @contents += "</#{entry}>"
  646.        
  647.         @contents += "<dd>"
  648.         wTxt(o[1].to_s)
  649.         @contents += "</dd>"
  650.       end
  651.     end
  652.    
  653.     # End list
  654.     @contents += "</#{type}>"
  655.        
  656.     # Check for count and reduce it
  657.     redCount
  658.   end
  659.  
  660.   #--------------------------------------------------------------------------
  661.   # * wImg
  662.   #--------------------------------------------------------------------------
  663.   def wImg(img_source, param='')
  664.     @contents += "<img src=#{img_source} #{param} >"
  665.     wBr
  666.     wNl
  667.        
  668.     # Check for count and reduce it
  669.     redCount
  670.   end
  671.  
  672.   #--------------------------------------------------------------------------
  673.   # * wLink
  674.   #--------------------------------------------------------------------------
  675.   def wLink(link, reftext='')
  676.     @contents += "<a href=#{link}> #{reftext} </a>"
  677.     wBr
  678.     wNl
  679.        
  680.     # Check for count and reduce it
  681.     redCount
  682.   end
  683.  
  684.  
  685.   #--------------------------------------------------------------------------
  686.   # * wLine
  687.   #--------------------------------------------------------------------------
  688.   def wLine(line)
  689.     wTxt(line)
  690.     @contents += '<br>'
  691.   end
  692.  
  693.   #--------------------------------------------------------------------------
  694.   # * wL
  695.   #--------------------------------------------------------------------------
  696.   def wL(line)
  697.     wLine(line)
  698.   end
  699.  
  700.   #--------------------------------------------------------------------------
  701.   # * wTxt
  702.   #--------------------------------------------------------------------------
  703.   def wTxt(txt, reduce_count=true)
  704.     # Line start
  705.     @contents  = "<font face=#{@name} size=#{@size.to_s} color=#{@color}> "
  706.    
  707.     if @b
  708.       @contents += '<b>'
  709.     end
  710.    
  711.     if @i
  712.       @contents += '<i>'
  713.     end
  714.    
  715.     if @u
  716.       @contents += '<u> '
  717.     end
  718.  
  719.    
  720.     # Write txt variable
  721.    
  722.     @contents += txt
  723.    
  724.     # Line end
  725.     if @u
  726.       @contents += ' </u>'
  727.     end
  728.    
  729.     if @i
  730.       @contents += '</i>'
  731.     end
  732.    
  733.     if @b
  734.       @contents += '</b>'
  735.     end
  736.    
  737.     @contents += " </font>\n"
  738.    
  739.     # Check for count and reduce it
  740.     redCount if reduce_count
  741.   end
  742.  
  743.   #--------------------------------------------------------------------------
  744.   # * wT
  745.   #--------------------------------------------------------------------------
  746.   def wT(txt)
  747.     wTxt (txt)
  748.   end
  749.  
  750.   #--------------------------------------------------------------------------
  751.   # * wEnd
  752.   #--------------------------------------------------------------------------
  753.   def wEnd
  754.     @contents += '</body></html>'
  755.   end
  756.  
  757.   #--------------------------------------------------------------------------
  758.   # * saveDoc
  759.   #--------------------------------------------------------------------------
  760.   def saveDoc
  761.     file = open(@filename + '.html',  'w')
  762.     file.write(@contents)
  763.     file.close
  764.   end
  765.  
  766.   #--------------------------------------------------------------------------
  767.   # * endSave
  768.   #--------------------------------------------------------------------------
  769.   def endSave
  770.     @contents += '</body></html>'
  771.     file = open(@filename + '.html',  'w')
  772.     file.write(@contents)
  773.     file.close
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # * redCount
  778.   #--------------------------------------------------------------------------
  779.   def redCount
  780.    
  781.     # If its the last count and active, call redo format and end all
  782.     if @form_count-1 == 0 and @count_active
  783.       @count_active = false
  784.       # Reverse temporal format calling the saved redo code
  785.       Form @temporal_codes
  786.       @temporal_codes = ''
  787.      
  788.     # If not reduce count and active
  789.     elsif @count_active
  790.       @form_count-=1
  791.     end
  792.    
  793.   end
  794. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement