From 798d710dea23806e428ec7636dad4c1d872166e3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Sep 2008 22:24:15 -0400 Subject: dal, several modules split into separate files --- lib/sisu/v0/dal_expand_insertions.rb | 155 +++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 lib/sisu/v0/dal_expand_insertions.rb (limited to 'lib/sisu/v0/dal_expand_insertions.rb') diff --git a/lib/sisu/v0/dal_expand_insertions.rb b/lib/sisu/v0/dal_expand_insertions.rb new file mode 100644 index 00000000..1ab0c03b --- /dev/null +++ b/lib/sisu/v0/dal_expand_insertions.rb @@ -0,0 +1,155 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + 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 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. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_insertions + class Insertions + def initialize(data) + @data=data + end + def expand_insertions? + data=@data + tuned_file,tuned_file_tmp=[],[] + data.each do |para| + if para !~/^%+\s/ \ + and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ + txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil + @u=SiSU_Env::Info_env.new.url + if defined? @u.remote + if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m + pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6 + elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/ + pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5 + end + manifest="#{pre}{#{txt} }#{@u.remote}/#{url_dir}/toc.html#{note}\n\n" + else + puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" + if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ + txt,cmd,url_dir,note=$1,$2,$3,$4 + manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n" + end + end + tuned_file_tmp << manifest + output_filetypes=output_filetypes_in_cmd(cmd,source) + output_filetypes[:gen].each do |o_f| + describe = case o_f + when /sisu_manifest.html/; '~^ document manifest' + when /toc.html/; ' html, segmented text' + when /doc.html/; ' html, scroll, document in one' + when /landscape.pdf/; ' pdf, landscape' + when /portrait.pdf/; ' pdf, portrait' + when /opendocument.odt/; ' odf:odt, open document text' + when /scroll.xhtml/; ' xhtml scroll' + when /sax.xml/; ' xml, sax' + when /dom.xml/; ' xml, dom' + when /plain.txt/; ' plain text utf-8' + #when /manpage.1/; ' man, 1' + when /wiki.txt/; ' wiki text' + when /concordance.html/; ' concordance' + when /digest.txt/; ' dcc, document content certificate (digests)' + else nil + end + if describe + tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry + if describe =~/^~\^ / + "#{Mx[:nbsp]*4} {#{describe} }#{@u.remote}/#{url_dir}/#{o_f} " + else + "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/#{url_dir}/#{o_f} " + end + else + if describe =~/^~\^ / + "#{Mx[:nbsp]*4} {#{describe} }../#{url_dir}/#{o_f} " + else "#{Mx[:nbsp]*4} { #{describe} }../#{url_dir}/#{o_f} " + end + end + end + end + output_filetypes[:src].each do |o_f| + describe=case o_f + when /#{source}\.zip/; ' markup source (zipped) pod' + when /#{source}/; ' markup source text' + else nil + end + if describe + tuned_file_tmp << if @u.remote + x=if describe =~/zip/ + "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_pod}/#{o_f} " + else "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_txt}/#{o_f} " + end + else + x=if describe =~/zip/ + "#{Mx[:nbsp]*4} { #{describe} }../pod/#{o_f} " + else "#{Mx[:nbsp]*4} { #{describe} }../zip/#{o_f} " + end + end + end + end + tuned_file << 'group{' << tuned_file_tmp.join("\n") << '}group' + #tuned_file << 'group{' << tuned_file_tmp.join("\n").strip << '}group' + tuned_file_tmp=[] + else tuned_file << para + end + end + tuned_file + end + end +end +__END__ + -- cgit v1.2.3