From 6e26f377595377a6179328ffb45988820cd0f881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?linus=20bj=C3=B6rnstam?= Date: Wed, 1 Apr 2026 08:52:00 +0200 Subject: [PATCH] Changed name of rawhtml --- src/FibLib/Library.fs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/FibLib/Library.fs b/src/FibLib/Library.fs index fd5a9ef..2552581 100644 --- a/src/FibLib/Library.fs +++ b/src/FibLib/Library.fs @@ -12,7 +12,7 @@ open System.Collections.Generic module Ast = type InlineNode = | Text of string - | RawHtml of string + | RawText of string | Expr of code: string * result: string option | Element of tag: string * args: (string * string) list * children: InlineNode list @@ -29,7 +29,7 @@ module Ast = nodes |> List.map (function | Text t -> t - | RawHtml h -> h + | RawText h -> h | Element(tag, args, children) -> // Omvandla inre taggar till HTML let attrs = if args.IsEmpty then "" else " " + String.concat " " (List.map tupleToString args) @@ -248,7 +248,7 @@ module Execution = prelude.[n] metadata a (c |> List.map (transform metadata prelude eval)) | Element(n, a, c) -> Element(n, a, c |> List.map (transform metadata prelude eval)) - | Expr(c, _) -> RawHtml (eval.Evaluate c) + | Expr(c, _) -> RawText (eval.Evaluate c) | n -> n module HtmlPrinter = @@ -261,7 +261,7 @@ module HtmlPrinter = let rec renderInline = function | Text t -> WebUtility.HtmlEncode t - | RawHtml h -> h + | RawText h -> h | Element(t,a,c) when List.contains t voidElements -> sprintf "<%s %s />" t (renderAttributes a) | Element(t, a, c) -> sprintf "<%s %s>%s" t (renderAttributes a) (c |> List.map renderInline |> String.concat "") t | _ -> "" @@ -269,18 +269,18 @@ module HtmlPrinter = let render (header, blocks) = blocks |> List.map (function - | Paragraph [RawHtml html] -> + | Paragraph [RawText html] -> html // 2. (Frivillig) Mer robust guard om parsern råkar lämna kvar // blanksteg (Text " ") runt ditt @md-block i samma paragraf | Paragraph nodes when nodes |> List.forall (function - | RawHtml _ -> true + | RawText _ -> true | Text t when System.String.IsNullOrWhiteSpace(t) -> true | _ -> false) -> nodes - |> List.choose (function RawHtml h -> Some h | _ -> None) + |> List.choose (function RawText h -> Some h | _ -> None) |> String.concat "\n" | Paragraph c -> sprintf "

%s

" (c |> List.map renderInline |> String.concat "") | Section(l, _, c) -> sprintf "%s" l (c |> List.map renderInline |> String.concat "") l)