dot

packages and services management
Log | Files | Refs | README

commit 353256ecfe2f558a58ee6419df679d207ba268fb
parent bf4a73776b4d4b8c0fed15411fb3afd3bbc773ee
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon, 27 Nov 2017 16:01:20 +0100

gph-html to operate on a single file, like every other unix tools

Diffstat:
Mbin/gph-html | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/bin/gph-html b/bin/gph-html @@ -1,13 +1,16 @@ #!/bin/sh # convert all *.gph in current directory to html -HEAD='<!doctype html> +FILENAME="$(cd "${1%/*}" && pwd)/${1##*/}" + +cat << 'EOF' > "${FILENAME%.gph}.html" +<!doctype html> <link rel="stylesheet" href="/style.css" type="text/css"/> <link rel="icon" href="/favicon.png" type="image/png"/> <meta charset="utf-8"> -' +EOF -awk=' +awk ' function esc(str) { @@ -94,9 +97,5 @@ f[1] == "g" || f[1] == "I" { END { print("</pre>"); -}' - -find "$1" -name '*.gph' -exec sh -c ' - printf "%s\\n" '"'$HEAD'"' > "${0%.gph}.html" - awk '"'$awk'"' "$(cd "${0%/*}" && pwd)/${0##*/}" >> "${0%.gph}.html" -' {} ';' +} +' "$FILENAME" >> "${FILENAME%.gph}.html"