<commit_before>(in-package #:org.gingeralesy.web.comic-reader)

(define-page index #@"comic/" (:lquery (template "main.ctml"))
  "The front page of the site."
  (r-clip:process T))

(define-page comic #@"comic/comic(/([a-zA-Z]+))?(/([0-9]+))?" (:uri-groups (NIL comic-path NIL page-number)
                                                               :lquery (template "comic.ctml"))
  "The web page for displaying a web comic page."
  (let* ((comic (or (comic :path comic-path)
                    (error 'request-not-found :message "Invalid comic requested.")))
         (page (or (page (dm:field comic '_id) :page-number (when (or* page-number) (parse-integer page-number :junk-allowed T)))
                   (error 'request-not-found :message "Comic page does not exist."))))
    (r-clip:process
     T
     :comic-id (dm:field comic '_id)
     :page-number (dm:field page 'page-number))))

(define-api comic/page (comic-id page-number) ()
  "API interface for getting metadata for a comic page."
  (case (http-method *request*)
    (:get
     (let* ((comic (comic :id (when (or* comic-id) (parse-integer comic-id :junk-allowed T))))
            (page-number (when (or* page-number) (parse-integer page-number :junk-allowed T)))
            (page (page (dm:field comic '_id) :page-number page-number)))
       (unless (and page (<= (dm:field page 'publish-time) (get-universal-time)))
         (error 'request-not-found :message "Comic page does not exist."))
       (api-output page)))
    (T (wrong-method-error (http-method *request*)))))<commit_msg>Set to pass comic and page collections to clip<commit_after>(in-package #:org.gingeralesy.web.comic-reader)

(define-page index #@"comic/" (:lquery (template "main.ctml"))
  "The front page of the site."
  (r-clip:process T))

(define-page comic #@"comic/comic(/([a-zA-Z]+))?(/([0-9]+))?" (:uri-groups (NIL comic-path NIL page-number)
                                                               :lquery (template "comic.ctml"))
  "The web page for displaying a web comic page."
  (let* ((comic (or (comic :path comic-path)
                    (error 'request-not-found :message "Invalid comic requested.")))
         (page (or (page (dm:field comic '_id) :page-number (when (or* page-number) (parse-integer page-number :junk-allowed T)))
                   (error 'request-not-found :message "Comic page does not exist."))))
    (r-clip:process
     T
     :comic comic
     :page page)))

(define-api comic/page (comic-id page-number) ()
  "API interface for getting metadata for a comic page."
  (case (http-method *request*)
    (:get
     (let* ((comic (comic :id (when (or* comic-id) (parse-integer comic-id :junk-allowed T))))
            (page-number (when (or* page-number) (parse-integer page-number :junk-allowed T)))
            (page (page (dm:field comic '_id) :page-number page-number)))
       (unless (and page (<= (dm:field page 'publish-time) (get-universal-time)))
         (error 'request-not-found :message "Comic page does not exist."))
       (api-output page)))
    (T (wrong-method-error (http-method *request*)))))
{'fraction_non_alphanumeric': 0.16661295520464067, 'fraction_numerical': 0.0012890750886239124, 'mean_word_length': 2.730769230769231, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4372292', 'n_tokens_mistral': 1004, 'n_tokens_neox': 979, 'n_words': 291}