]> gitweb.factorcode.org Git - factor.git/commitdiff
tldr: replace args syntax
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 21 Jan 2023 00:40:24 +0000 (16:40 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 21 Jan 2023 00:56:10 +0000 (16:56 -0800)
extra/tldr/tldr.factor

index fce51b8fb8fa767aeda76e910a6d0aca59c0491a..5490da0e961080755ca4d1eabef9415e9cc18d90 100644 (file)
@@ -3,8 +3,8 @@
 
 USING: assocs combinators command-line http.client io
 io.directories io.encodings.utf8 io.files io.files.temp
-io.launcher io.pathnames json.reader kernel namespaces sequences
-splitting system urls wrap.strings ;
+io.launcher io.pathnames json.reader kernel namespaces regexp
+sequences splitting system urls wrap.strings ;
 
 IN: tldr
 
@@ -58,7 +58,9 @@ PRIVATE>
 : tldr. ( name -- )
     tldr [
         { "`" "    " } [ ?head ] any? [
-            "`" ?tail drop 76 "  " wrap-indented-string
+            "`" ?tail drop
+            R/ \{\{[^}]+\}\}/ [ 2 tail 2 head* ] re-replace-with
+            76 "  " wrap-indented-string
         ] [
             { "# " "= " "> " "- " } [ ?head ] any? drop
             76 wrap-string