aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--data/doc/sisu/CHANGELOG_v62
-rw-r--r--lib/sisu/v6/texpdf.rb22
-rw-r--r--lib/sisu/v6/texpdf_format.rb122
-rw-r--r--sisu.org86
4 files changed, 162 insertions, 70 deletions
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 4ab122dd..792cb089 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -55,6 +55,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.5.orig.tar.xz
* use symbols to identify page orientation
* renaming related to fontface
+* texpdf, headings and table of contents
+
* added sisu.org emacs:evil:org mode notes related to sisu development
%% 6.0.4.orig.tar.xz (2014-02-14:06/5)
diff --git a/lib/sisu/v6/texpdf.rb b/lib/sisu/v6/texpdf.rb
index b3636154..5654e6df 100644
--- a/lib/sisu/v6/texpdf.rb
+++ b/lib/sisu/v6/texpdf.rb
@@ -594,20 +594,26 @@ module SiSU_TeX
case dob.is
when :heading
case dob.ln
- when 1..3
- tst.heading_major
+ when 0
+ tst.title_level_A
+ when 1
+ tst.section_heading_level_B
+ when 2
+ tst.section_heading_level_C
+ when 3
+ tst.section_heading_level_D
when 4
- tst.level4
+ tst.heading_level_1
when 5
- tst.level5
+ tst.heading_level_2
when 6
- tst.level6
+ tst.heading_level_3
else dob
end
when :heading_insert
br="\n\\\\\n"
if dob.name=='book_index'
- h=tst.heading_major
+ h=tst.section_heading_level_B
heading="\\clearpage\n" + h.tmp
idx_arr=[]
idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_raw(@md.opt).raw_idx
@@ -628,10 +634,10 @@ module SiSU_TeX
dob.tmp={ l: l, p: p }
elsif dob.ln==2 \
and dob.obj=~/Metadata\b/
- tst.heading_major
+ tst.section_heading_level_B
elsif dob.ln==4 \
and dob.obj=~/Metadata\b/
- h=tst.level4
+ h=tst.heading_level_1
metadata=SiSU_Metadata::TeX_Metadata.new(@md).metadata_tex
dob.tmp=h.tmp + ' ' + '\begin{scriptsize}' + metadata.join(br) + '\end{scriptsize}'
else dob.tmp='' # dob.tmp={ l: '', p: '' }
diff --git a/lib/sisu/v6/texpdf_format.rb b/lib/sisu/v6/texpdf_format.rb
index f7e18dc8..015a9934 100644
--- a/lib/sisu/v6/texpdf_format.rb
+++ b/lib/sisu/v6/texpdf_format.rb
@@ -219,95 +219,99 @@ module SiSU_TeX_Pdf
else ''
end
end
- def heading_major
+ def remove_footnotes(cont_ln)
+ cont_ln=if cont_ln =~/\\[Ff]ootnote/m
+ cont_ln.gsub(/\s*\\[Ff]ootnote\[\d+\]\{%\s+.+?\}\s*/m,' ').
+ gsub(/\s*\\[Ff]ootnote[A]\{[*+]+\d*\}\{%\S+.+?\}\s*/m,' ')
+ else cont_ln
+ end
+ end
+ def title_level_A
dob=@dob
- title=@md.title.full
dob.tmp=dob.tmp.strip if dob.tmp
dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2').
gsub(/#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
cont_ln=dob.tmp.dup
cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
gsub(@@tex_pattern_margin_number,'')
- clearp=(dob.lv =~/B/ && dob.obj =='Metadata') ? "\\clearpage\n" : ''
- if dob.tmp =~/\\[Ff]ootnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
- gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
- end
+ cont_ln=remove_footnotes(cont_ln)
+ titleset=''
dob.tmp=dob.tmp.gsub(/^(.*)\n?$/m,
- "#{clearp}\\part*{\\1}
-\\addcontentsline{toc}{section}{#{cont_ln}}
-\\markboth{#{title}}\n")
+ "#{titleset}\\part*{\\1}
+\\markboth{#{@md.title.full}}\n")
dob
end
- def level4
- dob=@dob
+ def section_heading_level(dob)
dob.tmp=dob.tmp.strip if dob.tmp
dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2').
gsub(/#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
cont_ln=dob.tmp.dup
cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
- gsub(@@tex_pattern_margin_number,'').
- gsub(/#{Tex[:backslash]*2}/,"#{Tex[:backslash]*4}"). # added w42
- gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- title=@md.title.full
- if dob.name =~/endnotes/
- dob.tmp=dob.tmp.gsub(/.+/m,'')
- end
- if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
- gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
- end
- dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,"\\subsubsection*{\\1}
-\\addcontentsline{toc}{subsection}{#{cont_ln}}
-\\markright{#{title}}")
+ gsub(@@tex_pattern_margin_number,'')
+ cont_ln=remove_footnotes(cont_ln)
+ dob.tmp=dob.tmp.gsub(/^(.*)\n?$/m,
+ "\\clearpage
+\\part*{\\1}
+\\addcontentsline{toc}{part}{#{cont_ln}}
+\\markboth{#{@md.title.full}}\n")
dob
end
- def level5
- dob=@dob
- # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\@txt*, same for next section 2002w46
- dob.tmp=dob.tmp.strip if dob.tmp
- dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2').
- gsub(/#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
- cont_ln=dob.tmp.dup
- cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
- gsub(@@tex_pattern_margin_number,'').
- gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- gsub(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa
- if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
- gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ def heading_sublevels(dob,sublev)
+ if sublev==:lev1
+ sect='section'
+ tocadd=%{\\addcontentsline{toc}{section}}
+ pre=''
+ post=''
+ headadd=%{\n\\markright{#{@md.title.full}}}
+ elsif sublev==:lev2
+ sect='subsection'
+ tocadd=%{\\addcontentsline{toc}{subsection}}
+ pre=''
+ post=" \\\\\n"
+ headadd=''
+ elsif sublev==:lev3
+ sect='subsubsection'
+ tocadd=%{\\addcontentsline{toc}{subsubsection}}
+ pre='' #pre='~~~~'
+ post=" \\\\\n"
+ headadd=''
end
- dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,
- "\\subsubsection*{\\1}
-\\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\
-}")
- dob
- end
- def level6
- dob=@dob
- # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\sub@txt*, same for previous section 2002w46
dob.tmp=dob.tmp.strip if dob.tmp
dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2').
gsub(/#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
cont_ln=dob.tmp.dup
cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
gsub(@@tex_pattern_margin_number,'').
+ gsub(/#{Tex[:backslash]*2}/,"#{Tex[:backslash]*4}"). # added w42
gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
- gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ if dob.name =~/endnotes/
+ dob.tmp=dob.tmp.gsub(/.+/m,'')
end
+ cont_ln=remove_footnotes(cont_ln)
dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,
- "\\subsubsection*{\\1}
-\\addcontentsline{toc}{subsubsection}{~~~~#{cont_ln} \\\\
-}")
- #dob.tmp.gsub(/^(.*)?\n?$/m,
- # '\subsubsection*{\1}')
+ "\\#{sect}*{\\1}
+#{tocadd}{#{pre}#{cont_ln}#{post}}#{headadd}")
dob
end
+ def section_heading_level_B
+ section_heading_level(@dob)
+ end
+ def section_heading_level_C
+ section_heading_level(@dob)
+ end
+ def section_heading_level_D
+ section_heading_level(@dob)
+ end
+ def heading_level_1
+ heading_sublevels(@dob,:lev1)
+ end
+ def heading_level_2
+ heading_sublevels(@dob,:lev2)
+ end
+ def heading_level_3
+ heading_sublevels(@dob,:lev3)
+ end
def hang
case @dob.indent
when /0/
diff --git a/sisu.org b/sisu.org
index dec830af..7ee24682 100644
--- a/sisu.org
+++ b/sisu.org
@@ -1423,7 +1423,7 @@ Copyright. For consistency have add the prefix 'Copyright' to the output.
Preference to omit noted, but this solution is consistent with options
provided. Bug closed, re-open if necessary.
-**** TODO [#B] #744383 [w|u] sisu syntax: :B and :C result in the same formatting
+**** DONE (6.0.5) [#B] #744383 [w|u] sisu syntax: :B and :C result in the same formatting :output:fix: (partial solution)
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744383>
From: Daniel Baumann <daniel.baumann@progress-technologies.net>
@@ -1446,6 +1446,68 @@ both equal <h2>.
Regards,
Daniel
+***** NOTES/COMMENTS
+
+this is in part an artifact of LaTeX not having as many document heading levels
+and trying to take advantage of the behavior of existing levels rather than
+customizing further
+
+look for a solution, possibly overriding the default font sizes for each
+
+The current settings were chosen because, there are not enough levels and I
+find too many different font sizes disconcerting, especially running sisu over
+a wide variety of document types
+
+the following levels are available in LaTeX
+
+\part
+\chapter
+\section
+\subsection
+\subsubsection
+
+the levels in sisu are
+
+A [title]
+B [part]
+C [subpart]
+D [subsubpart]
+1 [segment (chapter)]
+2 [subsegment]
+3 [subsubsegment]
+
+sisu current mapping:
+
+level A [title]
+level B C D \part (it is up to the user to make part levels visually distinguishable e.g. Book Part Section)
+[skipped \chapter]
+[skipped \section]
+level 1 \subsection
+level 2 \subsubsection
+level 3 \subsubsection
+
+the reason for skipping section was the default configuration and resulting
+fact that it made for a table of contents that takes more space
+
+sisu new mapping:
+
+level A [title]
+level B C D \part (it is up to the user to make part levels visually distinguishable e.g. Book Part Section)
+[skipped \chapter]
+level 1 \section
+level 2 \subsection
+level 3 \subsubsection
+
+levels B C & D are the same size,
+ it is up to the user to make part levels visually distinguishable
+ e.g. Book Part Section
+levels 1 2 & 3 are now distinguished
+
+(Closes #744386) sisu syntax: 1~ and 2~ result in the same formatting
+(under consideration & yet to be done #744383) sisu syntax: :B and :C result in the same formatting
+(touches )
+override part font size settings for different levels (B C D)
+
**** TODO [#C] #744384 [w|u] sisu syntax: relies on empty lines
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744384>
@@ -1472,7 +1534,7 @@ having an empty line in between like this:
Regards,
Daniel
-**** TODO [#B] #744386 [w|u] sisu syntax: 1~ and 2~ result in the same formatting
+**** DONE (6.0.5) [#B] #744386 [w|u] sisu syntax: 1~ and 2~ result in the same formatting :output:pdf:fix: (see #744383)
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744386>
From: Daniel Baumann <daniel.baumann@progress-technologies.net>
@@ -1489,6 +1551,12 @@ should be different in the output format (pdf here).
Regards,
Daniel
+***** NOTES/COMMENTS
+
+1~ 2~ 3~ are now differentiated
+
+deal with under #744383
+
**** TODO [#B] #744390 [w|u] sisu: empty sections are ignored
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744390>
@@ -1614,7 +1682,7 @@ to use for TOCs.
Regards,
Daniel
-**** TODO [#B] #744399 [w|u] sisu syntax: :A smaller formatted than :B
+**** DONE (6.0.5) [#B] #744399 [w|u] sisu syntax: :A smaller formatted than :B :output:fix: (see #744383) (partial solution)
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744399>
From: Daniel Baumann <daniel.baumann@progress-technologies.net>
@@ -1639,6 +1707,18 @@ page after TOC).
Regards,
Daniel
+***** NOTES/COMMENTS
+
+for pdf
+
+now is same size see #744383
+
+\part (level A B C D)
+\chapter (skipped)
+\section (level 1)
+\subsection (level 2)
+\subsubsection (level 3)
+
**** DONE (6.0.5) [#C] #744402 [w|u] sisu: support sha512 :implement:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744402>