From 7ef0302aa8c9e810bd9d8de86a2b92a2d9bea0fe Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 26 Jun 2011 14:40:52 -0400 Subject: v2 v3: texpdf, define hardspace & provide backslash * define \hardspace to simplify placing a hardspace * provide backslash character in code block --- data/doc/sisu/CHANGELOG_v2 | 4 ++++ data/doc/sisu/CHANGELOG_v3 | 4 ++++ lib/sisu/v2/texpdf.rb | 4 ++++ lib/sisu/v2/texpdf_format.rb | 5 +++++ lib/sisu/v3/texpdf.rb | 4 ++++ lib/sisu/v3/texpdf_format.rb | 5 +++++ 6 files changed, 26 insertions(+) diff --git a/data/doc/sisu/CHANGELOG_v2 b/data/doc/sisu/CHANGELOG_v2 index 610d61ba..08ecd407 100644 --- a/data/doc/sisu/CHANGELOG_v2 +++ b/data/doc/sisu/CHANGELOG_v2 @@ -22,6 +22,10 @@ http://git.sisudoc.org/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/3.0.13-1 * sisu syntax highlighting, linebreak \\ added (
kept) * colors, added cursor line & column + * texpdf + * define \hardspace to simplify placing a hardspace (within a code block) + * provide backslash character in code block + %% 2.9.6.orig.tar.gz (2011-06-07:23/2) [see 3.0.12] http://git.sisudoc.org/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/3.0.12-1 diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 5d32bfc0..830bdf12 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -30,6 +30,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.13.orig.tar.gz * sisu syntax highlighting, linebreak \\ added (
kept) * colors, added cursor line & column + * texpdf + * define \hardspace to simplify placing a hardspace (within a code block) + * provide backslash character in code block + * ansi screen reporting include document language code %% 3.0.12.orig.tar.gz (2011-06-09:23/4) diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb index a1a2813f..6503c931 100644 --- a/lib/sisu/v2/texpdf.rb +++ b/lib/sisu/v2/texpdf.rb @@ -341,6 +341,8 @@ module SiSU_TeX if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ dob.tmp=SiSU_TeX_Pdf::Format_text_object.new(@md,dob.tmp).url_str_internal(dob.tmp) end + elsif dob.is =='code' + dob.tmp=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp).special_characters_code elsif dob.is =='break' if dob.obj==Mx[:br_page]; dob.tmp='\newpage' elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage' @@ -573,6 +575,8 @@ module SiSU_TeX \\newcommand{\\Codeblock}[1]{\\normaltext\\raggedright\\small\\ttfamily\\texbackslash#1} \\newcommand{\\monosp}[1]{\\normaltext\\ttfamily\\texbackslash#1} \\newcommand{\\parasep}{\\\\ \\begin{center}*\\hspace{2em}*\\hspace{2em}*\\end{center} \\\\} +\\newcommand{\\hardspace}{{~}} +%\\newcommand{\\hardspace}{\\hspace{.5em}} % \\sloppy \\begin{document} WOK diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index b2dd0e32..018232ac 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -1162,6 +1162,11 @@ WOK str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues @txt=str end + def special_characters_code + str=@txt + str.gsub!(/ \\\\([ #{Mx[:br_nl]}]+|$)/,' \textbackslash\textbackslash\hardspace\1') + str + end end class Use_TeX attr_accessor :url,:txt,:date diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index c9e0f032..0f16e991 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -349,6 +349,8 @@ module SiSU_TeX if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ dob.tmp=SiSU_TeX_Pdf::Format_text_object.new(@md,dob.tmp).url_str_internal(dob.tmp) end + elsif dob.is =='code' + dob.tmp=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp).special_characters_code elsif dob.is =='break' if dob.obj==Mx[:br_page]; dob.tmp='\newpage' elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage' @@ -582,6 +584,8 @@ module SiSU_TeX \\newcommand{\\Codeblock}[1]{\\normaltext\\raggedright\\small\\ttfamily\\texbackslash#1} \\newcommand{\\monosp}[1]{\\normaltext\\ttfamily\\texbackslash#1} \\newcommand{\\parasep}{\\\\ \\begin{center}*\\hspace{2em}*\\hspace{2em}*\\end{center} \\\\} +\\newcommand{\\hardspace}{{~}} +%\\newcommand{\\hardspace}{\\hspace{.5em}} % \\sloppy \\begin{document} WOK diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index 8c53b458..f7e63066 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -1164,6 +1164,11 @@ WOK str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues @txt=str end + def special_characters_code + str=@txt + str.gsub!(/ \\\\([ #{Mx[:br_nl]}]+|$)/,' \textbackslash\textbackslash\hardspace\1') + str + end end class Use_TeX attr_accessor :url,:txt,:date -- cgit v1.2.3