~aasg/nixexprs

ee2d3b5d2d3c35ff4c1768e676f0b980e1229871 — Aluísio Augusto Silva Gonçalves 10 months ago ed63f82
haunt: Add patch to restore raw HTML output

Need this for my blog so I can embed SVG directly in the page.

This is not a NixOS-specific patch, so I'll keep it (and others like it)
in a separate tree.
4 files changed, 36 insertions(+), 0 deletions(-)

M default.nix
A patches/haunt/default.nix
A patches/haunt/restore-raw.patch
A patches/overlay.nix
M default.nix => default.nix +1 -0
@@ 4,5 4,6 @@
  modules = import ./modules;
  overlays = {
    pkgs = import ./pkgs/overlay.nix;
    patches = import ./patches/overlay.nix;
  };
} // (import ./pkgs { inherit pkgs; })

A patches/haunt/default.nix => patches/haunt/default.nix +7 -0
@@ 0,0 1,7 @@
{ pkgs }:

{
  haunt = pkgs.haunt.overrideAttrs (oldAttrs: rec {
    patches = [ ./restore-raw.patch ];
  });
}

A patches/haunt/restore-raw.patch => patches/haunt/restore-raw.patch +23 -0
@@ 0,0 1,23 @@
commit a1fbc429bb6c1567e1b86695954105579b3d098c
Author: Aluísio Augusto Silva Gonçalves <aluisio@aasg.name>
Date:   Tue Jun 9 20:56:20 2020 -0300

    Revert "html: Remove 'raw' element type."

    This reverts commit 33702f3777a760ba8ae84088bf582b6953d4a256, for the
    sxml->html procedure only.

diff --git a/haunt/html.scm b/haunt/html.scm
index 5891cd0..31f16d0 100644
--- a/haunt/html.scm
+++ b/haunt/html.scm
@@ -112,6 +112,9 @@ list ATTRS and the child nodes in BODY."
     (() *unspecified*)
     (('doctype type)
      (doctype->html type port))
+    ;; Unescaped, raw HTML output.
+    (('raw html)
+     (display html port))
     (((? symbol? tag) ('@ attrs ...) body ...)
      (element->html tag attrs body port))
     (((? symbol? tag) body ...)

A patches/overlay.nix => patches/overlay.nix +5 -0
@@ 0,0 1,5 @@
self: super:
let
  patches = [ ./haunt ];
in
builtins.foldl' (set: path: set // (import path { pkgs = (super // set); })) { } patches