mirror of
https://github.com/ToshioCP/Gtk4-tutorial.git
synced 2025-01-28 19:58:41 +01:00
Method name renum is changed to renum! because it's destructive.
This commit is contained in:
parent
ee82d53dff
commit
c2ecbf15b0
2 changed files with 5 additions and 5 deletions
4
Rakefile
4
Rakefile
|
@ -8,7 +8,7 @@ FileList['src/*.src.md'].each do |file|
|
|||
srcfiles << Sec_file.new(file)
|
||||
end
|
||||
srcfiles = Sec_files.new srcfiles
|
||||
srcfiles.renum
|
||||
srcfiles.renum!
|
||||
|
||||
mdfilenames = srcfiles.map {|srcfile| srcfile.to_md}
|
||||
htmlfilenames = srcfiles.map {|srcfile| "html/"+srcfile.to_html}
|
||||
|
@ -129,7 +129,7 @@ task all: [:md, :html, :pdf]
|
|||
|
||||
task md: mdfilenames+["Readme.md"]
|
||||
|
||||
file "Readme.md" do
|
||||
file "Readme.md" => mdfilenames do
|
||||
buf = [ "# Gtk4 Tutorial for beginners\n", "\n" ]
|
||||
buf << abstract
|
||||
buf << "\n"
|
||||
|
|
|
@ -67,7 +67,7 @@ class Sec_file < String
|
|||
def is_i?
|
||||
self.to_f == self.to_f.floor
|
||||
end
|
||||
def renum n
|
||||
def renum! n
|
||||
if n.instance_of?(String)
|
||||
n = n.to_i if n =~ /^\d+$/
|
||||
n = n.to_f if n =~ /^\d+\.\d+/
|
||||
|
@ -99,7 +99,7 @@ class Sec_files < Array
|
|||
raise "#{sec_files} is not an array."
|
||||
end
|
||||
end
|
||||
def renum
|
||||
def renum!
|
||||
self.sort!
|
||||
tbl = []
|
||||
n = 1
|
||||
|
@ -138,7 +138,7 @@ private
|
|||
end
|
||||
end
|
||||
unless found # OK to replace
|
||||
self[i].renum n
|
||||
self[i].renum! n
|
||||
tbl[i][2] = true
|
||||
# tbl[0] (old number (String) is kept in the array 'tbl')
|
||||
changed = true
|
||||
|
|
Loading…
Add table
Reference in a new issue