license conversion txt2rtf

directly via shell as neither special escaping nor conversion are necessary
This commit is contained in:
Simon Sobisch 2021-10-12 02:05:59 +02:00
parent 0f5a7d4a1b
commit d3371f8aab
2 changed files with 12 additions and 10 deletions

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c3eac997fba9d3d5596c503a826fe5d54c87b1cf899a790b6d077e4d196bd5e9
size 373978

View file

@ -1,15 +1,20 @@
#!/bin/bash
set -ex
cd "$( dirname "${BASH_SOURCE[0]}" )"/../../../vscode
CALLER_DIR=$( pwd )
input=LICENSE.txt
target=LICENSE.rtf
cd "$( dirname "${BASH_SOURCE[0]}" )"
cat - >$target <<_EOF
{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Consolas;}}
\viewkind4\uc1\pard\lang1033\f0\fs22
7z x -y TXT2RTF.zip
_EOF
LICENSE=$( powershell.exe -Command "[System.IO.Path]::GetFullPath( '../../../vscode/LICENSE.txt' )" )
sed -zE -e 's/([A-Za-z,])\r?\n([A-Za-z])/\1 \2/g' -e 's/\r?\n\r?\n/\\par\n\n/g' -e 's/(\\par\n)/\\line\1/g' -e 's/\s*(Copyright)/\\line\n\1/g' -e 's/(\\par)\\line/\1\n/g' $input >> $target
"./TXT to RTF Converter.exe" "${LICENSE}"
cd "${CALLER_DIR}"
cat - >>$target <<_EOF
\par
}
_EOF