From 1abd2f99b807f9f33d1bd39c0a692e1455bf44f1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:26:52 -0400 Subject: v3: xhtml, xml sax & dom, indent (partially implemented) ... --- data/doc/sisu/CHANGELOG_v3 | 4 ++-- lib/sisu/v3/xhtml.rb | 7 ++++++- lib/sisu/v3/xml.rb | 7 ++++++- lib/sisu/v3/xml_dom.rb | 8 +++++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 3caf06c8..8d50ee88 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -26,8 +26,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.14.orig.tar.gz _[0-9]?_[1-9] initial indent; paragraph text indent - * done: dal, plaintext, css; - not done: html, xhtml, xml sax, xml dom, epub, pdf, odf, man, info + * done: dal, plaintext, css, xhtml, xml sax, xml dom; + not done: html, epub, pdf, odf, man, info check: po4a, html_lite (used in sql search results) * syntax highlighting done: vim (sisu.vim), emacs (sisu-mode.el) diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb index 03415280..569b1dc3 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v3/xhtml.rb @@ -321,8 +321,13 @@ WOK and dob.bullet_==true xml_structure(dob,"indent_bullet#{dob.indent}") elsif dob.is =='para' \ - and dob.indent.to_s =~/[1-9]/ + and dob.indent.to_s =~/[1-9]/ \ + and dob.indent == dob.hang xml_structure(dob,"indent#{dob.indent}") + elsif dob.is=='para' \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang + xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}") else xml_structure(dob) end end diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v3/xml.rb index f2751da1..73e9345c 100644 --- a/lib/sisu/v3/xml.rb +++ b/lib/sisu/v3/xml.rb @@ -346,8 +346,13 @@ WOK and dob.bullet_==true xml_structure(dob,"indent_bullet#{dob.indent}") elsif dob.is =~ /^para/ \ - and dob.indent.to_s =~/[1-9]/ + and dob.indent.to_s =~/[1-9]/ \ + and dob.indent == dob.hang xml_structure(dob,"indent#{dob.indent}") + elsif dob.is =~ /^para/ \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang + xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}") else xml_structure(dob) end end diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v3/xml_dom.rb index 7a0d55f3..664bccdc 100644 --- a/lib/sisu/v3/xml_dom.rb +++ b/lib/sisu/v3/xml_dom.rb @@ -412,9 +412,15 @@ WOK type="indent_bullet#{dob.indent.to_s}" xml_markup(dob) elsif dob.is=='para' \ - and dob.indent.to_s =~/[1-9]/ + and dob.indent.to_s =~/[1-9]/ \ + and dob.indent == dob.hang type="indent#{dob.indent.to_s}" xml_markup(dob) + elsif dob.is=='para' \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang + type="hang#{dob.hang.to_s}_indent#{dob.indent.to_s}" + xml_markup(dob) else type='norm' xml_markup(dob) -- cgit v1.2.3