]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/html/parser/parser.factor
html.parser: Strip trailing slashes / in html tags. Add unit test. Fixes #1233.
[factor.git] / extra / html / parser / parser.factor
index f31aaba698933e074544ff4884c1b157e3d2b0df..3b42e1b0921d94c66d5973d6634a29ae18d8ae08 100644 (file)
@@ -75,8 +75,10 @@ SYMBOL: tagstack
     [ advance advance read-comment ] [ read-dtd ] if ;
 
 : read-tag ( sequence-parser -- string )
-    [ [ current "><" member? ] take-until ]
-    [ dup current CHAR: < = [ advance ] unless drop ] bi ;
+    [
+        [ current "><" member? ] take-until
+        [ CHAR: / = ] trim-tail
+    ] [ dup current CHAR: < = [ advance ] unless drop ] bi ;
 
 : read-until-< ( sequence-parser -- string )
     [ current CHAR: < = ] take-until ;