From b1d08ced020a74c5871b20ad4de57b533e3a4c2e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 08:07:27 -0400 Subject: v3: qrcode, sisu generated manifest output, treat as such * place qrcode images in directory under manifest (manifest/qrcode) * fix remote placement of qrcode images when requested --- lib/sisu/v3/manifest.rb | 11 ++++----- lib/sisu/v3/qrcode.rb | 6 ++--- lib/sisu/v3/sysenv.rb | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index cb25781f..d1e01f58 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -416,11 +416,10 @@ module SiSU_Manifest end end def qrc_image - pth="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" - fn=@f.base_filename.manifest_txt - img_md="#{@md.file.output_path.html.rel_image}/qrc_md.#{fn}.png" - img_title="#{@md.file.output_path.html.rel_image}/qrc_title.#{fn}.png" - if FileTest.file?("#{pth}/qrc_md.#{fn}.png")==true + fn=@md.fnb + img_md="qrcode/#{fn}.md.png" + img_title="qrcode/#{fn}.title.png" + if FileTest.file?(@f.place_file.qrcode_md.dir)==true @manifest[:html] <<<

QR code SiSU document metadata:

@@ -430,7 +429,7 @@ module SiSU_Manifest WOK end - if FileTest.file?("#{pth}/qrc_title.#{fn}.png")==true + if FileTest.file?(@f.place_file.qrcode_title.dir)==true @manifest[:html] <<<

QR code document title info:

diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb index e244231e..1b741a48 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v3/qrcode.rb @@ -110,7 +110,7 @@ module SiSU_QRcode @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) @brace_url=SiSU_Viz::Skin.new.url_decoration - @dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + @f.make_path(@f.output_path.qrcode.dir) end def output_metadata fn=@f.base_filename.manifest_txt @@ -128,7 +128,7 @@ module SiSU_QRcode #system(%{ # cat #{pt}/#{fn} | qrencode -s 3 -o qrcm.autonomy_markup0.png #}) - cmd=SiSU_Env::System_call.new(mn,"#{@dest}/qrc_md.#{fn}.png",@md.opt.cmd) + cmd=SiSU_Env::System_call.new(mn,@f.place_file.qrcode_md.dir,@md.opt.cmd) cmd.qrencode #system(%{ # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_md.#{fn}.png @@ -140,7 +140,7 @@ module SiSU_QRcode @manifest[:txt_title].each do |x| mn += x end - cmd=SiSU_Env::System_call.new(mn,"#{@dest}/qrc_title.#{fn}.png",@md.opt.cmd) + cmd=SiSU_Env::System_call.new(mn,@f.place_file.qrcode_title.dir,@md.opt.cmd) cmd.qrencode #system(%{ # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_title.#{fn}.png diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index ad831489..b5a10614 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -3021,6 +3021,10 @@ WOK if @opt.cmd =~/p/ inp << @f.output_path.pdf.rel + '/' + @opt.fnb + '*' end + if @opt.cmd =~/Q/ \ + && FileTest.file?(@f.place_file.qrcode_md.dir) + inp << @f.place_file.qrcode_md.rel << @f.place_file.qrcode_title.rel + end if @opt.cmd =~/y/ \ && FileTest.file?(@f.place_file.manifest.dir) inp << @f.place_file.manifest.rel @@ -3395,6 +3399,12 @@ WOK fn=base_filename.hash_digest file=make_file(path,fn) end + def qrcode + path=output_path.qrcode.dir + make_path(path) + fn=base_filename.qrcode + make_file(path,fn) + end def manifest path=output_path.manifest.dir make_path(path) @@ -3617,6 +3627,24 @@ WOK end self end + def qrcode_title + def dir + output_path.qrcode.dir + '/' + base_filename.qrcode_title + end + def rel + output_path.qrcode.rel + '/' + base_filename.qrcode_title + end + self + end + def qrcode_md + def dir + output_path.qrcode.dir + '/' + base_filename.qrcode_md + end + def rel + output_path.qrcode.rel + '/' + base_filename.qrcode_md + end + self + end def manifest def dir output_path.manifest.dir + '/' + base_filename.manifest @@ -3817,6 +3845,26 @@ WOK 'sitemap' + @md.lang_code_insert + ft end end + def qrcode_title + ft='.title.png' + if @env.output_dir_structure.by_language_code? + @md.fnb + ft + elsif @env.output_dir_structure.by_filetype? + @md.fnb + @md.lang_code_insert + ft + else #fix + 'sisu_manifest' + @md.lang_code_insert + ft + end + end + def qrcode_md + ft='.md.png' + if @env.output_dir_structure.by_language_code? + @md.fnb + ft + elsif @env.output_dir_structure.by_filetype? + @md.fnb + @md.lang_code_insert + ft + else #fix + 'sisu_manifest' + @md.lang_code_insert + ft + end + end def manifest_txt ft='.txt' if @env.output_dir_structure.by_language_code? @@ -4442,6 +4490,24 @@ WOK end self end + def qrcode + def ft + 'manifest/qrcode' + end + def dir + set_path(ft).dir.abc + end + def url + set_path(ft).url.abc + end + def rel + set_path(ft).rel.abc + end + def rcp + set_path(ft).rcp.abc + end + self + end def harvest def ft 'site_metadata' -- cgit v1.2.3