shithub: mkweb

Download patch

ref: 9d48b7e5fcf840f710a7519800a3650fc7cf0aae
parent: 4d4867ed7731c7aa70855e0b62913f442d35628c
author: rodri <[email protected]>
date: Sat Jun 17 06:32:15 EDT 2023

md2html.awk now allows an image size spec.
added the cv thumbnail generator script.
minor improvements to the mkweb script.

--- /dev/null
+++ b/bin/gencvthumbs
@@ -1,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
--- a/bin/md2html.awk
+++ b/bin/md2html.awk
@@ -96,6 +96,19 @@
 	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 @@
 			}
 			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{
--- a/mkweb
+++ b/mkweb
@@ -35,14 +35,15 @@
 			for(d in $sections)
 				echo $site/$d/index.html
 		}
+		exit
 	case -s
 		if(~ $#2 0)
 			usage
-		buildsection $2
+		sections=`{walk -d $2 | grep -v $filter}
 	case -*
 		usage
 	}
-if not
-	for(d in $sections .){
-		buildsection $d
-	}
+
+for(d in $sections .){
+	buildsection $d
+}