<commit_before>(in-package #:spinneret)

(defpackage #:spinneret.tag
  #+ccl (:use))

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter *tags-pkg* (find-package :spinneret.tag))

  (defun unsplice (x)
    (if x (list x) x))

  (defun tag-fn (tag &key intern)
    (let ((tag (string tag)))
      (if intern
          (intern tag *tags-pkg*)
          (find-symbol tag *tags-pkg*)))))

(defmacro define-tag (tag)
  (let* ((name
           (tag-fn tag :intern t))
         (newline-before-start
           (not (inline? name)))
         (newline-after-start
           (not (or (inline? name) (paragraph? name))))
         (newline-before-close
           newline-after-start)
         (open (format nil "<~(~A~)" name))
         (needs-close (not (or (void? name) (unmatched? name))))
         (close
           (when needs-close
             (format nil "</~(~A~)>" name))))
    `(progn
       (declaim (notinline ,name))
       (defun ,name (attrs body pre? empty?)
         (declare (optimize
                   (speed 3) (safety 0) (debug 0)<commit_msg>Use tag name for lookups.<commit_after>(in-package #:spinneret)

(defpackage #:spinneret.tag
  #+ccl (:use))

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter *tags-pkg* (find-package :spinneret.tag))

  (defun unsplice (x)
    (if x (list x) x))

  (defun tag-fn (tag &key intern)
    (let ((tag (string tag)))
      (if intern
          (intern tag *tags-pkg*)
          (find-symbol tag *tags-pkg*)))))

(defmacro define-tag (tag)
  (let* ((fn-name
           (tag-fn tag :intern t))
         (newline-before-start
           (not (inline? tag)))
         (newline-after-start
           (not (or (inline? tag) (paragraph? tag))))
         (newline-before-close
           newline-after-start)
         (open (format nil "<~(~A~)" tag))
         (needs-close (not (or (void? tag) (unmatched? tag))))
         (close
           (when needs-close
             (format nil "</~(~A~)>" tag))))
    `(progn
       (declaim (notinline ,fn-name))
       (defun ,fn-name (attrs body pre? empty?)
         (declare (optimize
                   (speed 3) (safety 0) (debug 0)
{'fraction_non_alphanumeric': 0.16712834718374883, 'fraction_numerical': 0.002770083102493075, 'mean_word_length': 2.1542940320232895, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2703744', 'n_tokens_mistral': 758, 'n_tokens_neox': 726, 'n_words': 199}