<commit_before>;;; -*- Gerbil -*-
;;; (C) vyzo at hackzen.org
;;; sxml-to-xml printer
package: std/xml

(import :std/xml/sxml-to-xml)
(export print-sxml->html
        print-sxml->html*
        print-sxml->html-fast
        print-sxml->xhtml
        print-sxml->xhtml*
        print-sxml->xhtml-fast
        print-sxml->xml
        print-sxml->xml*
        print-sxml->xml-fast
        pretty-print-sxml->xml-file
        pretty-print-sxml->xhtml-file
        sxml->html-string-fragment
        sxml->xhtml-string
        )

(defrules defproc ()                    ; see through *TOP*
  ((_ proc sxml-to-xml-proc)
   (def (proc tree)
     (sxml-to-xml-proc (cadr tree)))))

(defproc print-sxml->html       sxml>>html)
(defproc print-sxml->html*      sxml>>html*)
(defproc print-sxml->html-fast  sxml>>html-fast)
(defproc print-sxml->xhtml      sxml>>xhtml)
(defproc print-sxml->xhtml*     sxml>>xhtml*)
(defproc print-sxml->xhtml-fast sxml>>xhtml-fast)
(defproc print-sxml->xml        sxml>>xml)
(defproc print-sxml->xml*       sxml>>xml*)
(defproc print-sxml->xml-fast   sxml>>xml-fast)
(defproc pretty-print-sxml->xml-file   sxml>>pretty-xml-file)
(defproc pretty-print-sxml->xhtml-file sxml>>pretty-xhtml-file)<commit_msg>std/xml/print: write-html, write-xml, fix print-* prototypes to accept port<commit_after>;;; -*- Gerbil -*-
;;; (C) vyzo at hackzen.org
;;; sxml-to-xml printer
package: std/xml

(import :std/xml/sxml-to-xml)
(export write-xml write-html
        print-sxml->html
        print-sxml->html*
        print-sxml->html-fast
        print-sxml->xhtml
        print-sxml->xhtml*
        print-sxml->xhtml-fast
        print-sxml->xml
        print-sxml->xml*
        print-sxml->xml-fast
        pretty-print-sxml->xml-file
        pretty-print-sxml->xhtml-file
        sxml->html-string-fragment
        sxml->xhtml-string
        )

(defrules defproc ()                    ; see through *TOP*
  ((_ proc sxml-to-xml-proc)
   (def (proc sxml (port (current-output-port)))
     (sxml-to-xml-proc (cadr sxml) port))))

(defproc print-sxml->html       sxml>>html)
(defproc print-sxml->html*      sxml>>html*)
(defproc print-sxml->html-fast  sxml>>html-fast)
(defproc print-sxml->xhtml      sxml>>xhtml)
(defproc print-sxml->xhtml*     sxml>>xhtml*)
(defproc print-sxml->xhtml-fast sxml>>xhtml-fast)
(defproc print-sxml->xml        sxml>>xml)
(defproc print-sxml->xml*       sxml>>xml*)
(defproc print-sxml->xml-fast   sxml>>xml-fast)
(defproc pretty-print-sxml->xml-file   sxml>>pretty-xml-file)
(defproc pretty-print-sxml->xhtml-file sxml>>pretty-xhtml-file)

(def (write-xml sxml (port (current-output-port)))
  (sxml>>xml-fast (cadr sxml) port))

(def (write-html sxml (port (current-output-port)))
  (sxml>>html-fast (cadr sxml) port))
{'fraction_non_alphanumeric': 0.16890664729386123, 'fraction_numerical': 0.0, 'mean_word_length': 2.6966442953020135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 127}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4471921', 'n_tokens_mistral': 1039, 'n_tokens_neox': 1005, 'n_words': 174}