25 lines
506 B
Bash
25 lines
506 B
Bash
#!/bin/sh
|
|
set -e
|
|
command -v cmark >/dev/null || (echo "cmark: command not found" >&2 && exit 1)
|
|
test -n "$2" || (echo "Usage: $0 \"Document title\" filename1 [filename2...]" >&2 && exit 1)
|
|
cat << __EOF__
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>$1</title>
|
|
<style>
|
|
body {
|
|
font-family: sans-serif;
|
|
width: 26cm;
|
|
margin: auto;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
__EOF__
|
|
shift # Drop the first argument (document title).
|
|
cmark --to html --nobreaks --unsafe --smart --validate-utf8 $*
|
|
cat << __EOF__
|
|
</body>
|
|
</html>
|
|
__EOF__
|