From acd2e817b84d2c9d047c9814d49719e8fe735db1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 2 Dec 2011 03:28:19 -0500 Subject: v3: dal, codeblocks, start flush left (no buffer spaces at start of line) * allows cut & paste of codeblocks (from some output formats) [requested by chals irc.oftc] --- data/doc/sisu/CHANGELOG_v3 | 6 ++++++ lib/sisu/v3/dal_doc_str.rb | 2 +- lib/sisu/v3/dal_syntax.rb | 5 ++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index c022a499..bf2f5ac4 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.6.orig.tar.xz sisu_3.1.6-1.dsc sisu_3.1.6-1.debian.tar.gz + * dal, codeblocks, start flush left (no buffer spaces at start of line) to + allow cut & paste [requested by chals irc.oftc] (fixed issue, numbering of + (flush left) codeblocks; preliminary tests suggest this should be ok), need + distinguishing marks for plaintext, and ideally to fix grey background in + xetex/pdfs + * require iconv (depreciated), use String#encode instead * removed iconv, required a number of places without being used, watch diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index 52425437..2bf0305e 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -863,7 +863,7 @@ module SiSU_document_structure_extract parent=node1=node2=node3=node4=node5=node6=nil data.each do |dob| h={} - if dob.obj !~ regex_exclude_ocn_and_node \ + if (dob.obj !~ regex_exclude_ocn_and_node || dob.is =='code') \ and dob.of !~/(?:comment|layout|meta)/ \ and dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \ and dob.ocn_ diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index e51316ed..6d56e4aa 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -443,7 +443,7 @@ module SiSU_Syntax unless i == 0 cl.gsub!(Mx[:br_nl],'') w=3-ln.to_s.length - cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{Mx[:nbsp]}#{Mx[:nbsp]}#{cl}#{Mx[:br_nl]}" + cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{cl}#{Mx[:br_nl]}" ln +=1 end codeline << cl @@ -451,8 +451,7 @@ module SiSU_Syntax codeline= codeline.join("") dob.obj=codeline else - dob.obj.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/, - "\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n") + dob.obj.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n") end dob else # @\S+?: -- cgit v1.2.3