error handling!!
This commit is contained in:
parent
a17d82f996
commit
a4faf2f38c
6 changed files with 53 additions and 13 deletions
|
@ -13,6 +13,8 @@
|
|||
layoutSrc,
|
||||
# otherwise set by frontmatter
|
||||
defaultLayout ? "default.html",
|
||||
|
||||
allowFailedRenders ? true,
|
||||
}: let
|
||||
markdoll = "${markdollParser}/bin/markdoll";
|
||||
in pkgs.stdenvNoCC.mkDerivation {
|
||||
|
@ -72,15 +74,15 @@ in pkgs.stdenvNoCC.mkDerivation {
|
|||
### Frontmatter: Meta Head Stuff
|
||||
local head=""
|
||||
local meta_description=$(get_frontmatter description $file)
|
||||
if [ ! -z meta_description ]; then
|
||||
if [ ! -z "$meta_description" ]; then
|
||||
head="$head<meta name='description' content='$meta_description'>"
|
||||
fi
|
||||
local meta_tags=$(get_frontmatter tags $file)
|
||||
if [ ! -z meta_tags ]; then
|
||||
if [ ! -z "$meta_tags" ]; then
|
||||
head="$head<meta name='keywords' content='$meta_tags'>"
|
||||
fi
|
||||
local meta_author=$(get_frontmatter author $file)
|
||||
if [ ! -z meta_author ]; then
|
||||
if [ ! -z "$meta_author" ]; then
|
||||
head="$head<meta name='author' content='$meta_author'>"
|
||||
fi
|
||||
|
||||
|
@ -105,8 +107,16 @@ in pkgs.stdenvNoCC.mkDerivation {
|
|||
echo "reading $file; plopping $outFile"
|
||||
|
||||
### Markdoll: Convert
|
||||
local content=$(cat $file | ${markdoll} convert | tee $outFile.tmp.render)
|
||||
local content=$(cat $file | ${markdoll} convert 2>$outFile.tmp.convert-log | tee $outFile.tmp.render)
|
||||
|
||||
if [ -z "$content" ]; then
|
||||
echo "<pre style='padding: 1em; border: 1px solid red; width: fit-content;'>" >> $outFile.tmp.render
|
||||
echo "<b style='color: red;'>[teapot]: render failed, check build logs.</b>" >> $outFile.tmp.render
|
||||
echo "== build log ==" >> $outFile.tmp.render
|
||||
cat $outFile.tmp.convert-log >> $outFile.tmp.render
|
||||
echo "</pre>" >> $outFile.tmp.render
|
||||
fi
|
||||
|
||||
render_final $file $outFile $outFile.tmp.render
|
||||
done
|
||||
'';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue