aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--data/doc/sisu/CHANGELOG_v34
-rw-r--r--lib/sisu/v3/epub_format.rb430
-rw-r--r--lib/sisu/v3/epub_segments.rb28
3 files changed, 442 insertions, 20 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 29f166dd..98a6380d 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, html, xhtml, xml sax, xml dom;
- not done: epub, pdf, odf, man, info
+ * done: dal, plaintext, css, html, epub, xhtml, xml sax, xml dom;
+ not done: 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/epub_format.rb b/lib/sisu/v3/epub_format.rb
index 6879c933..2a9af20e 100644
--- a/lib/sisu/v3/epub_format.rb
+++ b/lib/sisu/v3/epub_format.rb
@@ -161,6 +161,7 @@ module SiSU_EPUB_Format
margin-right: 2em;
margin-top: 10px;
margin-bottom: 0px;
+ padding-left: 0em;
text-indent: 0mm;
}
p, h0, h1, h2, h3, h4, h5, h6 {
@@ -177,15 +178,426 @@ module SiSU_EPUB_Format
margin-bottom: 3px;
}
p.norm { }
- p.i1 {margin-left: 1em;}
- p.i2 {margin-left: 2em;}
- p.i3 {margin-left: 3em;}
- p.i4 {margin-left: 4em;}
- p.i5 {margin-left: 5em;}
- p.i6 {margin-left: 6em;}
- p.i7 {margin-left: 7em;}
- p.i8 {margin-left: 8em;}
- p.i9 {margin-left: 9em;}
+ p.i1 {padding-left: 1em;}
+ p.i2 {padding-left: 2em;}
+ p.i3 {padding-left: 3em;}
+ p.i4 {padding-left: 4em;}
+ p.i5 {padding-left: 5em;}
+ p.i6 {padding-left: 6em;}
+ p.i7 {padding-left: 7em;}
+ p.i8 {padding-left: 8em;}
+ p.i9 {padding-left: 9em;}
+
+ p.h0i0 {
+ padding-left: 0em;
+ text-indent: 0em;
+ }
+ p.h0i1 {
+ padding-left: 1em;
+ text-indent: -1em;
+ }
+ p.h0i2 {
+ padding-left: 2em;
+ text-indent: -2em;
+ }
+ p.h0i3 {
+ padding-left: 3em;
+ text-indent: -3em;
+ }
+ p.h0i4 {
+ padding-left: 4em;
+ text-indent: -4em;
+ }
+ p.h0i5 {
+ padding-left: 5em;
+ text-indent: -5em;
+ }
+ p.h0i6 {
+ padding-left: 6em;
+ text-indent: -6em;
+ }
+ p.h0i7 {
+ padding-left: 7em;
+ text-indent: -7em;
+ }
+ p.h0i8 {
+ padding-left: 8em;
+ text-indent: -8em;
+ }
+ p.h0i9 {
+ padding-left: 9em;
+ text-indent: -9em;
+ }
+
+ p.h1i0 {
+ padding-left: 0em;
+ text-indent: 1em;
+ }
+ p.h1i1 {
+ padding-left: 1em;
+ text-indent: 0em;
+ }
+ p.h1i2 {
+ padding-left: 2em;
+ text-indent: -1em;
+ }
+ p.h1i3 {
+ padding-left: 3em;
+ text-indent: -2em;
+ }
+ p.h1i4 {
+ padding-left: 4em;
+ text-indent: -3em;
+ }
+ p.h1i5 {
+ padding-left: 5em;
+ text-indent: -4em;
+ }
+ p.h1i6 {
+ padding-left: 6em;
+ text-indent: -5em;
+ }
+ p.h1i7 {
+ padding-left: 7em;
+ text-indent: -6em;
+ }
+ p.h1i8 {
+ padding-left: 8em;
+ text-indent: -7em;
+ }
+ p.h1i9 {
+ padding-left: 9em;
+ text-indent: -8em;
+ }
+
+ p.h2i0 {
+ padding-left: 0em;
+ text-indent: 2em;
+ }
+ p.h2i1 {
+ padding-left: 1em;
+ text-indent: 1em;
+ }
+ p.h2i2 {
+ padding-left: 2em;
+ text-indent: 0em;
+ }
+ p.h2i3 {
+ padding-left: 3em;
+ text-indent: -1em;
+ }
+ p.h2i4 {
+ padding-left: 4em;
+ text-indent: -2em;
+ }
+ p.h2i5 {
+ padding-left: 5em;
+ text-indent: -3em;
+ }
+ p.h2i6 {
+ padding-left: 6em;
+ text-indent: -4em;
+ }
+ p.h2i7 {
+ padding-left: 7em;
+ text-indent: -5em;
+ }
+ p.h2i8 {
+ padding-left: 8em;
+ text-indent: -6em;
+ }
+ p.h2i9 {
+ padding-left: 9em;
+ text-indent: -7em;
+ }
+
+ p.h3i0 {
+ padding-left: 0em;
+ text-indent: 3em;
+ }
+ p.h3i1 {
+ padding-left: 1em;
+ text-indent: 2em;
+ }
+ p.h3i2 {
+ padding-left: 2em;
+ text-indent: 1em;
+ }
+ p.h3i3 {
+ padding-left: 3em;
+ text-indent: 0em;
+ }
+ p.h3i4 {
+ padding-left: 4em;
+ text-indent: -1em;
+ }
+ p.h3i5 {
+ padding-left: 5em;
+ text-indent: -2em;
+ }
+ p.h3i6 {
+ padding-left: 6em;
+ text-indent: -3em;
+ }
+ p.h3i7 {
+ padding-left: 7em;
+ text-indent: -4em;
+ }
+ p.h3i8 {
+ padding-left: 8em;
+ text-indent: -5em;
+ }
+ p.h3i9 {
+ padding-left: 9em;
+ text-indent: -6em;
+ }
+
+ p.h4i0 {
+ padding-left: 0em;
+ text-indent: 4em;
+ }
+ p.h4i1 {
+ padding-left: 1em;
+ text-indent: 3em;
+ }
+ p.h4i2 {
+ padding-left: 2em;
+ text-indent: 2em;
+ }
+ p.h4i3 {
+ padding-left: 3em;
+ text-indent: 1em;
+ }
+ p.h4i4 {
+ padding-left: 4em;
+ text-indent: 0em;
+ }
+ p.h4i5 {
+ padding-left: 5em;
+ text-indent: -1em;
+ }
+ p.h4i6 {
+ padding-left: 6em;
+ text-indent: -2em;
+ }
+ p.h4i7 {
+ padding-left: 7em;
+ text-indent: -3em;
+ }
+ p.h4i8 {
+ padding-left: 8em;
+ text-indent: -4em;
+ }
+ p.h4i9 {
+ padding-left: 9em;
+ text-indent: -5em;
+ }
+
+ p.h5i0 {
+ padding-left: 0em;
+ text-indent: 5em;
+ }
+ p.h5i1 {
+ padding-left: 1em;
+ text-indent: 4em;
+ }
+ p.h5i2 {
+ padding-left: 2em;
+ text-indent: 3em;
+ }
+ p.h5i3 {
+ padding-left: 3em;
+ text-indent: 2em;
+ }
+ p.h5i4 {
+ padding-left: 4em;
+ text-indent: 1em;
+ }
+ p.h5i5 {
+ padding-left: 5em;
+ text-indent: 0em;
+ }
+ p.h5i6 {
+ padding-left: 6em;
+ text-indent: -1em;
+ }
+ p.h5i7 {
+ padding-left: 7em;
+ text-indent: -2em;
+ }
+ p.h5i8 {
+ padding-left: 8em;
+ text-indent: -3em;
+ }
+ p.h5i9 {
+ padding-left: 9em;
+ text-indent: -4em;
+ }
+
+ p.h6i0 {
+ padding-left: 0em;
+ text-indent: 6em;
+ }
+ p.h6i1 {
+ padding-left: 1em;
+ text-indent: 5em;
+ }
+ p.h6i2 {
+ padding-left: 2em;
+ text-indent: 4em;
+ }
+ p.h6i3 {
+ padding-left: 3em;
+ text-indent: 3em;
+ }
+ p.h6i4 {
+ padding-left: 4em;
+ text-indent: 2em;
+ }
+ p.h6i5 {
+ padding-left: 5em;
+ text-indent: 1em;
+ }
+ p.h6i6 {
+ padding-left: 6em;
+ text-indent: 0em;
+ }
+ p.h6i7 {
+ padding-left: 7em;
+ text-indent: -1em;
+ }
+ p.h6i8 {
+ padding-left: 8em;
+ text-indent: -2em;
+ }
+ p.h6i9 {
+ padding-left: 9em;
+ text-indent: -3em;
+ }
+
+ p.h7i0 {
+ padding-left: 0em;
+ text-indent: 7em;
+ }
+ p.h7i1 {
+ padding-left: 1em;
+ text-indent: 6em;
+ }
+ p.h7i2 {
+ padding-left: 2em;
+ text-indent: 5em;
+ }
+ p.h7i3 {
+ padding-left: 3em;
+ text-indent: 4em;
+ }
+ p.h7i4 {
+ padding-left: 4em;
+ text-indent: 3em;
+ }
+ p.h7i5 {
+ padding-left: 5em;
+ text-indent: 2em;
+ }
+ p.h7i6 {
+ padding-left: 6em;
+ text-indent: 1em;
+ }
+ p.h7i7 {
+ padding-left: 7em;
+ text-indent: 0em;
+ }
+ p.h7i8 {
+ padding-left: 8em;
+ text-indent: -1em;
+ }
+ p.h7i9 {
+ padding-left: 9em;
+ text-indent: -2em;
+ }
+
+ p.h8i0 {
+ padding-left: 0em;
+ text-indent: 8em;
+ }
+ p.h8i1 {
+ padding-left: 1em;
+ text-indent: 7em;
+ }
+ p.h8i2 {
+ padding-left: 2em;
+ text-indent: 6em;
+ }
+ p.h8i3 {
+ padding-left: 3em;
+ text-indent: 5em;
+ }
+ p.h8i4 {
+ padding-left: 4em;
+ text-indent: 4em;
+ }
+ p.h8i5 {
+ padding-left: 5em;
+ text-indent: 3em;
+ }
+ p.h8i6 {
+ padding-left: 6em;
+ text-indent: 2em;
+ }
+ p.h8i7 {
+ padding-left: 7em;
+ text-indent: 1em;
+ }
+ p.h8i8 {
+ padding-left: 8em;
+ text-indent: 0em;
+ }
+ p.h8i9 {
+ padding-left: 9em;
+ text-indent: -1em;
+ }
+
+ p.h9i0 {
+ padding-left: 0em;
+ text-indent: 9em;
+ }
+ p.h9i1 {
+ padding-left: 1em;
+ text-indent: 8em;
+ }
+ p.h9i2 {
+ padding-left: 2em;
+ text-indent: 7em;
+ }
+ p.h9i3 {
+ padding-left: 3em;
+ text-indent: 6em;
+ }
+ p.h9i4 {
+ padding-left: 4em;
+ text-indent: 5em;
+ }
+ p.h9i5 {
+ padding-left: 5em;
+ text-indent: 4em;
+ }
+ p.h9i6 {
+ padding-left: 6em;
+ text-indent: 3em;
+ }
+ p.h9i7 {
+ padding-left: 7em;
+ text-indent: 2em;
+ }
+ p.h9i8 {
+ padding-left: 8em;
+ text-indent: 1em;
+ }
+ p.h9i9 {
+ padding-left: 9em;
+ text-indent: 0em;
+ }
+
p.it0 {
margin-left: 0em;
diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb
index 7bddf917..b9b75b9c 100644
--- a/lib/sisu/v3/epub_segments.rb
+++ b/lib/sisu/v3/epub_segments.rb
@@ -360,8 +360,11 @@ WOK
@p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,dob.ocn)
end
sto=SiSU_EPUB_Format::Format_text_object.new(@md,dob)
- dob_xhtml=if dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para'
- dob_xhtml=if dob.is=='heading' or dob.is=='heading_insert'
+ dob_xhtml=if dob.is=='heading' \
+ or dob.is=='heading_insert' \
+ or dob.is=='para'
+ dob_xhtml=if dob.is=='heading' \
+ or dob.is=='heading_insert'
if dob.ln==4
sto.seg_heading4 # work on see Split_text_object
elsif dob.ln==5
@@ -369,16 +372,23 @@ WOK
elsif dob.ln==6; sto.seg_heading6
end
elsif dob.is=='para'
- if dob.indent and dob.indent =~/[1-9]/
+ if dob.indent \
+ and dob.hang \
+ and dob.indent =~/[0-9]/ \
+ and dob.hang =~/[0-9]/
if dob.bullet_
- sto.format('li',"i#{dob.indent}")
- else sto.format('p',"i#{dob.indent}")
- end
- else
- if dob.bullet_
- sto.format('li','bullet')
+ if dob.indent =~/[1-9]/
+ sto.format('li',"i#{dob.indent}")
+ else
+ sto.format('li','bullet')
+ end
+ elsif dob.indent == dob.hang
+ sto.format('p',"i#{dob.indent}")
+ elsif dob.indent != dob.hang
+ sto.format('p',"h#{dob.hang}i#{dob.indent}")
else sto.para
end
+ else sto.para
end
end
elsif dob.is =~/^(?:block|group|alt)$/