commit - 588b55fbdbdb143bad22870345f7d91d8e7b7bf5
commit + 4800325e843eb78d81f26caa2e281fd33257405c
blob - 564a9499b29181fc2547d366882a4af7c680f7a7
blob + 94de3e9649d71506720e08bfbbc32011c1ab3138
--- gemtext.lisp
+++ gemtext.lisp
(in-package #:phos/gemtext)
(defclass element ()
- ((text :initarg :text
- :initform "")))
+ ((text :initform ""
+ :initarg :text
+ :accessor text
+ :type string)))
(defclass title (element)
- ((level :initarg :level)))
+ ((level :initarg :level
+ :accessor level
+ :type integer
+ :documentation "The nesting level of the title.
+Synonymous to the HTML heading levels, i.e. level 1 is <h1> tag, level 2 is <h2> tag etc.")))
+
(defclass link (element)
- ((url :initarg :url)))
+ ((url :initform nil
+ :initarg :url
+ :accessor url
+ :type (or null string))))
(defclass item (element)
())
())
(defclass verbatim (element)
- ((alt :initarg :alt)))
+ ((alt :initform nil
+ :initarg :alt
+ :accessor alt
+ :type (or null string)
+ :documentation "The alternative text for the verbatim block.
+Is usually put at the same line as the opening backquotes.
+
+Can be a programming language name or alternative text for, e.g., ASCII art.")))
+
+(defun element-p (element) (typep element 'element))
+(defun title-p (title) (typep title 'title))
+(defun link-p (link) (typep link 'link))
+(defun item-p (item) (typep item 'item))
+(defun paragraph-p (paragraph) (typep paragraph 'paragraph))
+(defun blockquote-p (blockquote) (typep blockquote 'blockquote))
+(defun verbatim-p (verbatim) (typep verbatim 'verbatim))
+
+
(defun make-link (url &optional text)
(make-instance 'link :url (quri:uri url)
:text text))
blob - b040249f5068643784924c935564d691b1afd7b4
blob + 5e7d00632ccd96b9f5c3965433a154c3c58cc3c2
--- package.lisp
+++ package.lisp
(:nicknames :gemtext)
(:use #:cl #:trivia)
(:export :element :title :link :item :blockquote :paragraph :verbatim
+ :element-p :title-p :link-p :item-p :blockquote-p :paragraph-p :verbatim-p
:text :url :alt :level
:parse :parse-string :unparse :line-eq))