mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
always consider empty strings as no value given
This commit is contained in:
@@ -6,23 +6,23 @@ function convertLineBreaks(lines: string) {
|
||||
|
||||
export function brief(options: IDocProps) {
|
||||
const {
|
||||
template = 'brief-fam',
|
||||
subject = '',
|
||||
yourRef = '',
|
||||
yourRefName = 'Ihr Zeichen',
|
||||
yourMail = '',
|
||||
myRef = '',
|
||||
customer = '',
|
||||
invoice = '',
|
||||
date = '\\today',
|
||||
signature = '',
|
||||
specialMail = '',
|
||||
address = 'Max Mustermann\\\\Musterstrasse\\\\12345 Musterstadt',
|
||||
opening = 'Sehr geehrte Damen und Herren',
|
||||
body = '',
|
||||
closing = 'Mit freundlichen Grüßen',
|
||||
ps = '',
|
||||
enclosing = '',
|
||||
template,
|
||||
subject,
|
||||
yourRef,
|
||||
yourRefName,
|
||||
yourMail,
|
||||
myRef,
|
||||
customer,
|
||||
invoice,
|
||||
date,
|
||||
signature,
|
||||
specialMail,
|
||||
address,
|
||||
opening,
|
||||
body,
|
||||
closing,
|
||||
ps,
|
||||
enclosing,
|
||||
} = { ...options }
|
||||
|
||||
return `% brief document
|
||||
@@ -31,17 +31,15 @@ export function brief(options: IDocProps) {
|
||||
|
||||
\\setkomavar{subject}{${subject}}
|
||||
|
||||
\\setkomavar{yourref}[${yourRefName}]{${yourRef}}
|
||||
\\setkomavar{yourmail}{${yourMail}}
|
||||
\\setkomavar{myref}{${myRef}}
|
||||
\\setkomavar{customer}{${customer}}
|
||||
\\setkomavar{invoice}{${invoice}}
|
||||
${yourRef ? `\\setkomavar{yourref}[${yourRefName}]{${yourRef}}` : ''}
|
||||
${yourMail ? `\\setkomavar{yourmail}{${yourMail}}` : ''}
|
||||
${myRef ? `\\setkomavar{myref}{${myRef}}` : ''}
|
||||
${customer ? `\\setkomavar{customer}{${customer}}` : ''}
|
||||
${invoice ? `\\setkomavar{invoice}{${invoice}}` : ''}
|
||||
${signature ? `\\setkomavar{signature}{${signature}}` : ''}
|
||||
${specialMail ? `\\setkomavar{specialmail}{${specialMail}}` : ''}
|
||||
|
||||
\\setkomavar{date}{${date}}
|
||||
|
||||
%\\setkomavar{signature}{${signature}}
|
||||
|
||||
\\setkomavar{specialmail}{${specialMail}}
|
||||
${date ? `\\setkomavar{date}{${date}}` : ''}
|
||||
|
||||
\\begin{document}
|
||||
\\begin{letter}{${convertLineBreaks(address)}}
|
||||
@@ -52,9 +50,9 @@ export function brief(options: IDocProps) {
|
||||
|
||||
\\closing{${closing}}
|
||||
|
||||
\\ps{${ps}}
|
||||
${ps ? `\\ps{${ps}}` : ''}
|
||||
|
||||
%\\encl{${enclosing}}
|
||||
${enclosing ? `\\encl{${enclosing}}` : ''}
|
||||
|
||||
\\end{letter}
|
||||
\\end{document}`
|
||||
|
||||
Reference in New Issue
Block a user