From 7372f56054259457f77c64cbdb34e736531cfc0e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 4 Jul 2009 11:57:29 -0400 Subject: move lib to version 1 directory, (lib/sisu/v1) and make related changes --- lib/sisu/v1/help.rb | 2036 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2036 insertions(+) create mode 100644 lib/sisu/v1/help.rb (limited to 'lib/sisu/v1/help.rb') diff --git a/lib/sisu/v1/help.rb b/lib/sisu/v1/help.rb new file mode 100644 index 00000000..cd5eaf25 --- /dev/null +++ b/lib/sisu/v1/help.rb @@ -0,0 +1,2036 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 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: interactive infomation/help + +=end +module SiSU_Help + require "#{SiSU_lib}/sysenv" + require "#{SiSU_lib}/param" + include SiSU_Screen + class Help + def initialize(request='',color='') + @request,@color=request,color + if color =~/color_off/; @cX=SiSU_Screen::Ansi.new('k').cX + else @cX=SiSU_Screen::Ansi.new('yes').cX + end + fns='help_example_dummy_file_name.sst' + @env=SiSU_Env::Info_env.new(fns) + @db=SiSU_Env::Info_db.new + m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m + @output_stub=Dir.pwd[m,1] + end + def help_request + begin + gotten=nil + regx=/^(list|com(?:mands)?|mod(?:ifiers)|markup|syntax|example(?:37|38)?|head(?:ers?)?|(?:heading|title|level|structure)s?|endnotes|footnotes|tables?|customise|skin|dir(?:ectories)?|paths?|lang(?:uage)?|modules|setup|conf(?:ig(?:ure)?)?|standards?|li[cs]en[sc]e|scratch|install|termsheet|dublin(?:core)?|dc|customise|styles?|appearance|theme|env(ironment)?|dir(?:ector(?:y|ies))?|metaverse|abstract|features|summary|(?:short)?cuts?|sisu|about|ext(?:ernal)?(?:_?prog(?:rams)?)?)|utf-?8|plaintext|html|xml|xhtml|odf|odt|opendocument|css|pdf|latex|tex|(?:tex)?info|search|(?:hyper)?est(?:raier)?|searchform|cgi|sql|db|postgresql|pg?sql|sqlite|convert|php|webrick|sitemaps?|ya?ml|ansi|colors|-[AabcDdEeFHhIMmNnopqrRSstUuVvwXxyZz0-9]|-[Ddcv]|-[CcFLSVvW]/ + help_info=%{#{@cX.blue_hi}SiSU help#{@cX.off} #{@cX.ruby}~#{@cX.off} #{@request}} + help_list=%{#{@cX.blue}sisu --help#{@cX.off} #{@cX.cyan}type keyword else "enter" to exit help:\n\tkeywords include:#{@cX.off} #{@cX.brown}list, (com)mands, short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers, headings, endnotes, tables, example, customise, skin, (dir)ectories, path, (lang)uage, db, install, setup, (conf)igure, convert, external_programs, dublincore, termsheet, search, sql, hyper(est)raier, features, external_programs, license#{@cX.off} \n} + help_prompt=%{#{@cX.fuschia}exit, [or carriage return to exit help] #{@cX.off}\n#{@cX.blue_hi}SiSU help#{@cX.off} #{@cX.ruby}~#{@cX.off} } + until gotten =~/exit|quit|bye|q|^\s*$/ \ + and ( @request.nil? or @request.empty? ) + @help=Help.new(@request,@color) + if @request + puts help_info + gotten=@request + @request=nil + end + case gotten + when /h((?:elp)| )|~/i + @help.summary + help_@request + when /list/; @help.summary + when /com(mands)?/; @help.commands + when /mod(ifiers)?/; @help.modifiers + when /markup|syntax/; @help.markup + when /example\b/; @help.example + when /example37/; @help.example37 + when /example38/; @help.example38 + when /(?:heading|title|level)s?|structure/; @help.headings + when /head(ers?)?/; @help.headers + when /dublin(core)?|dc/; @help.dublin_core + when /(?:foot|end)notes/; @help.endnotes + when /tables?/; @help.tables + when /customise|skin/; @help.customise + when /modules/; @help.modules + when /env(ironment)?/; @help.environment + when /dir(ector(y|ies))?/; @help.directories + when /paths?/; @help.path + when /setup/; @help.setup + when /conf(?:ig(?:ure)?)?/; @help.configure + when /standards?/; @help.standards + when /lang(?:uage)?/; @help.languages + when /li[cs]en[sc]e/; @help.license + when /scratch/; @help.scratch + when /install/; @help.install + when /termsheet/; @help.termsheet + when /customise|styles?|appearance|theme/; @help.customise + when /metaverse/; @help.dal + when /plaintext|ascii|-[aAeE]/; @help.plaintext + when /utf-?8/i; @help.utf8 + when /html|-[hH]/; @help.html + when /css/; @help.css + when /xhtml|-b/; @help.xhtml + when /xml|-[xX]/; @help.xml + when /odf|odt|opendocument|-o/; @help.odf + when /php/; @help.php + when /pdf|-p/; @help.pdf + when /latex|tex/; @help.latex + when /(tex)?info/; @help.texinfo + when /lout/; @help.lout + when /concordance|index|-w/; @help.concordance + when /search\b/; @help.help_search + when /(?:hyper)?est(?:raier)?/; @help.hyperestraier + when /db|database|sql|postgresql|sqlite|pg?sql|-[dD]/; @help.sql + when /searchform|cgi/; @help.cgi + when /convert/; @help.convert + when /webrick|-W/; @help.webrick + when /abstract|features|summary|about|sisu/; @help.abstract + when /ext(?:ernal)?(?:_?prog(?:rams)?)?/; @help.external_programs + when /ya?ml/; @help.yaml + when /sitemaps?/; @help.sitemap + when /(?:short)?cuts?/; @help.shortcuts + when /ansi|colors?/; SiSU_Screen::Ansi.new('c').colors + else @help.summary + end + print help_list + print help_prompt + gotten=nil + gotten=gets + end + rescue + #STDERR.puts Ansi.new($!, $@).rescue + # dies silently... for now, silence of use in connection with "sisu ~ commands" etc. + ensure + end + end + def summary + print < + ------------------------------------------ + #{@cX.green}~##{@cX.off} unnumbered paragraph (place marker at end of paragraph) + #{@cX.green}-##{@cX.off} unnumbered paragraph, delete when not required (place marker at end of paragraph) [used in dummy headings, eg. for segmented html] + ------------------------------------------ + manual page breaks (LaTeX/pdf) + #{@cX.green}<:pb>#{@cX.off} page break, which breaks a page, starting a new page in single column text and a new column in double column text + #{@cX.green}<:pn>#{@cX.off} page new, which starts a new page, in both single and double column text (leaving an empty column in double column text if necessary). + Note: page breaks are usually introduced to pdfs either as header instructions, indicating that pages should break at given levels + ------------------------------------------ + #{@cX.cyan}Composite documents#{@cX.off} + It is possible to build a document by creating a master document that requires other documents. The documents required may complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built mainly from other documents), it should be named with the suffix #{@cX.blue}.ssm#{@cX.off} Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document #{@cX.blue}.sst#{@cX.off} regular markup file, or #{@cX.blue}.ssi#{@cX.off} (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix #{@cX.blue}.ssm.sst#{@cX.off} + + #{@cX.cyan}#basic sisu markup alternatives#{@cX.off} + #{@cX.green}{#{@cX.off}filename.ssi#{@cX.green}}require#{@cX.off} + #{@cX.green}<< {#{@cX.off}filename.ssi#{@cX.green}}#{@cX.off} + + #{@cX.cyan}#using textlink alternatives#{@cX.off} + #{@cX.green}|#{@cX.off}filename.ssi#{@cX.green}|@|^|require#{@cX.off} + #{@cX.green}<< |#{@cX.off}filename.ssi#{@cX.green}|@|^|#{@cX.off} + + #{@cX.cyan}#using thlnk alternatives#{@cX.off} + #{@cX.green}require#{@cX.off} + #{@cX.green}<< #{@cX.off} + + #{@cX.cyan}Composite documents - remote parts#{@cX.off} + Composite documents may be built from remote parts, by using the composite document syntax with a url. This makes sense using either sisu regular syntax (which is just a convenient way of marking up), or thlnk syntax, which also recognises remote urls, and permits hyperlinking ascii to the url location. + + #{@cX.cyan}Remote documents#{@cX.off} + SiSU will download and process remote locations if a url is provided instead of a filename. [this at present works only for sisu markup files without images] + + ------------------------------------------ + #{@cX.green}%#{@cX.off}#{@cX.off} add a comment to text, that will be removed prior to processing (place marker at beginning of line) + #{@cX.green}\\#{@cX.off}#{@cX.off} escape a sepcial character, whether general: { } < > or contextual special characters, (in combination with other characters) ~ - _ / % ^ and occasionally ! # + , + #{@cX.green}%%#{@cX.off}#{@cX.off} same as above but recognised by vim folds for placing fold in document text, in addition to headers and headings + ------------------------------------------ + + #{@cX.ruby}More HELP on Markup#{@cX.off} markup help is available on: + document wide instructions: headers (document structure) + general text markup: headings; endnotes; tables (which also includes a note on preformatted text) + configuration and customisation + document or site wide customisation: customise; skin +WOK + help_markup +# {../_sisu/image/tux.png http://www.jus.uio.no/sisu/ w=64 c=\"a better way\" }:image depreciated image eg +# old form + end + def example + help_markup + end + def example37 + print <. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <#{@cX.blue}http://www.fsf.org/licenses/gpl.html#{@cX.off}> + <#{@cX.blue}http://www.gnu.org/licenses/gpl.html#{@cX.off}> + <#{@cX.blue}http://www.jus.uio.no/sisu/gpl.fsf#{@cX.off}> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <#{@cX.blue}http://www.jus.uio.no/sisu#{@cX.off}> + <#{@cX.blue}http://www.sisudoc.org#{@cX.off}> + + * Download: + <#{@cX.blue}http://www.jus.uio.no/sisu/SiSU/download.html#{@cX.off}> + + Ralph Amissah + <#{@cX.blue}ralph@amissah.com#{@cX.off}> + <#{@cX.blue}ralph.amissah@gmail.com#{@cX.off}> + +WOK + end + def standards + print <to bold to indent for superscript for subscript text + +_1 at the beginning of a line indents the paragraph + +_2 at the beginning of a line double indents the paragraph + +Others include + +Other things to note: + +By default paragraphs are automatically numbered... and is the same across all output formats +This makes citation a lot easier... regardless of the form of output that is being looked at +It also permits the building of various addons, like the concordance feature which identifies each word and the paragraphs in which the word appears with links to the paragraph... + +Urls are automatically turned to live links in the html and pdf files created... +WOK + end + end +end +__END__ + -- cgit v1.2.3