<commit_before>#lang scheme/base

(require "time.scm"
         "util.scm"
         "web-support.scm"
         (planet "uuid-v4.ss" ("zitterbewegung" "uuid-v4.plt" 1 0)))

(provide  atom-item
          atom-inc
          atom-wrapper

          rss-inc
          rss-wrapper
          rss-item
          rss-li)

(define (atom-inc feed-url)
  `(link ((rel "alternate") (type "application/atom+xml") (href ,feed-url))))

(define (atom-wrapper feed-title
                      feed-subtitle
                      feed-url
                      url
                      author-name
                      author-email
                      . body)
  (list-response #:type #"text/xml"
                 (list (raw-str "<?xml version=\"1.0\" encoding=\"utf-8\"?>")
                       `(feed ((xmlns "http://www.w3.org/2005/Atom"))
                              (title ,feed-title)
                              (subtitle ,feed-subtitle)
                              (link ((href ,feed-url) (rel "self")))
                              (link ((href ,url)))
                              (updated ,(atom-time-str (current-seconds))" ")
                              (author (name ,author-name)
                                      (email ,author-email))
                              (id ,(urn)) ,@body))))

(define (atom-item item-title item-link item-summary item-content)
  `(entry
    (title ,item-title)
    (link ((href ,item-link) (rel "self")))
    (id ,(urn))
    (updated ,(atom-time-str (current-seconds)))
    (summary ,item-summary)
    (content ,item-content)))

;;Rss autodiscovery feed include.
(define (rss-inc feed-url)
  `(link ((href ,feed-url) (rel "alternate") (type "application/rss+xml")
          (title "Sitewide RSS Feed"))))

;;Main wrapper function for rss 1.0
(define (rss-wrapper about
                     channel-title
                     channel-link
                     channel-description
                     channel-image
                     item-list
                     . body)
 (list-response #:type #"text/xml"
                 (list (raw-str "<?xml version=\"1.0\"?>")
                       `(rdf:RDF
                         ((xmlns "http://purl.org/rss/1.0/")
                          (xmlns:rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"))
                         (channel
                          ((rdf:about ,about))
                          (title ,channel-title)
                          (link ,channel-link)
                          (description
                          
                           ,channel-description)
                          (image ((rdf:resource ,channel-image)))
                          (items 
                                 (rdf:Seq  
                                  ,@item-list)))
                         ,@body))))
;;Rss list creator 
(define (rss-li resource-link)
  `(rdf:li ((resource ,resource-link))))

;;Creation of rss items
(define (rss-item rdf-about item-title item-link item-description)
  `(item
     ((rdf:about ,rdf-about))
     (title () ,item-title)
     (link () ,item-link)
     (description () ,item-description)))
;;Creation of rss textinput items
(define (rss-textinput about text-title text-description text-name text-link)
  `(textinput
    ((rdf:about ,about))
    (title () ,text-title)
    (description () ,text-description)
    (name () , text-name)
    (link () ,text-link)))<commit_msg>comment cleanup and some simple formatting cleanup<commit_after>#lang scheme/base

(require "time.scm"
         "util.scm"
         "web-support.scm"
         (planet "uuid-v4.ss" ("zitterbewegung" "uuid-v4.plt" 1 0)))

(provide  atom-item
          atom-inc
          atom-wrapper

          rss-inc
          rss-wrapper
          rss-item
          rss-li)

(define (atom-inc feed-url)
  `(link ((rel "alternate") (type "application/atom+xml") (href ,feed-url))))

(define (atom-wrapper feed-title
                      feed-subtitle
                      feed-url
                      url
                      author-name
                      author-email
                      . body)
  (list-response #:type #"text/xml"
                 (list (raw-str "<?xml version=\"1.0\" encoding=\"utf-8\"?>")
                       `(feed ((xmlns "http://www.w3.org/2005/Atom"))
                              (title ,feed-title)
                              (subtitle ,feed-subtitle)
                              (link ((href ,feed-url) (rel "self")))
                              (link ((href ,url)))
                              (updated ,(atom-time-str (current-seconds))" ")
                              (author (name ,author-name)
                                      (email ,author-email))
                              (id ,(urn)) ,@body))))

(define (atom-item item-title item-link item-summary item-content)
  `(entry
    (title ,item-title)
    (link ((href ,item-link) (rel "self")))
    (id ,(urn))
    (updated ,(atom-time-str (current-seconds)))
    (summary ,item-summary)
    (content ,item-content)))
;;
;; rss-inc
;;
;; Function to include the browser feed autodiscovery link in your page.
;;
(define (rss-inc feed-url)
  `(link ((href ,feed-url) (rel "alternate") (type "application/rss+xml")
          (title "Sitewide RSS Feed"))))

;;
;; rss-wrapper
;;
;; Main wrapper function to create an RSS 1.0 feed.
;;
(define (rss-wrapper about
                     channel-title
                     channel-link
                     channel-description
                     channel-image
                     item-list
                     . body)
  (list-response #:type #"text/xml"
                 (list (raw-str "<?xml version=\"1.0\"?>")
                       `(rdf:RDF
                         ((xmlns "http://purl.org/rss/1.0/")
                          (xmlns:rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"))
                         (channel
                          ((rdf:about ,about))
                          (title ,channel-title)
                          (link ,channel-link)
                          (description
                           ,channel-description)
                          (image ((rdf:resource ,channel-image)))
                          (items 
                           (rdf:Seq  
                            ,@item-list)))
                         ,@body))))

;;
;; rss-li
;;
;; RSS list element creator.
;;
(define (rss-li resource-link)
  `(rdf:li ((resource ,resource-link))))

;;
;; rss-item
;;
;; Creation of RSS items.
;;
(define (rss-item rdf-about item-title item-link item-description)
  `(item
     ((rdf:about ,rdf-about))
     (title () ,item-title)
     (link () ,item-link)
     (description () ,item-description)))

;;
;; rss-textinput
;;
;; Creation of RSS textinput items.
;;
(define (rss-textinput about text-title text-description text-name text-link)
  `(textinput
    ((rdf:about ,about))
    (title () ,text-title)
    (description () ,text-description)
    (name () , text-name)
    (link () ,text-link)))
{'fraction_non_alphanumeric': 0.14348943460879499, 'fraction_numerical': 0.007709880068532267, 'mean_word_length': 1.3264696114247758, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 4, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4051678', 'n_tokens_mistral': 2062, 'n_tokens_neox': 1967, 'n_words': 437}