feat(tvl/template): support markdown via cheddar
Since the template already was a derivation we can just reimplement a specialized writeText which runs cheddar on parts of its input to avoid import from derivation. Change-Id: I0cffd0e86fd23a749599174260d04269379f4b5f Reviewed-on: https://cl.tvl.fyi/c/depot/+/3114 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
513e733f8a
commit
25ff41452b
1 changed files with 29 additions and 19 deletions
|
|
@ -11,12 +11,14 @@
|
|||
}@args:
|
||||
|
||||
let
|
||||
inherit (pkgs) writeText lib;
|
||||
inherit (pkgs) runCommandNoCC lib;
|
||||
inherit (depot.tools) cheddar;
|
||||
|
||||
baseUrl = lib.optionalString useUrls "https://tvl.fyi";
|
||||
in
|
||||
|
||||
writeText "index.html" (''
|
||||
runCommandNoCC "index.html" {
|
||||
headerPart = ''
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
|
@ -32,9 +34,11 @@ writeText "index.html" (''
|
|||
<h1><a class="blog-title" href="/">${title}</a> </h1>
|
||||
<hr>
|
||||
</header>
|
||||
'';
|
||||
|
||||
${content}
|
||||
inherit content;
|
||||
|
||||
footerPart = ''
|
||||
<hr>
|
||||
<footer>
|
||||
<p class="footer">
|
||||
|
|
@ -51,4 +55,10 @@ writeText "index.html" (''
|
|||
<p class="lod">ಠ_ಠ</p>
|
||||
</footer>
|
||||
</body>
|
||||
'')
|
||||
'';
|
||||
|
||||
passAsFile = [ "headerPart" "content" "footerPart" ];
|
||||
} ''
|
||||
${cheddar}/bin/cheddar --about-filter content.md < $contentPath > rendered.html
|
||||
cat $headerPartPath rendered.html $footerPartPath > $out
|
||||
''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue