aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/qrcode.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/qrcode.rb')
-rw-r--r--lib/sisu/v3/qrcode.rb34
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb
index d05bf442..0d126266 100644
--- a/lib/sisu/v3/qrcode.rb
+++ b/lib/sisu/v3/qrcode.rb
@@ -117,16 +117,18 @@ module SiSU_QRcode
def output_metadata
fn=@f.base_filename.manifest_txt
mn=''
- if @md.opt =~/M/
+ if @md.opt.cmd =~/M/
pt=@f.output_path.manifest.dir
fn=@f.base_filename.manifest_txt
manifest=@f.write_file.manifest_txt
end
@manifest[:txt].each do |x|
- manifest << x if @md.opt =~/M/
+ x=x.gsub(/\\\\/m,"\n")
+ puts x if @md.opt.cmd =~/V/
+ manifest << x if @md.opt.cmd =~/M/
mn += x
end
- manifest.close if @md.opt =~/M/
+ manifest.close if @md.opt.cmd =~/M/
#system(%{
# cat #{pt}/#{fn} | qrencode -s 3 -o qrcm.autonomy_markup0.png
#})
@@ -166,9 +168,9 @@ WOK
end
def summarize_sources(id,file,pth,rel,url)
sys=SiSU_Env::SystemCall.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}")
- else sys.md5("#{pth}/#{file}")
- end
+ dgst=(@dg =~/^sha(?:2|256)$/) \
+ ? (sys.sha256("#{pth}/#{file}"))
+ : (sys.md5("#{pth}/#{file}"))
SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/
size=(File.size("#{pth}/#{file}")/1024.00).to_s
kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
@@ -242,9 +244,9 @@ WOK
@manifest[:txt_title] << %{#{info}\n}
end
def links(url,lnk,target)
- static=if url =~/^\.\//; url.gsub(/^\.(\.)?/,@base_url)
- elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root)
- else url
+ static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url)
+ elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root)
+ else url
end
@manifest[:txt] << %{#{url} #{lnk} #{@brace_url.txt_open}#{static}#{@brace_url.txt_close}\n}
end
@@ -384,12 +386,12 @@ WOK
summarize(id,file,pth,rel,url)
end
if FileTest.file?(@f.place_file.txt.dir)==true
- if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)'
- elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)'
- elsif @md.opt.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)'
- elsif @md.opt.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)'
- else id='Plaintext (UTF-8)'
- end
+ id=if @md.opt.cmd =~/a/ then 'Plaintext (Unix (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/e/ then 'Plaintext (Unix (UTF-8) with endnotes)'
+ elsif @md.opt.cmd =~/A/ then 'Plaintext (dos (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/E/ then 'Plaintext (dos (UTF-8) with endnotes)'
+ else 'Plaintext (UTF-8)'
+ end
pth=@f.output_path.txt.dir
rel=@f.output_path.txt.rel_sm
url=@f.output_path.txt.url
@@ -668,7 +670,7 @@ WOK
@sp=' '
@md.topic_register_array.each do |t|
t.each_with_index do |st,i|
- if st.class==Array
+ if st.is_a?(Array)
st.each do |v|
@manifest[:txt] << %{#{@sp*i}#{v}\n}
end