# encoding: utf-8
=begin
* Name: SiSU
** Description: documents, structuring, processing, publishing, search
*** html formating, css template
** Author: Ralph Amissah
[ralph@amissah.com]
[ralph.amissah@gmail.com]
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 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 [http://www.gnu.org/licenses/].
If you have Internet connection, the latest version of the GPL should be
available at these locations:
[http://www.fsf.org/licensing/licenses/gpl.html]
[http://www.gnu.org/licenses/gpl.html]
** SiSU uses:
* Standard SiSU markup syntax,
* Standard SiSU meta-markup syntax, and the
* Standard SiSU object citation numbering and system
** Hompages:
[http://www.jus.uio.no/sisu]
[http://www.sisudoc.org]
** Git
[http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary]
[http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/html_format.rb;hb=HEAD]
=end
module SiSU_HTML_Format
require_relative 'html_parts' # html_parts.rb
class ParagraphNumber
def initialize(md,ocn)
@md,@ocn=md,ocn.to_s
@ocn ||=''
@make=SiSU_Env::ProcessingSettings.new(@md)
end
def ocn_display
if @make.build.ocn?
if @ocn.to_i==0 \
or @ocn.empty?
''
else
%{}
end
else
''
end
end
def name
if @make.build.html_strict? \
or @ocn==(nil || @ocn.empty?)
''
else
%{}
end
end
def id #w3c? "tidy" complains about numbers as identifiers ! annoying
(@ocn==nil || @ocn.empty?) \
? '' : %{id="#{Mx[:ocn_id_char]}#{@ocn}"}
end
def goto
(@ocn==nil || @ocn.empty?) \
? '' : %{}
end
end
class HeadInformation
require_relative 'css' # css.rb
include SiSU_Parts_HTML
require_relative 'xml_shared' # xml_shared.rb
attr_reader :md,:rdf
def initialize(md)
@md=md
# DublinCore 1 - title
@bits=SiSU_Proj_HTML::Bits.new
@per=SiSU_HTML_Persist::Persist.new
@per.seg_name_x=SiSU_HTML::Seg.new.seg_name_x
@per.seg_name_x_tracker=SiSU_HTML::Seg.new.seg_name_x_tracker
@tocband_scroll,@tocband_segtoc=nil,nil
@stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
@o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
@index,@metalink='index','#metadata'
@toc=@md.file.base_filename.html_segtoc
end
def url_path_image_sys
(@o_str.dump_or_redirect?) \
? './image'
: "#{Xx[:html_relative2]}_sisu/image_sys"
end
def icon
def up
'arrow_up_red.png'
end
def next
'arrow_next_red.png'
end
def previous
'arrow_prev_red.png'
end
def dot_clear
'dot_clear.png'
end
def dot_white
'dot_white.png'
end
def dot
dot_white
end
self
end
def png_nav
def toc
%{}
end
def pre
%{}
end
def nxt
%{}
end
def dot_toc
%{}
end
def dot_pre
%{}
end
def dot_nxt
%{}
end
self
end
def doc_types(page=:seg) #used in toc & seg_nav_band
wgt=SiSU_HTML_Format::Widget.new(@md)
%{
#{wgt.manifest(page)}
#{wgt.search}
|
}
end
def rdf
SiSU_XML_Tags::RDF.new(md)
end
def button_home(page=:seg)
button=%{ \n \n}
if @md.make.home_button_image.is_a?(Hash)
image_path=if page==:manifest
@md.file.output_path.manifest.rel_image
elsif page==:scroll
@md.file.output_path.html_scroll.rel_image
else
@md.file.output_path.html_seg.rel_image
end
SiSU_Env::FileOp.new(@md)
button +=%{ \n}
elsif @md.home_button_links.is_a?(Array)
@md.home_button_links.each do |links|
button +=%{ \n #{links[:say]}\n \n}
end
end
button +=%{ |
\n
}
button
end
def html_close #moved
%{