# 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, 2013 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:
* Git
* Ralph Amissah
** Description: Default values
=end
$latex_run=nil
module SiSU_Viz
require 'uri'
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
require_relative 'css' # css.rb
include SiSU_Style
class Defaults
def initialize
@fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman'
@dir=SiSU_Env::InfoEnv.new
@date=SiSU_Env::InfoDate.new #{@date.year}
@v=SiSU_Env::InfoVersion.instance.get_version
end
#% glyph
def glyph_bullet # •
' ' # [ flagged]
end
#% html
def html_hardspace
' '
end
def semantic_tags
def default
{
pub: 'publication',
conv: 'convention',
vol: 'volume',
pg: 'page',
cty: 'city',
org: 'organization',
uni: 'university',
dept: 'department',
fac: 'faculty',
inst: 'institute',
co: 'company',
com: 'company',
conv: 'convention',
dt: 'date',
y: 'year',
m: 'month',
d: 'day',
ti: 'title',
au: 'author',
ed: 'editor', #editor?
v: 'version', #edition
n: 'name',
fn: 'firstname',
mn: 'middlename',
ln: 'lastname',
in: 'initials',
qt: 'quote',
ct: 'cite',
ref: 'reference',
ab: 'abreviation',
def: 'define',
desc: 'description',
trans: 'translate',
}
end
self
end
#% decorate
def decorate_italics
'title|article|book|journal'
end
def decorate_bold
end
def decorate_uppercase
'surname'
end
#% semantic
def sem_title #dc 1
'title'
end
def sem_article
'article'
end
def sem_book
'book'
end
def sem_journal
'journal'
end
def sem_fullname # (contains: firstname, surname) #issues arise as contains surname etc.
'fullname'
end
def sem_first
'first'
end
def sem_surname
'surname'
end
def sem_middle
'middle'
end
def sem_creator #dc 2 #==fullname (contains: firstname, surname)
'creator'
end
def sem_author #==fullname (contains: firstname, surname)
'author'
end
def sem_editor #==fullname (contains: firstname, surname)
'editor'
end
def sem_illustrator #==fullname (contains: firstname, surname)
'illustrator'
end
def sem_translator #==fullname (contains: firstname, surname)
'translator'
end
def sem_isbn # 10 or 13
'isbn'
end
def sem_isbn_10
'isbn10'
end
def sem_isbn_13
'isbn13'
end
def sem_loc # library of congress
'loc'
end
def sem_dewey
'dewey'
end
def sem_pg # project gutenberg number
'pg'
end
def sem_subject #dc 3
'subject'
end
def sem_date #dc 7
'date'
end
def sem_date_created
'date_created'
end
def sem_date_issued
'date_issued'
end
def sem_date_available
'date_available'
end
def sem_date_valid
'date_valid'
end
def sem_date_modified
'date_modified'
end
def sem_type #dc 8
'type'
end
def sem_description #dc 4
'description'
end
def sem_publisher #dc 5
'publisher'
end
def sem_contributor #dc 6
'contributor'
end
def sem_format #dc 9
'format'
end
def sem_identifier #dc 10
'identifier'
end
def sem_source #dc 11
'source'
end
def sem_language #dc 12
'language'
end
def sem_relation #dc 13
'source'
end
def sem_coverage #dc 14
'coverage'
end
def sem_rights #dc 15
'rights'
end
def sem_copyright
'copyright'
end
def sem_license
'license'
end
def sem_prepared_by
'prepared_by'
end
def sem_digitized_by
'digitized_by'
end
def sem_keywords
'keywords'
end
def sem_comments
'comments'
end
def sem_abstract
'abstract'
end
#% path
def path_stylesheet_home
%{ }
end
#% text #changed from txt to avoid naming conflicts #FOLLOW
def txt_generator
%{
}
end
def txt_generator_comment
%{ }
end
def txt_hp
' SiSU'
end
def txt_hp_alias
'SiSU'
end
def txt_home
'SiSU'
end
def txt_signature # used in latex/pdf footer
'SiSU'
end
#% url
def url_urify(uri)
URI.parse(uri)
end
def url_sisu
'http://www.sisudoc.org/'
end
def url_sisudoc
'http://www.sisudoc.org'
end
def url_footer_signature
'http://www.sisudoc.org/'
end
def url_root
'/sisu' #watch
end
def url_root_http
'http://www.sisudoc.org/' #watch
end
def url_home
'http://www.sisudoc.org/' # used in pdf header
end
def url_site #used as stub... where there are subdirectories and is different from home
url_home
#'http://www.sisudoc.org/' # used in pdf header
end
def url_txt
'www.sisudoc.org/'
end
def url_path_image_base #used for html image display
"#{Xx[:html_relative2]}_sisu/image"
end
def url_path_image #used for html image display
"#{Xx[:html_relative2]}_sisu/image"
end
def url_path_image_sys #used for html image display
"#{Xx[:html_relative2]}_sisu/image_sys"
end
def url_decoration
def tex_open #'{\UseTextSymbol{OML}{<}}'
Dx[:url_o]
end
def tex_close #'{\UseTextSymbol{OML}{>}}'
Dx[:url_c]
end
def xml_open #'<'
Dx[:url_o]
end
def xml_close #'>'
Dx[:url_c]
end
def txt_open
'<'
end
def txt_close
'>'
end
self
end
def rel_decoration
def tex_open #'{\UseTextSymbol{OML}{<}}'
Dx[:rel_o]
end
def tex_close #'{\UseTextSymbol{OML}{>}}'
Dx[:rel_c]
end
def xml_open #'<'
Dx[:rel_o]
end
def xml_close #'>'
Dx[:rel_c]
end
def txt_open
'<'
end
def txt_close
'>'
end
self
end
#% color
def color_body
%{}
end
def color_white
'"#ffffff"'
end
def color_black
'#000000'
end
def color_blue_ink
'#003399'
end
def color_blue_tinge
'#e3ecef'
end
def color_blue_grey
'#8faebf'
end
def color_blue_murky
'#437389'
end
def color_beige
'#f1e8de'
end
def color_subtleglow
'#dddccc'
end
def color_glow
'#fff0c3'
end
def color_rose
'#ffdec9'
end
def color_turquoise
'#1c869b'
end
def color_grey_pale
'#eeeeee'
end
def color_grey_medium
'#cccccc'
end
def color_grey
'#999999'
end
def color_yellow_light
'#fff3b6'
end
def color_yellow
'#ffde14'
end
def color_yellow_dark
'#ffcc00'
end
def color_green_light
'#b7d398' # #e2efd5 #b7d398 #b1c999 # '#aed19e'
end
def color_green
'#0a8400'
end
def color_green_dark
'#086800'
end
def color_ruby
'#a00000'
end
def color_maroon
'#800000'
end
def color_paper
%{"#{color_white}"}
end
def color_band1
%{"#{color_white}"}
end
def color_band2
%{"#{color_white}"}
end
def color_body
%{}
end
def color_font_face #was font WATCH
"#{color_black}"
end
def color_surround
%{"#{color_white}"}
end
def color_band
%{"#{color_white}"}
end
def color_table1
'ffffcc'
end
def color_table2
'c0d0f0'
end
def color_band1
'"#ffffff"'
end
def color_band2
'"#ffffff"'
end
#% icon
def icon_ico
'rb7.ico'
end
def icon_sisu
'sisu.png'
end
def icon_manifest
'b_info.png'
end
def icon_doc
'b_doc.png'
end
def icon_toc
'b_toc.png'
end
def icon_wmp
'b_wmp.png'
end
def icon_odf
'b_odf.png'
end
def icon_epub
'b_epub.png'
end
def icon_pdf
'b_pdf.png'
end
def icon_pdf_portrait
'b_pdf.png'
end
def icon_pdf_landscape
'b_pdf.png'
end
def icon_choice
'b_choice.png'
end
def icon_new
'b_new.png'
end
def icon_dot_clear
'dot_clear.png'
end
def icon_dot_white
'dot_white.png'
end
def icon_dot
icon_dot_white
end
def icon_home_button
'sisu.png'
end
def icon_next
'arrow_next_red.png'
end
def icon_previous
'arrow_prev_red.png'
end
def icon_up
'arrow_up_red.png'
end
#% font
def font_fonts
@fonts
end
def font_face
%{face="#{font_fonts}"}
end
def font_color
'color="#000000"'
end
def font_size_endnote
'size="3"'
end
def font_small
'size="3"'
end
def font_tiny
'size="2"'
end
#% markup
def markup_italics_list #regular expression of words to be italised
end
def markup_bold_list #regular expression of words to be made bold
'SiSU'
end
def markup_make_italic
if defined? italics_list \
and italics_list
make={}
if italics_list
r=italics_list.dup
x=case r
when /\/i$/; 'i'
else ''
end
r=r.gsub(/^\/(.+?)\/i?/,'\1').
gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
m='\b(' + r + ')\b'
make[:str]
make[:regx]=(x =~/i/) \
? (/#{m}/i)
: (/#{m}/)
else nil
end
end
end
def markup_make_bold
if defined? bold_list \
and not bold_list.empty?
make={}
if bold_list
r=bold_list.dup
x=case r
when /\/i$/; 'i'
else ''
end
r.gsub(/^\/(.+?)\/i?/,'\1').
gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
m='\b(' + r + ')\b'
make[:str]
make[:regx]=(x =~/i/) \
? (/#{m}/i)
: (/#{m}/)
else nil
end
make
end
end
#% paragraph
def paragraph_txt
%{
}
end
def paragraph_endnote
%{
}
end
def paragraph_font_tiny
%{}
end
def paragraph_font_small
%{}
end
#% table
def table_close
'
'
end
def table_width_1
'"100%"'
end
def table_width_2
'"99%"'
end
def table_width_txt
'"94%"'
end
def table_width_txt_r
'"96%"'
end
def table_cellpad_box
'"20"'
end
#% indent
def indent_level_0
'"1%"'
end
def indent_level_1
'"4%"'
end
def indent_level_2
'"6%"'
end
def indent_level_3
'"8%"'
end
def indent_level_4
'"10%"'
end
#% margin
def margin_num
'
'
end
def margin_numless
'
'
end
def margin_num_css
'
'
end
def margin_txt_w1
%{
}
end
def margin_txt_w2
%{
}
end
def margin_txt_0
%{
}
end
def margin_txt_1
%{
}
end
def margin_txt_2
%{
}
end
def margin_txt_3
%{
}
end
def margin_css
'
'
end
#% png
def png_ico
%{ }
end
def png_sisu #check url path
%{ }
end
def png_site
%{}
end
def png_nav
%{}
end
def png_manifest
%{}
end
def png_doc
%{}
end
def png_toc
%{}
end
def png_odf
%{}
end
def png_epub
%{}
end
def png_pdf
%{}
end
def png_pdf_portrait
%{}
end
def png_pdf_landscape
%{}
end
def png_home
#dir=SiSU_Env::InfoEnv.new #(@fns)
%{}
#%{}
end
def png_home_button
rel=@dir.path_rel_links.html_scroll_2
%{}
end
#% png_nav #not currently used
#% nav_txt
def nav_txt_homepage
%{
home
}
end
def nav_txt_toc_link
%{
toc
}
end
def nav_txt_doc_link
%{
scroll
}
end
def nav_txt_manifest
#{png_manifest} document manifest
%{
[ document manifest ]
}
end
def nav_txt_concordance
%{
A-Z
}
end
def nav_txt_pdf_portrait
%{
pdf
}
end
def nav_txt_pdf_landscape
%{
pdf
}
end
#% banner
def banner_home_button_only
%{
#{png_home_button}
}
end
def banner_band #yellow_dark now white
%{
#{table_close}}
end
def banner_instrument_cover_band_scr
'
'
end
def banner_instrument_cover_band_seg
'
'
end
#% widget
def widget_promo # Array used to build promo from list.yml and promo.yml
# ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby']
end
def widgets_open
<
WOK
end
def widget_sisu_text
<
Output generated by
#{@v[:project]}
#{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]})
WOK
end
def widget_sisu
<
}
''
end
end
class Home < Defaults
def initialize
@v=SiSU_Env::InfoVersion.instance.get_version
@dir=SiSU_Env::InfoEnv.new
@date=SiSU_Env::InfoDate.new #{@date.year}
end
def redirect
<SiSU
SiSU informtion provided at www.sisudoc.org/sisu/SiSU
If your browser supports redirection, you will be escorted there shortly.
WOK
end
def homepage
<SiSU information Structuring Universe - Structured information, Serialized Units - software for electronic texts, documents, books, digital libraries in plaintext, HTML, EPUB, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and for search
#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}.
w3 since October 3 1993.
WOK
end
def home_toc
' '
end
end
class Inserts
end
class TeX < Defaults
def initialize(papersize='')
@papersize=papersize
end
def a4
def portrait
def w
160
end
def h
228
end
def img_px
450
end
self
end
def landscape
def w
238
end
def h
160
end
def img_px
300
end
self
end
self
end
def letter
def portrait
def w
166
end
def h
212
end
def img_px
468
end
self
end
def landscape
def w
226
end
def h
166
end
def img_px
290
end
self
end
self
end
def legal
def portrait
def w
168
end
def h
286
end
def img_px
474
end
self
end
def landscape
def w
296
end
def h
166
end
def img_px
420
end
self
end
self
end
def b5
def portrait
def w
140
end
def h
204
end
def img_px
356
end
self
end
def landscape
def w
200
end
def h
130
end
def img_px
260
end
self
end
self
end
def a5
def portrait
def w
112
end
def h
162
end
def img_px
280
end
self
end
def landscape
def w
152
end
def h
100
end
def img_px
190
end
self
end
self
end
def dimensions
case @papersize
when /a4/; a4
when /letter/; letter
when /legal/; legal
when /b5/; b5
when /a5/; a5
else a4
end
end
end
end
__END__