ocaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix compiler expansion for hashtag-like strings

`#abc` was rendered as `abc`, now rendered as is.

The fix applies to all clients.

Closes: https://todo.sr.ht/~jonsterling/forester/188

authored by

utensil and committed by
Jon Sterling
63fbae60 46821e0c

+11 -1
+3 -1
lib/compiler/Expand.ml
··· 41 41 | node :: rest -> 42 42 entered_range node.loc; 43 43 match node.value with 44 - | Hash_ident x | Text x -> 44 + | Hash_ident x -> 45 + {node with value = Text ("#" ^ x)} :: expand_eff ~forest rest 46 + | Text x -> 45 47 {node with value = Text x} :: expand_eff ~forest rest 46 48 | Verbatim x -> 47 49 {node with value = Verbatim x} :: expand_eff ~forest rest
+1
lib/frontend/DSL.ml
··· 96 96 let braces = Fun.compose (locate_opt None) @@ Code.braces 97 97 98 98 let ident i = locate_opt None @@ Ident i 99 + let hash_ident str = locate_opt None @@ Hash_ident str 99 100 100 101 let ul = ident ["ul"] 101 102 let li = ident ["li"]
+7
lib/parser/test/Test_parser.ml
··· 108 108 ) 109 109 (parse_string_no_loc {|##{a^2 + b^2 = c^2}|}) 110 110 111 + let test_hashtag () = 112 + Alcotest.(check @@ result code diagnostic) 113 + "same nodes" 114 + (Ok [hash_ident "abc"]) 115 + (parse_string_no_loc {|#abc|}) 116 + 111 117 let test_object () = 112 118 Alcotest.(check @@ result code diagnostic) 113 119 "same nodes" ··· 144 150 "text", [test_case "text" `Quick test_prim]; 145 151 "verbatim", [test_case "verbatim" `Quick test_verbatim]; 146 152 "math", [test_case "math" `Quick test_math]; 153 + "hashtag", [test_case "hashtag" `Quick test_hashtag]; 147 154 "object", [test_case "object" `Quick test_object]; 148 155 ]