diff options
author | rodri <rgl@antares-labs.eu> | 2023-06-17 10:32:15 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-06-17 10:32:15 +0000 |
commit | 9d48b7e5fcf840f710a7519800a3650fc7cf0aae (patch) | |
tree | 792aa5dc523ac505fdfd4a527cd6e07b41ae3bea /bin | |
parent | 4d4867ed7731c7aa70855e0b62913f442d35628c (diff) | |
download | mkweb-9d48b7e5fcf840f710a7519800a3650fc7cf0aae.tar.gz mkweb-9d48b7e5fcf840f710a7519800a3650fc7cf0aae.tar.bz2 mkweb-9d48b7e5fcf840f710a7519800a3650fc7cf0aae.zip |
md2html.awk now allows an image size spec.
added the cv thumbnail generator script.
minor improvements to the mkweb script.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/gencvthumbs | 9 | ||||
-rwxr-xr-x | bin/md2html.awk | 15 |
2 files changed, 24 insertions, 0 deletions
diff --git a/bin/gencvthumbs b/bin/gencvthumbs new file mode 100755 index 0000000..f3ec7ab --- /dev/null +++ b/bin/gencvthumbs @@ -0,0 +1,9 @@ +#!/bin/rc +files=(cv cv.es) + +for(f in $files) + cat <<EOF | gs -sDEVICE'='jpeg -dPDFFitPage'='true -dDEVICEWIDTHPOINTS'='232 -dDEVICEHEIGHTPOINTS'='300 -sOutputFile'='$f.jpeg $f.pdf + + +quit +EOF diff --git a/bin/md2html.awk b/bin/md2html.awk index 81d1241..053d128 100755 --- a/bin/md2html.awk +++ b/bin/md2html.awk @@ -96,6 +96,19 @@ function nextil(t) { if(tag == "!["){ if(!match(t2, /(\[.*\])|(\(.*\))/)) return t1 tag nextil(t2); + width = ""; + height = ""; + if(match(t2, /[ ]+[0-9]+%?x[0-9]+%?\]/)){ + match(t2, /[0-9]+%?x/); + width = substr(t2, RSTART, RLENGTH - 1); + if(!match(width, /%$/)) + width = width "px"; + match(t2, /x[0-9]+%?\]/); + height = substr(t2, RSTART + 1, RLENGTH - 2); + if(!match(height, /%$/)) + height = height "px"; + sub(/[ ]+[0-9]+%?x[0-9]+%?\]/, "]", t2); + } match(t2, /^[^\]]*/); alt = substr(t2, 1, RLENGTH); t2 = substr(t2, RLENGTH + 2); @@ -114,6 +127,8 @@ function nextil(t) { } if(match(url, /^<.*>$/)) url = substr(url, 2, RLENGTH - 2); + if(width != "" && height != "") + return t1 "<img src=\"" url "\" alt=\"" alt "\"" title " width=\"" width "\" height=\"" height "\" />" nextil(t2); return t1 "<img src=\"" url "\" alt=\"" alt "\"" title " />" nextil(t2); } else{ |