From 26767cc88c0548ad7978021796d0ccc4c9f7ffed Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 2 Jun 2007 11:27:06 +0100 Subject: 0.53.0, pre-build, see changelog, library naming changed for scm, placed under v0 (instead of 0.53) --- lib/sisu/v0/help.rb | 1906 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1906 insertions(+) create mode 100644 lib/sisu/v0/help.rb (limited to 'lib/sisu/v0/help.rb') diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb new file mode 100644 index 00000000..b2b0a3fe --- /dev/null +++ b/lib/sisu/v0/help.rb @@ -0,0 +1,1906 @@ +=begin + * Name: SiSU information Structuring Universe - Structured information, Serialized Units + * Author: Ralph Amissah + * http://www.jus.uio.no/sisu + * http://www.jus.uio.no/sisu/SiSU/download.html + + * Description: online help + + * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Ralph Amissah + + * License: GPL 2 or later + + Summary of GPL 2 + + 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 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 + + 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 + + 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 + + © Ralph Amissah 1997, current 2007. + All Rights Reserved. + + * Ralph Amissah: ralph@amissah.com + ralph.amissah@gmail.com +=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='dummy_file_ref.sst' + @env=SiSU_Env::Info_env.new(fns) + @db=SiSU_Env::Info_db.new + 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 requiring 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), by convention it should be named with the suffix .ssc or .ssm The documents called if complete documents would have the suffix .sst, [.ssf, or .ssd], and if markup snippets .ssi. A temporary file of the composite document is built prior to processing with the same prefix and the suffix ._sst There are a number of alternative syntaxes for requiring external documents in order to permit use of ascii hypertext linking available in the vim editor. They are as follows (place at start of line): + + #{@cX.cyan}#basic sisu markup alternatives#{@cX.off} + #{@cX.green}{#{@cX.off}filename.si#{@cX.green}}require#{@cX.off} + #{@cX.green}<< {#{@cX.off}filename.si#{@cX.green}}#{@cX.off} + + #{@cX.cyan}#using textlink alternatives#{@cX.off} + #{@cX.green}|#{@cX.off}filename.si#{@cX.green}|@|^|require#{@cX.off} + #{@cX.green}<< |#{@cX.off}filename.si#{@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 <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