diff options
Diffstat (limited to 'lib/sisu/v0/digests.rb')
-rw-r--r-- | lib/sisu/v0/digests.rb | 109 |
1 files changed, 58 insertions, 51 deletions
diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb index 8c54649b..1e4e3c6a 100644 --- a/lib/sisu/v0/digests.rb +++ b/lib/sisu/v0/digests.rb @@ -1,52 +1,58 @@ =begin - * Name: SiSU information Structuring Universe - Structured information, Serialized Units + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + * Author: Ralph Amissah - * http://www.jus.uio.no/sisu - * http://www.jus.uio.no/sisu/SiSU/download.html - * Description: document digests (md5|sha256) and structure processing + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah All Rights Reserved. - * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Ralph Amissah + * License: GPL 3 or later: - * License: GPL 2 or later + SiSU, a framework for document structuring, publishing and search - Summary of GPL 2 + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. - If you have Internet connection, the latest version of the GPL should be - available at these locations: - http://www.fsf.org/licenses/gpl.html - http://www.gnu.org/copyleft/gpl.html - http://www.jus.uio.no/sisu/gpl2.fsf + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licenses/gpl.html> + <http://www.gnu.org/copyleft/gpl.html> + <http://www.jus.uio.no/sisu/gpl.fsf> - SiSU was first released to the public on January 4th 2005 + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system - SiSU uses: + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system + * Download: + <http://www.jus.uio.no/sisu/SiSU/download.html> - © Ralph Amissah 1997, current 2007. - All Rights Reserved. + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> - * Notes: tidy -ascii index.xml >> index.tidy + ** Description: document digests (md5|sha256) and structure processing - * Ralph Amissah: ralph@amissah.com - ralph.amissah@gmail.com =end module SiSU_Digest_view require "#{SiSU_lib}/dal" @@ -87,7 +93,8 @@ module SiSU_Digest_view private class Scroll <Source @@dl=nil - @@description,@@digests,@@dal_structure1,@@dal_structure2,@@sc_info=[],[],[],[],[] + @@ds={} + @@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[] def initialize(data='',md='') @data,@md=data,md SiSU_Env::SiSU_file.new(@md).mkdir @@ -101,7 +108,7 @@ module SiSU_Digest_view end def songsheet #source parser, based on dal creation - dal parser ... - @@description,@@digests,@@dal_structure1,@@dal_structure2,@@sc_info=[],[],[],[],[] + @@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[] message_digest dal_structure supplementary @@ -113,15 +120,15 @@ module SiSU_Digest_view end def digests(f,e='') puts f + e.to_s if @md.cmd =~/V/ - @@digests << f << e + @@ds[:digests] << f << e end - def dal_structure1(f,e='') + def dal_structure_tree(f,e='') puts f + e.to_s if @md.cmd =~/V/ - @@dal_structure1 << f << e + @@ds[:tree] << f << e end - def dal_structure2(f,e='') + def dal_structure_summary(f,e='') puts f + e.to_s if @md.cmd =~/V/ - @@dal_structure2 << f << e + @@ds[:summary] << f << e end def rcinfo(f,e='') puts f + e.to_s if @md.cmd =~/V/ @@ -129,7 +136,7 @@ module SiSU_Digest_view end def output filename_digest=SiSU_Env::SiSU_file.new(@md,@md.fn[:digest]).mkfile - filename_digest << @@description << @@digests << @@dal_structure1 << @@dal_structure2 << @@sc_info + filename_digest << @@description << @@ds[:digests] << @@ds[:tree] << @@ds[:summary] << @@sc_info end def rgx_txt(txt) txt=txt.gsub(/([()])/,"\\\\\\1") @@ -292,8 +299,8 @@ module SiSU_Digest_view #there will be a docubook mapping header, fairly complex variations data=@data l=Hash.new(0) - dal_structure1("------------\n") - dal_structure1("document structure[*]\n") + dal_structure_tree("------------\n") + dal_structure_tree("document structure[*]\n") ocn,endnotes=nil,nil data.each do |para| x=case para @@ -320,11 +327,11 @@ module SiSU_Digest_view if para =~/~[{\[]([\d*+]+).+?<[0-9a-f]{#@dl}>[}\]]~/ endnotes=$1 unless $1.to_i == 0 end - dal_structure1("#{x}\n") if x and not x.empty? + dal_structure_tree("#{x}\n") if x and not x.empty? end - dal_structure1(" [*] heading levels\n") - dal_structure2("------------\n") - dal_structure2("document structure[*]\n") + dal_structure_tree(" [*] heading levels\n") + dal_structure_summary("------------\n") + dal_structure_summary("document structure[*]\n") [0,1,2,3,4,5,6].each do |y| v=case y.to_s when /0/; '@ ' @@ -335,11 +342,11 @@ module SiSU_Digest_view when /5/; '2 ' when /6/; '3 ' end - dal_structure2("#{v} = #{l[y]}\n") if l[y] > 0 + dal_structure_summary("#{v} = #{l[y]}\n") if l[y] > 0 end - dal_structure2("objects (ocn) = #{ocn}\n") - dal_structure2("endnotes = #{endnotes}\n") - dal_structure2(" [*] number of headers (@) and of each heading level (:A to :C and 1 to 3)\n") + dal_structure_summary("objects (ocn) = #{ocn}\n") + dal_structure_summary("endnotes = #{endnotes}\n") + dal_structure_summary(" [*] number of headers (@) and of each heading level (:A to :C and 1 to 3)\n") end def supplementary if defined? @md.sc_number and @md.sc_number |