# encoding: 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, 2009, 2010, 2011, 2012 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_relative 'sysenv' # sysenv.rb
include SiSU_Screen
require_relative 'param' # param.rb
class Help
require_relative 'i18n' # i18n.rb
def initialize(request='',color='')
@request,@color=request,color
@cX=(color =~/color_off/) \
? (SiSU_Screen::Ansi.new('k').cX)
: (SiSU_Screen::Ansi.new('yes').cX)
fns='help_example_dummy_file_name.sst'
@env=SiSU_Env::InfoEnv.new(fns)
@db=SiSU_Env::InfoDb.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(?:_v1|_v2)?|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|epub|odf|odt|opendocument|css|pdf|latex|tex|(?:tex)?info|search|(?:hyper)?est(?:raier)?|searchform|cgi|sql|db|pg|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, termsheet, search, sql, features, 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_v2
when /example_v1/; @help.example_v1
when /example(_v2)?/; @help.example_v2
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|(?:--)?te?xt|-[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 /(?:--)?epub|-e/; @help.epub
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|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 example_v1
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__