diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-21 19:40:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-21 19:40:14 +0000 |
commit | 7497c4966c396ae7571b4880790b995b9ec3f7b2 (patch) | |
tree | 6e25461252052edc1b45c7df82412814dd3b57b8 /Master/texmf-dist/tex/latex/qrbill | |
parent | 882f717fb8dc8d368852af2ae11783f704858f7c (diff) |
qrbill (21oct22)
git-svn-id: svn://tug.org/texlive/trunk@64773 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/qrbill')
-rw-r--r-- | Master/texmf-dist/tex/latex/qrbill/qrbill.sty | 677 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/qrbill/swiss.qrbill-cfg.tex | 21 |
2 files changed, 368 insertions, 330 deletions
diff --git a/Master/texmf-dist/tex/latex/qrbill/qrbill.sty b/Master/texmf-dist/tex/latex/qrbill/qrbill.sty index 30d00243345..a4c16da040e 100644 --- a/Master/texmf-dist/tex/latex/qrbill/qrbill.sty +++ b/Master/texmf-dist/tex/latex/qrbill/qrbill.sty @@ -37,7 +37,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \RequirePackage{expl3} -\ProvidesExplPackage{qrbill}{2022/09/15}{1.05}{ +\ProvidesExplPackage{qrbill}{2022/10/20}{1.07}{ Template for QR-bills based on the Swiss Payment Standards } \RequirePackage{iftex} @@ -61,7 +61,7 @@ exists~for~backwards~compatibility~and~will~be~removed. \keys_define:nn {qrbill} { font .choices:nn = {Frutiger, Arial, Helvetica, Liberation Sans} { - \tl_gset_eq:NN \g__qrbill_font_tl \l_keys_choice_tl +\tl_gset_eq:NN \g__qrbill_font_tl \l_keys_choice_tl }, font .initial:n = Liberation Sans, font / custom .code:n = {\tl_gclear:N \g__qrbill_font_tl}, @@ -77,42 +77,54 @@ exists~for~backwards~compatibility~and~will~be~removed. qrmode .initial:n = package, frame .choice:, frame / false .code:n = { - \bool_gset_false:N \g__qrbill_top_frame_bool - \bool_gset_false:N \g__qrbill_bottom_frame_bool - \bool_gset_false:N \g__qrbill_left_frame_bool - \bool_gset_false:N \g__qrbill_right_frame_bool - \bool_gset_true:N \g__qrbill_vrule_bool +\bool_gset_false:N \g__qrbill_top_frame_bool +\bool_gset_false:N \g__qrbill_bottom_frame_bool +\bool_gset_false:N \g__qrbill_left_frame_bool +\bool_gset_false:N \g__qrbill_right_frame_bool }, frame / true .code:n = { - \bool_gset_true:N \g__qrbill_top_frame_bool - \bool_gset_true:N \g__qrbill_bottom_frame_bool - \bool_gset_true:N \g__qrbill_left_frame_bool - \bool_gset_true:N \g__qrbill_right_frame_bool - \bool_gset_true:N \g__qrbill_vrule_bool +\bool_gset_true:N \g__qrbill_top_frame_bool +\bool_gset_true:N \g__qrbill_bottom_frame_bool +\bool_gset_true:N \g__qrbill_left_frame_bool +\bool_gset_true:N \g__qrbill_right_frame_bool }, frame / top .code:n = { - \bool_gset_true:N \g__qrbill_top_frame_bool - \bool_gset_false:N \g__qrbill_bottom_frame_bool - \bool_gset_false:N \g__qrbill_left_frame_bool - \bool_gset_false:N \g__qrbill_right_frame_bool - \bool_gset_true:N \g__qrbill_vrule_bool +\bool_gset_true:N \g__qrbill_top_frame_bool +\bool_gset_false:N \g__qrbill_bottom_frame_bool +\bool_gset_false:N \g__qrbill_left_frame_bool +\bool_gset_false:N \g__qrbill_right_frame_bool }, frame / bottom .code:n = { - \bool_gset_false:N \g__qrbill_top_frame_bool - \bool_gset_true:N \g__qrbill_bottom_frame_bool - \bool_gset_false:N \g__qrbill_left_frame_bool - \bool_gset_false:N \g__qrbill_right_frame_bool - \bool_gset_true:N \g__qrbill_vrule_bool +\bool_gset_false:N \g__qrbill_top_frame_bool +\bool_gset_true:N \g__qrbill_bottom_frame_bool +\bool_gset_false:N \g__qrbill_left_frame_bool +\bool_gset_false:N \g__qrbill_right_frame_bool }, frame / none .code:n = { - \bool_gset_false:N \g__qrbill_top_frame_bool - \bool_gset_false:N \g__qrbill_bottom_frame_bool - \bool_gset_false:N \g__qrbill_left_frame_bool - \bool_gset_false:N \g__qrbill_right_frame_bool - \bool_gset_false:N \g__qrbill_vrule_bool +\bool_gset_false:N \g__qrbill_top_frame_bool +\bool_gset_false:N \g__qrbill_bottom_frame_bool +\bool_gset_false:N \g__qrbill_left_frame_bool +\bool_gset_false:N \g__qrbill_right_frame_bool +\keys_set:nn {qrbill} {vrule=false} }, - frame .initial:n = true, + vrule .choice:, + vrule / true .code:n = \tl_gset:Nn \g__qrbill_vrule_tl {\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}}, + vrule / false .code:n = \tl_gset:Nn \g__qrbill_vrule_tl {\rule{\g__qrbill_rule_dim}{\c_zero_dim}}, +vrule / symbol .code:n = { +\RequirePackage{marvosym} +\tl_gset:Nn \g__qrbill_vrule_tl { +\rotatebox{90}{ +\hbox_to_wd:nn {\c_qrbill_height_dim}{ +\leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus1 fill\relax +\llap{\raisebox{-.5\height}[\c_zero_dim][\c_zero_dim]{\LeftScissors}} +\leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus4 fill\relax +\hbox{\rule{1mm}{\g__qrbill_rule_dim}} +} +} +} +}, +vrule .initial:n = true, billinginfo .bool_gset:N = \g__grbill_billinginfo_auto_bool, billinginfo .default:n = true, billinginfo .initial:n = true, @@ -124,31 +136,30 @@ exists~for~backwards~compatibility~and~will~be~removed. iconwidth .initial:n = 7mm, separate .choice:, separate / symbol .code:n = { - \bool_gset_true:N \g__qrbill_separateinfo_bool - \RequirePackage{marvosym} - \cs_set:Nn \qrbill_print_separate_info: { - \par\leaders\vbox_to_ht:nn {1sp} { - \smash{ - \hbox_to_wd:nn {\c_qrbill_width_dim }{ - \leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus1 fill\relax - \llap{\raisebox{-.5\height}{\LeftScissors}} - \leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus4 fill\relax - } - } - } - \vskip 1sp - \vskip -1sp - } - }, +\bool_gset_true:N \g__qrbill_separateinfo_bool +\RequirePackage{marvosym} +\cs_set:Nn \qrbill_print_separate_info: { +\par\leaders\vbox_to_ht:nn {1sp} { +\smash{ +\hbox_to_wd:nn {\c_qrbill_width_dim }{ +\leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus1 fill\relax +\llap{\raisebox{-.5\height}{\LeftScissors}} +\leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus4 fill\relax +} +} +} +\vskip 1sp +\vskip -1sp +} +}, separate / text .code:n = { - \bool_gset_true:N \g__qrbill_separateinfo_bool - \cs_set:Nn \qrbill_print_separate_info: { - \centerline{\raisebox{\dimexpr\depth+.3ex\relax}[0pt][0pt]{\footnotesize\qrbillseparatename}} - \par\nointerlineskip - \rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim} - } - } - , +\bool_gset_true:N \g__qrbill_separateinfo_bool +\cs_set:Nn \qrbill_print_separate_info: { +\centerline{\raisebox{\dimexpr\depth+.3ex\relax}[0pt][0pt]{\footnotesize\qrbillseparatename}} +\par\nointerlineskip +\rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim} +} + }, separate / false .code:n = {\bool_gset_false:N \g__qrbill_separateinfo_bool}, separate .initial:n = text, sep-iban .int_gset:N = \g__qrbill_ibansep_int, @@ -168,6 +179,8 @@ exists~for~backwards~compatibility~and~will~be~removed. replace-umlauts / true .code:n = \prop_gput_from_keyval:Nn \g__qrbill_replacement_prop {ä=ae,Ä=AE,ü=ue,Ü=UE,ö=oe,Ö=OE,ß=ss,ẞ=SS}, replace-umlauts / false .code:n = \clist_map_inline:nn {ä,Ä,ü,Ü,ö,Ö,ß,ẞ} {\prop_gremove:Nn \g__qrbill_replacement_prop {##1}}, data-to-string .bool_gset:N = \g__qrbill_to_string_bool, + ignore-if-empty .clist_gset:N = \g__qrbill_ignore_if_empty_clist, + ignore-if-empty .initial:n = , } \ProcessKeysOptions{qrbill} @@ -200,16 +213,7 @@ exists~for~backwards~compatibility~and~will~be~removed. \dim_new:N \g_qrbill_QRcode_dim \dim_gset:Nn \g_qrbill_QRcode_dim {46mm} \bool_if:NT \g__qrbill_luamode_bool { -\file_if_exist:nTF {qrencode.lua} { \lua_load_module:n {qrbill-latexluaqrcode} -} { -\msg_new:nnn {qrbill} {luaqrcode-not-found} { -Could~not~find~the~required~library~for~qrmode=lua.\\ -I~will~switch~to~qrmode=package. -} -\msg_warning:nn {qrbill} {luaqrcode-not-found} -\bool_gset_false:N \g__qrbill_luamode_bool -} \dim_new:N \l__qrbill_QRblocksize_dim \cs_set_protected:Npn \qrbill_qrcode_black: {\rule{\l__qrbill_QRblocksize_dim}{\l__qrbill_QRblocksize_dim}} @@ -228,6 +232,7 @@ num, string = printQRcode("\lua_escape:n {#1}") } } + \bool_if:NF \g__qrbill_luamode_bool { \usepackage{qrcode} % modified version of \qr@encode@binary to allow utf8 qrcodes required by swiss qrbill scheme @@ -235,12 +240,12 @@ num, string = printQRcode("\lua_escape:n {#1}") \cs_set:Nn \__qrbill_encode_unicode_binary:n { \edef\qr@plaintext{#1}% \def\qr@codetext{4}% %This means `binary' -\xdef\qr@stringlength{\tl_count:o {\qr@plaintext}}% +\__qrbill_qr_get_string_length_encoded:n { \qr@plaintext } \edef\qr@charactercountlengthinhex{\int_eval:n {\qr@charactercountbits@byte / 4}}% \qr@decimaltohex[\qr@charactercountlengthinhex]{\qr@charactercount}{\qr@stringlength}% \xa\g@addto@macro\xa\qr@codetext\xa{\qr@charactercount}% -\exp_args:NNx \str_set_convert:Nnnn \l_tmpa_str { \qr@plaintext } {iso88591} {utf8} -\exp_args:NNV \str_set_convert:Nnnn \l_tmpa_str \l_tmpa_str {} {latin1/hex} +\exp_args:NNx \str_set_convert:Nnnn \l_tmpa_str { \qr@plaintext } {} {utf8/hex} + \str_gput_right:NV \qr@codetext \l_tmpa_str \xdef\qr@codetext{\exp_args:No \str_lowercase:n {\qr@codetext}} \g@addto@macro\qr@codetext{0}% %This is '0000' in binary. @@ -260,8 +265,30 @@ num, string = printQRcode("\lua_escape:n {#1}") } \cs_set:Nn \qrbill_parse_QRcode:n { \cs_set_eq:NN \qr@encode@binary \__qrbill_encode_unicode_binary:n -\raisebox{\depth}{\cs_set_eq:NN \qr@encode@binary \__qrbill_encode_unicode_binary:n\qrcode[height= \g_qrbill_QRcode_dim]{#1}} +\raisebox{\depth}{ +\__qrbill_enable_unicode_qrcode_patch: +\qrcode[height= \g_qrbill_QRcode_dim]{#1} +} } + +\cs_new:Nn \__qrbill_qr_get_string_length_encoded:n {% +\exp_args:NNx \str_set_convert:Nnnn \l_tmpa_str { #1 } {} {utf8/hex} +\xdef\qr@stringlength{\int_eval:n {\str_count:N \l_tmpa_str / 2}} +} + +\cs_new:Nn \__qrbill_qr_padatfront:nn {% +\prg_replicate:nn {\int_max:nn {0} {#2- \tl_count:N #1}} { +\qr@g@preface@macro{#1}{0} +} +} + +\let\orig@qr@getstringlength\qr@getstringlength + +\cs_new:Nn \__qrbill_enable_unicode_qrcode_patch: { +\cs_set_eq:NN \qr@padatfront \__qrbill_qr_padatfront:nn +\AddToHook{cmd/qr@choose@best@version/before}{\cs_set_eq:NN \qr@getstringlength\__qrbill_qr_get_string_length_encoded:n} +\AddToHook{cmd/qr@choose@best@version/after}{\let\qr@getstringlength\orig@qr@getstringlength} +} } \cs_generate_variant:Nn \qrbill_parse_QRcode:n {V} @@ -309,13 +336,13 @@ num, string = printQRcode("\lua_escape:n {#1}") \cs_new:Nn \__qrbill_placeholder:nn { \vbox_to_ht:nn {#2} { - \hbox_to_wd:nn {#1} {\__qrbill_placeholder_hmark: \hfill \__qrbill_placeholder_hmark:} - \nointerlineskip - \hbox_to_wd:nn {#1} {\__qrbill_placeholder_vmark: \hfill \__qrbill_placeholder_vmark:} - \vfill - \hbox_to_wd:nn {#1} {\__qrbill_placeholder_vmark: \hfill \__qrbill_placeholder_vmark:} - \nointerlineskip - \hbox_to_wd:nn {#1} {\__qrbill_placeholder_hmark: \hfill \__qrbill_placeholder_hmark:} +\hbox_to_wd:nn {#1} {\__qrbill_placeholder_hmark: \hfill \__qrbill_placeholder_hmark:} +\nointerlineskip +\hbox_to_wd:nn {#1} {\__qrbill_placeholder_vmark: \hfill \__qrbill_placeholder_vmark:} +\vfill +\hbox_to_wd:nn {#1} {\__qrbill_placeholder_vmark: \hfill \__qrbill_placeholder_vmark:} +\nointerlineskip +\hbox_to_wd:nn {#1} {\__qrbill_placeholder_hmark: \hfill \__qrbill_placeholder_hmark:} } } @@ -325,172 +352,170 @@ num, string = printQRcode("\lua_escape:n {#1}") \qrbillfont \setlength{\parindent}{\z@} \parbox{\c_qrbill_width_dim }{ - \vbox to \c_qrbill_height_dim { - \bool_if:NTF \g__qrbill_top_frame_bool - { - \bool_if:NTF \g__qrbill_separateinfo_bool - {\qrbill_print_separate_info:} - {\rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim}} - } - {\rule{\c_zero_dim}{\g__qrbill_rule_dim}} - \par\nointerlineskip - \skip_vertical:n {\c_qrbill_sep_dim-\g__qrbill_rule_dim} - \skip_horizontal:n {\c_qrbill_sep_dim-\g__qrbill_rule_dim} - \begin{minipage}[c][95mm][t]{52mm} - \vbox_to_ht:nn {7mm} {\qrbill_title_font:\qrbillreceiptname} - \par\nointerlineskip - \vbox_to_ht:nn {56mm}{ - {\qrbill_headingR_font:\qrbillaccountname\par} - { - \qrbill_valueR_font: - \__qrbill_sep_tl:nV {iban} \l_qrbill_data_Account_tl\par - \qrbill_insert_address:N \g__qrbill_creditorprefix_tl - \par\vskip\baselineskip - } - \tl_if_empty:NF \l_qrbill_data_Reference_tl { - {\qrbill_headingR_font:\qrbillreferencename\par} - { - \qrbill_valueR_font: - \__qrbill_sep_tl:nV {reference} \l_qrbill_data_Reference_tl - \par\vskip\baselineskip - } - } - \tl_if_empty:cTF {l_qrbill_data_\g__qrbill_debtorprefix_tl Name_tl} - { - {\qrbill_headingR_font:\qrbilldebtoraddrname\par} - \__qrbill_placeholder:nn {52mm} {20mm} - }{ - {\qrbill_headingR_font:\qrbilldebtorname\par} - { - \qrbill_valueR_font: - \qrbill_insert_address:N \g__qrbill_debtorprefix_tl - \par - } - } - } - \par\nointerlineskip - \vbox_to_ht:nn {14mm}{ - \qrbill_headingR_font: - \begin{tabular}[t]{@{}ll@{}} - \qrbillcurrencyname&\qrbill_headingR_font:\qrbillamountname\\ - \qrbill_amountR_font:\l_qrbill_data_Currency_tl - &\qrbill_amountR_font: - \tl_if_empty:NF \l_qrbill_data_Amount_tl - {\numprint{\l_qrbill_data_Amount_tl}} - \end{tabular} - \tl_if_empty:NTF \l_qrbill_data_Amount_tl { - \hfill - \raisebox{\dimexpr-\height+\ht\strutbox}[\z@]{\llap{ - \__qrbill_placeholder:nn {30mm} {10mm} - }} - } - \vfill - } - \par\nointerlineskip - \vbox_to_ht:nn {18mm} { - \makebox[\linewidth][r]{\qrbill_headingR_font:\qrbillacceptantname}\par - } - \end{minipage}% - \skip_horizontal:n {2\c_qrbill_sep_dim} - \begin{minipage}[c][95mm][t]{138mm} - \begin{minipage}[c][85mm][t]{51mm} - \parbox[t][7mm][t]{\linewidth}{\qrbill_title_font:\qrbillpaymentpartname} - \par\nointerlineskip - \skip_vertical:n {\c_qrbill_sep_dim} - \qrcode_setup_QRcode: - \leavevmode\qrbill_parse_QRcode:V \l_qrbill_data_str - \tl_if_empty:NF \g_qrbill_icon_tl { - \llap{\hbox_to_wd:nn {\g_qrbill_QRcode_dim} { - \hfill - \raisebox{\dimexpr-.5\height+.5\g_qrbill_QRcode_dim}[0pt][0pt]{ - \includegraphics[width=\g_qrbill_iconwidth_dim]{\g_qrbill_icon_tl} - } - \hfill - }} - } - \skip_vertical:n {\c_qrbill_sep_dim} - \vbox_to_ht:nn {22mm}{ - \begin{tabular}[b]{@{}ll@{}} - \qrbill_headingP_font:\qrbillcurrencyname&\qrbill_headingP_font: - \qrbillamountname\\ - \qrbill_amountP_font:\tl_use:c {l_qrbill_data_Currency_tl}& - \tl_if_empty:NF \l_qrbill_data_Amount_tl { - \qrbill_amountP_font:\numprint{\l_qrbill_data_Amount_tl} - } - \end{tabular} - \tl_if_empty:NTF \l_qrbill_data_Amount_tl { - \hfill - \raisebox{\dimexpr-\height+\ht\strutbox}[\z@]{ - \llap{\__qrbill_placeholder:nn {40mm} {15mm} - }} - } - } - \end{minipage} - \begin{minipage}[c][85mm][t]{87mm} - \par\nointerlineskip - {\qrbill_headingP_font:\qrbillaccountname\par} - { - \qrbill_valueP_font: - \__qrbill_sep_tl:nV {iban} \l_qrbill_data_Account_tl \par - \qrbill_insert_address:N \g__qrbill_creditorprefix_tl - \par\vskip\baselineskip - } - \tl_if_empty:NF \l_qrbill_data_Reference_tl { - {\qrbill_headingP_font:\qrbillreferencename\par} - {\qrbill_valueP_font: - \__qrbill_sep_tl:nV {reference} \l_qrbill_data_Reference_tl - \par\vskip\baselineskip} - } - \exp_args:Nf \tl_if_empty:nF { - \l_qrbill_data_BillingInfo_tl - \l_qrbill_data_Message_tl - }{ - {\qrbill_headingP_font:\qrbilladdinfoname\par} - { - \qrbill_valueP_font: - \l_qrbill_data_Message_tl\par - \tl_replace_all:Nnn \l_qrbill_data_BillingInfo_tl {/} {\discretionary{}{}{}/} - \l_qrbill_data_BillingInfo_tl - \par\vskip\baselineskip - } - } - \tl_if_empty:cTF {l_qrbill_data_\g__qrbill_debtorprefix_tl Name_tl} { - {\qrbill_headingP_font:\qrbilldebtoraddrname\par} - \__qrbill_placeholder:nn {65mm} {25mm} - }{ - {\qrbill_headingP_font:\qrbilldebtorname\par} - { - \qrbill_valueP_font: - \qrbill_insert_address:N \g__qrbill_debtorprefix_tl - \par - } - } - \end{minipage}\par\nointerlineskip - \begin{minipage}[b][10mm][t]{\linewidth} - \strut - \qrbill_insert_AV_parameters:NNn - \qrbill_infoheading_font: - \qrbill_info_font: - {AV1,AV2} - \end{minipage} - \end{minipage} - \par\nointerlineskip\skip_vertical:n {\c_qrbill_sep_dim} - \smash{ - \bool_if:NT \g__qrbill_bottom_frame_bool - {\rlap{\rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim}}} - \bool_if:NTF \g__qrbill_left_frame_bool - {\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}} - {\rule{\g__qrbill_rule_dim}{\c_zero_dim}} - \hspace{\dimexpr62mm-1.5\g__qrbill_rule_dim} - \bool_if:NTF \g__qrbill_vrule_bool - {\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}} - {\rule{\g__qrbill_rule_dim}{\c_zero_dim}} - \hspace{\dimexpr148mm-1.5\g__qrbill_rule_dim} - \bool_if:NTF \g__qrbill_right_frame_bool - {\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}} - {\rule{\g__qrbill_rule_dim}{\c_zero_dim}} - } - } +\vbox to \c_qrbill_height_dim { +\bool_if:NTF \g__qrbill_top_frame_bool +{ +\bool_if:NTF \g__qrbill_separateinfo_bool +{\qrbill_print_separate_info:} +{\rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim}} +} +{\rule{\c_zero_dim}{\g__qrbill_rule_dim}} +\par\nointerlineskip +\skip_vertical:n {\c_qrbill_sep_dim-\g__qrbill_rule_dim} +\skip_horizontal:n {\c_qrbill_sep_dim-\g__qrbill_rule_dim} +\begin{minipage}[c][95mm][t]{52mm} +\vbox_to_ht:nn {7mm} {\qrbill_title_font:\qrbillreceiptname} +\par\nointerlineskip +\vbox_to_ht:nn {56mm}{ +{\qrbill_headingR_font:\qrbillaccountname\par} +{ +\qrbill_valueR_font: +\__qrbill_sep_tl:nV {iban} \l_qrbill_data_Account_tl\par +\qrbill_insert_address:N \g__qrbill_creditorprefix_tl +\par\vskip\baselineskip +} +\tl_if_empty:NF \l_qrbill_data_Reference_tl { +{\qrbill_headingR_font:\qrbillreferencename\par} +{ +\qrbill_valueR_font: +\__qrbill_sep_tl:nV {reference} \l_qrbill_data_Reference_tl +\par\vskip\baselineskip +} +} +\tl_if_empty:cTF {l_qrbill_data_\g__qrbill_debtorprefix_tl Name_tl} + { + {\qrbill_headingR_font:\qrbilldebtoraddrname\par} + \__qrbill_placeholder:nn {52mm} {20mm} + }{ + {\qrbill_headingR_font:\qrbilldebtorname\par} + { + \qrbill_valueR_font: + \qrbill_insert_address:N \g__qrbill_debtorprefix_tl + \par + } + } +} +\par\nointerlineskip +\vbox_to_ht:nn {14mm}{ +\qrbill_headingR_font: +\begin{tabular}[t]{@{}ll@{}} +\qrbillcurrencyname&\qrbill_headingR_font:\qrbillamountname\\ +\qrbill_amountR_font:\l_qrbill_data_Currency_tl +&\qrbill_amountR_font: +\tl_if_empty:NF \l_qrbill_data_Amount_tl + {\numprint{\l_qrbill_data_Amount_tl}} +\end{tabular} +\tl_if_empty:NTF \l_qrbill_data_Amount_tl { +\hfill +\raisebox{\dimexpr-\height+\ht\strutbox}[\z@]{\llap{ +\__qrbill_placeholder:nn {30mm} {10mm} +}} +} +\vfill +} +\par\nointerlineskip +\vbox_to_ht:nn {18mm} { +\makebox[\linewidth][r]{\qrbill_headingR_font:\qrbillacceptantname}\par +} +\end{minipage}% +\skip_horizontal:n {2\c_qrbill_sep_dim} +\begin{minipage}[c][95mm][t]{138mm} +\begin{minipage}[c][85mm][t]{51mm} +\parbox[t][7mm][t]{\linewidth}{\qrbill_title_font:\qrbillpaymentpartname} +\par\nointerlineskip +\skip_vertical:n {\c_qrbill_sep_dim} +\qrcode_setup_QRcode: +\leavevmode\qrbill_parse_QRcode:V \l_qrbill_data_str +\tl_if_empty:NF \g_qrbill_icon_tl { +\llap{\hbox_to_wd:nn {\g_qrbill_QRcode_dim} { +\hfill +\raisebox{\dimexpr-.5\height+.5\g_qrbill_QRcode_dim}[0pt][0pt]{ +\includegraphics[width=\g_qrbill_iconwidth_dim]{\g_qrbill_icon_tl} +} +\hfill +}} +} +\skip_vertical:n {\c_qrbill_sep_dim} +\vbox_to_ht:nn {22mm}{ +\begin{tabular}[b]{@{}ll@{}} +\qrbill_headingP_font:\qrbillcurrencyname&\qrbill_headingP_font: +\qrbillamountname\\ +\qrbill_amountP_font:\tl_use:c {l_qrbill_data_Currency_tl}& +\tl_if_empty:NF \l_qrbill_data_Amount_tl { +\qrbill_amountP_font:\numprint{\l_qrbill_data_Amount_tl} +} +\end{tabular} +\tl_if_empty:NTF \l_qrbill_data_Amount_tl { +\hfill +\raisebox{\dimexpr-\height+\ht\strutbox}[\z@]{ +\llap{\__qrbill_placeholder:nn {40mm} {15mm} +}} +} +} +\end{minipage} +\begin{minipage}[c][85mm][t]{87mm} +\par\nointerlineskip +{\qrbill_headingP_font:\qrbillaccountname\par} +{ +\qrbill_valueP_font: +\__qrbill_sep_tl:nV {iban} \l_qrbill_data_Account_tl \par +\qrbill_insert_address:N \g__qrbill_creditorprefix_tl +\par\vskip\baselineskip +} +\tl_if_empty:NF \l_qrbill_data_Reference_tl { +{\qrbill_headingP_font:\qrbillreferencename\par} +{\qrbill_valueP_font: +\__qrbill_sep_tl:nV {reference} \l_qrbill_data_Reference_tl +\par\vskip\baselineskip} +} +\exp_args:Nf \tl_if_empty:nF { +\l_qrbill_data_BillingInfo_tl +\l_qrbill_data_Message_tl +}{ +{\qrbill_headingP_font:\qrbilladdinfoname\par} +{ +\qrbill_valueP_font: +\l_qrbill_data_Message_tl\par +\tl_replace_all:Nnn \l_qrbill_data_BillingInfo_tl {/} {\discretionary{}{}{}/} +\l_qrbill_data_BillingInfo_tl +\par\vskip\baselineskip +} +} +\tl_if_empty:cTF {l_qrbill_data_\g__qrbill_debtorprefix_tl Name_tl} { +{\qrbill_headingP_font:\qrbilldebtoraddrname\par} +\__qrbill_placeholder:nn {65mm} {25mm} +}{ +{\qrbill_headingP_font:\qrbilldebtorname\par} +{ +\qrbill_valueP_font: +\qrbill_insert_address:N \g__qrbill_debtorprefix_tl +\par +} +} +\end{minipage}\par\nointerlineskip +\begin{minipage}[b][10mm][t]{\linewidth} +\strut +\qrbill_insert_AV_parameters:NNn +\qrbill_infoheading_font: +\qrbill_info_font: +{AV1,AV2} +\end{minipage} +\end{minipage} +\par\nointerlineskip\skip_vertical:n {\c_qrbill_sep_dim} +\smash{ +\bool_if:NT \g__qrbill_bottom_frame_bool +{\rlap{\rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim}}} +\bool_if:NTF \g__qrbill_left_frame_bool +{\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}} +{\rule{\g__qrbill_rule_dim}{\c_zero_dim}} +\hspace{\dimexpr62mm-1.5\g__qrbill_rule_dim} +\g__qrbill_vrule_tl +\hspace{\dimexpr148mm-1.5\g__qrbill_rule_dim} +\bool_if:NTF \g__qrbill_right_frame_bool +{\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}} +{\rule{\g__qrbill_rule_dim}{\c_zero_dim}} +} +} } \endgroup } @@ -518,10 +543,10 @@ num, string = printQRcode("\lua_escape:n {#1}") \ior_str_map_inline:Nn \qrbill_ior { \int_step_inline:nnn {2} {\l_tmpa_int } { - \exp_args:Nnx \use:n {\exp_args:NNx \exp_args:Nnc \defcaptionname - {\clist_item:Nn \l_qrbill_tmpa_clist {##1}} - {qrbill\clist_item:nn {#1} {1}name}} - {\clist_item:nn {#1} {##1}} +\exp_args:Nnx \use:n {\exp_args:NNx \exp_args:Nnc \defcaptionname +{\clist_item:Nn \l_qrbill_tmpa_clist {##1}} +{qrbill\clist_item:nn {#1} {1}name}} +{\clist_item:nn {#1} {##1}} } } @@ -538,13 +563,13 @@ num, string = printQRcode("\lua_escape:n {#1}") \seq_set_split:Nnn \l_qrbill_tmp_seq {\\} {#2} } \exp_args:Nnx \keys_set:nn {qrbill/data} { - #1AddressType=K, - #1Name=\seq_item:Nn \l_qrbill_tmp_seq {1}, - #1Address1=\seq_item:Nn \l_qrbill_tmp_seq {2}, - #1Address2=\seq_item:Nn \l_qrbill_tmp_seq {3}, - #1PostalCode=, - #1City=, - #1Country=\seq_item:Nn \l_qrbill_tmp_seq {4}, +#1AddressType=K, +#1Name={\seq_item:Nn \l_qrbill_tmp_seq {1}}, +#1Address1={\seq_item:Nn \l_qrbill_tmp_seq {2}}, +#1Address2={\seq_item:Nn \l_qrbill_tmp_seq {3}}, +#1PostalCode=, +#1City=, +#1Country={\seq_item:Nn \l_qrbill_tmp_seq {4}}, } } @@ -557,40 +582,40 @@ num, string = printQRcode("\lua_escape:n {#1}") \seq_set_split:Nnn \l_qrbill_tmp_seq {\\} {#2} } \exp_args:Nnx \keys_set:nn {qrbill/data} { - #1AddressType=S, - #1Name=\seq_item:Nn \l_qrbill_tmp_seq {1}, - #1Address1=\seq_item:Nn \l_qrbill_tmp_seq {2}, - #1Address2=\seq_item:Nn \l_qrbill_tmp_seq {3}, - #1PostalCode=\seq_item:Nn \l_qrbill_tmp_seq {4}, - #1City=\seq_item:Nn \l_qrbill_tmp_seq {5}, - #1Country=\seq_item:Nn \l_qrbill_tmp_seq {6}, +#1AddressType=S, +#1Name={\seq_item:Nn \l_qrbill_tmp_seq {1}}, +#1Address1={\seq_item:Nn \l_qrbill_tmp_seq {2}}, +#1Address2={\seq_item:Nn \l_qrbill_tmp_seq {3}}, +#1PostalCode={\seq_item:Nn \l_qrbill_tmp_seq {4}}, +#1City={\seq_item:Nn \l_qrbill_tmp_seq {5}}, +#1Country={\seq_item:Nn \l_qrbill_tmp_seq {6}}, } } \cs_new:Nn \qrbill_insert_address:N { \tl_use:c {l_qrbill_data_#1Name_tl}\ifhmode\\\fi \str_case_e:nnF {\use:c {l_qrbill_data_#1AddressType_tl}} - { - {K} { - \tl_use:c {l_qrbill_data_#1Address1_tl} - \tl_if_empty:cF {l_qrbill_data_#1Address2_tl} { - \ifhmode\\\fi - \tl_if_empty:cF {l_qrbill_data_#1Country_tl} - {\tl_use:c {l_qrbill_data_#1Country_tl}-} - \tl_use:c {l_qrbill_data_#1Address2_tl} - } - } - }{ - \tl_use:c {l_qrbill_data_#1Address1_tl}~ - \tl_use:c {l_qrbill_data_#1Address2_tl} - \tl_if_empty:cF {l_qrbill_data_#1City_tl} { - \ifhmode\\\fi - \tl_if_empty:cF {l_qrbill_data_#1Country_tl} - {\tl_use:c {l_qrbill_data_#1Country_tl}-} - \tl_use:c {l_qrbill_data_#1PostalCode_tl}~ - \tl_use:c {l_qrbill_data_#1City_tl} - } - } + { +{K} { + \tl_use:c {l_qrbill_data_#1Address1_tl} + \tl_if_empty:cF {l_qrbill_data_#1Address2_tl} { +\ifhmode\\\fi +\tl_if_empty:cF {l_qrbill_data_#1Country_tl} + {\tl_use:c {l_qrbill_data_#1Country_tl}-} + \tl_use:c {l_qrbill_data_#1Address2_tl} + } +} + }{ +\tl_use:c {l_qrbill_data_#1Address1_tl}~ +\tl_use:c {l_qrbill_data_#1Address2_tl} +\tl_if_empty:cF {l_qrbill_data_#1City_tl} { + \ifhmode\\\fi + \tl_if_empty:cF {l_qrbill_data_#1Country_tl} +{\tl_use:c {l_qrbill_data_#1Country_tl}-} + \tl_use:c {l_qrbill_data_#1PostalCode_tl}~ + \tl_use:c {l_qrbill_data_#1City_tl} +} + } } \cs_new:Nn \__qrbill_sep_tl:nn { @@ -636,15 +661,15 @@ num, string = printQRcode("\lua_escape:n {#1}") \clist_map_inline:nn {AV1, AV2} { \keys_define:nn {qrbill/data} { - #1 .code:n = { - \tl_if_empty:nF {##1}{ - \exp_args:Nnx \keys_set:nn {qrbill/data} { - #1-Parameters={\qrbill_av_prefix:n {#1}##1} - } - } - \tl_set:cn {l_qrbill_#1_tl} {##1} - }, - #1 .initial:n =, +#1 .code:n = { +\tl_if_empty:nF {##1}{ +\exp_args:Nnx \keys_set:nn {qrbill/data} { +#1-Parameters={\qrbill_av_prefix:n {#1}##1} +} +} +\tl_set:cn {l_qrbill_#1_tl} {##1} +}, +#1 .initial:n =, } } @@ -661,13 +686,21 @@ num, string = printQRcode("\lua_escape:n {#1}") \str_clear:N \l_qrbill_data_str \bool_set_false:N \l_tmpa_bool \seq_map_inline:Nn \g__qrbill_qrscheme_seq { - \bool_if:NTF \l_tmpa_bool - {\str_put_right:Nn\l_qrbill_data_str {^^J}} - {\bool_set_true:N \l_tmpa_bool} - \exp_args:NNv \str_put_right:Nn \l_qrbill_data_str {l_qrbill_data_##1_tl} +\clist_if_in:NnTF \g__qrbill_ignore_if_empty_clist {##1} +{ +\tl_if_empty:cTF {l_qrbill_data_##1_tl} \use_none:n \use:n +} +\use:n +{ +\bool_if:NTF \l_tmpa_bool + {\str_put_right:Nn\l_qrbill_data_str {^^J}} + {\bool_set_true:N \l_tmpa_bool} + \exp_args:NNv \str_put_right:Nn \l_qrbill_data_str {l_qrbill_data_##1_tl} + } } %necessary to preserve spaces! - \str_replace_all:Nnn \l_qrbill_data_str {~ } {\ } + \bool_if:NF \g__qrbill_luamode_bool +{ \str_replace_all:Nnn \l_qrbill_data_str {~ } {\ } } \prop_map_inline:Nn \g__qrbill_replacement_prop { \str_replace_all:Nnn \l_qrbill_data_str {##1} {##2} } @@ -676,13 +709,13 @@ num, string = printQRcode("\lua_escape:n {#1}") \seq_new:N \g__qrbill_qrscheme_seq \newcommand*\SetQrScheme[1]{ - \seq_gset_from_clist:Nn \g__qrbill_qrscheme_seq {#1} - \seq_map_inline:Nn \g__qrbill_qrscheme_seq { - \keys_define:nn {qrbill/data} { - ##1 .tl_set:c = l_qrbill_data_##1_tl, - ##1 .initial:n =, - } - } +\seq_gset_from_clist:Nn \g__qrbill_qrscheme_seq {#1} +\seq_map_inline:Nn \g__qrbill_qrscheme_seq { +\keys_define:nn {qrbill/data} { +##1 .tl_set:c = l_qrbill_data_##1_tl, +##1 .initial:n =, +} +} } \prop_new:N \g__qrbill_billing_info_prop @@ -695,13 +728,13 @@ num, string = printQRcode("\lua_escape:n {#1}") \prop_gset_from_keyval:Nn \g__qrbill_billing_info_prop {#1} \seq_gclear:N \g__qrbill_billing_info_seq \prop_map_inline:Nn \g__qrbill_billing_info_prop { - \clist_if_in:NnF \g__qrbill_billing_info_static_clist {##1} { - \seq_push:Nn \g__qrbill_billing_info_seq {##1} - } - \keys_define:nn {qrbill/data} { - ##2 .tl_set:c = l_qrbill_##2_tl, - ##2 .initial:n =, - } +\clist_if_in:NnF \g__qrbill_billing_info_static_clist {##1} { +\seq_push:Nn \g__qrbill_billing_info_seq {##1} +} +\keys_define:nn {qrbill/data} { +##2 .tl_set:c = l_qrbill_##2_tl, +##2 .initial:n =, +} } \seq_if_empty:NF \g__qrbill_billing_info_seq { \prop_map_inline:Nn \g__qrbill_billing_info_prop { @@ -713,9 +746,9 @@ num, string = printQRcode("\lua_escape:n {#1}") } } \seq_sort:Nn \g__qrbill_billing_info_seq { - \int_compare:nNnTF { ##1 } > { ##2 } - { \sort_return_swapped: } - { \sort_return_same: } +\int_compare:nNnTF { ##1 } > { ##2 } +{ \sort_return_swapped: } +{ \sort_return_same: } } } @@ -723,17 +756,17 @@ num, string = printQRcode("\lua_escape:n {#1}") \cs_new:Nn \qrbill_parse_BillingInfo: { \bool_if:NT \g__grbill_billinginfo_auto_bool { - \str_put_right:Nx \l_qrbill_data_BillingInfo_tl { - \prop_item:Nn \g__qrbill_billing_info_prop {prefix} - } - \seq_map_inline:Nn \g__qrbill_billing_info_seq { - \prop_get:NnN \g__qrbill_billing_info_prop {##1} \l_tmpa_tl - \tl_if_empty:cF {l_qrbill_\l_tmpa_tl _tl} { - \str_put_right:Nx \l_qrbill_data_BillingInfo_tl { - /##1/\tl_use:c {l_qrbill_\l_tmpa_tl _tl} - } - } - } +\str_put_right:Nx \l_qrbill_data_BillingInfo_tl { +\prop_item:Nn \g__qrbill_billing_info_prop {prefix} +} +\seq_map_inline:Nn \g__qrbill_billing_info_seq { +\prop_get:NnN \g__qrbill_billing_info_prop {##1} \l_tmpa_tl +\tl_if_empty:cF {l_qrbill_\l_tmpa_tl _tl} { +\str_put_right:Nx \l_qrbill_data_BillingInfo_tl { +/##1/\tl_use:c {l_qrbill_\l_tmpa_tl _tl} +} +} +} } } @@ -751,9 +784,9 @@ num, string = printQRcode("\lua_escape:n {#1}") \cs_new:Nn \qrbill_insert_AV_parameters:NNn { \clist_map_inline:nn {#3} { - \tl_if_empty:cF {l_qrbill_##1_tl} - {{#1\qrbill_av_prefix:n {##1}}{#2 \tl_use:c {l_qrbill_##1_tl}}} - } +\tl_if_empty:cF {l_qrbill_##1_tl} + {{#1\qrbill_av_prefix:n {##1}}{#2 \tl_use:c {l_qrbill_##1_tl}}} +} } \cs_new:Nn \qrbill_av_prefix:n {Name~#1:~} diff --git a/Master/texmf-dist/tex/latex/qrbill/swiss.qrbill-cfg.tex b/Master/texmf-dist/tex/latex/qrbill/swiss.qrbill-cfg.tex index 3c2d6474cf7..8e02f34eac8 100644 --- a/Master/texmf-dist/tex/latex/qrbill/swiss.qrbill-cfg.tex +++ b/Master/texmf-dist/tex/latex/qrbill/swiss.qrbill-cfg.tex @@ -37,8 +37,13 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \qrbillsetup{ - creditorprefix =CR-, - debtorprefix =UD-, +creditorprefix=CR-, +debtorprefix=UD-, +ignore-if-empty={ +AV1-Parameters, +AV2-Parameters, +BillingInfo +} } \SetQrScheme{ @@ -101,12 +106,12 @@ \ExplSyntaxOff \SetupQrBill{ - QRType=SPC, - Version=0200, - CodingType=1, - Trailer=EPD, - Currency=CHF, - ReferenceType=NON, +QRType=SPC, +Version=0200, +CodingType=1, +Trailer=EPD, +Currency=CHF, +ReferenceType=NON, } \qrbillsetdata*{ |