# 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__