Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 40ants-doc.asd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@


(asdf:register-system-packages "common-html" '("COMMON-HTML.EMITTER"))
(asdf:register-system-packages "common-doc" '("COMMON-DOC.OPS"
"COMMON-DOC.FORMAT"))

(asdf:register-system-packages "log4cl" '("LOG"))

(asdf:register-system-packages "3bmd-ext-code-blocks" '("3BMD-CODE-BLOCKS"))

Expand Down
4 changes: 1 addition & 3 deletions src/args.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
(defpackage #:40ants-doc/args
(:use #:cl)
(:import-from #:40ants-doc/page)
(:import-from #:40ants-doc/reference))
(:use #:cl))
(in-package 40ants-doc/args)


Expand Down
32 changes: 19 additions & 13 deletions src/builder.lisp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
(uiop:define-package #:40ants-doc/builder
(:use #:cl)
(:import-from #:dexador)
(:import-from #:alexandria
#:assoc-value)
;; NO LINT
(:import-from #:3bmd)
;; NO LINT
(:import-from #:3bmd-code-blocks)
(:import-from #:named-readtables)
(:import-from #:pythonic-string-reader)
Expand All @@ -12,7 +11,6 @@
(:import-from #:40ants-doc/page
#:page-base-dir
#:page-format)
(:import-from #:40ants-doc/utils)
(:import-from #:40ants-doc/builder/printer)
(:import-from #:40ants-doc
#:defsection)
Expand All @@ -25,12 +23,24 @@
(:import-from #:40ants-doc/search)
(:import-from #:40ants-doc/commondoc/transcribe)
(:import-from #:40ants-doc/changelog)
(:import-from #:40ants-doc/commondoc/changelog)
(:import-from #:40ants-doc/commondoc/section)
(:import-from #:40ants-doc/commondoc/xref)
(:import-from #:40ants-doc/commondoc/image)
(:import-from #:40ants-doc/reference
#:make-external-reference)
(:import-from #:40ants-doc/external-index
#:write-references-index)
(:import-from #:40ants-doc/commondoc/reference)
(:import-from #:40ants-doc/commondoc/builder
#:to-commondoc)
(:import-from #:40ants-doc/link)
(:import-from #:40ants-doc/rewrite)
(:import-from #:40ants-doc/themes/api)
(:import-from #:common-doc)
(:import-from #:common-doc.format)
(:import-from #:common-html)
(:import-from #:common-html.emitter)
(:import-from #:commondoc-markdown)

(:export
#:*document-html-top-blocks-of-links*
#:*document-html-bottom-blocks-of-links*
Expand Down Expand Up @@ -238,10 +248,8 @@
(40ants-doc/reference-api:*source-uri-fn* source-uri-fn))

(40ants-doc/commondoc/format:with-format (format)
(let* ((document
(40ants-doc/commondoc/builder:to-commondoc object))
(processed-document
(process-document document))
(let* ((document (to-commondoc object))
(processed-document (process-document document))
(40ants-doc/builder/printer::*full-package-names* full-package-names))
(with-output-to-string (stream)
(common-doc.format:emit-document (make-instance format)
Expand Down Expand Up @@ -328,9 +336,7 @@
(40ants-doc/themes/api::with-theme (theme)
(let* ((sections (uiop:ensure-list sections))
(pages (mapcar #'40ants-doc/page:ensure-page sections))
(page-documents (mapcar
#'40ants-doc/commondoc/builder:to-commondoc
pages)))
(page-documents (mapcar #'to-commondoc pages)))
(multiple-value-bind (full-document references)
(process-document (common-doc:make-document "Documentation"
:children page-documents)
Expand Down
3 changes: 0 additions & 3 deletions src/builder/printer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
(:use #:cl)
(:import-from #:named-readtables)
(:import-from #:pythonic-string-reader)
(:import-from #:40ants-doc/utils)
(:import-from #:40ants-doc/core
#:defsection)
(:export #:*document-uppercase-is-code*))
(in-package 40ants-doc/builder/printer)

Expand Down
2 changes: 2 additions & 0 deletions src/commondoc/arglist.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(uiop:define-package #:40ants-doc/commondoc/arglist
(:use #:cl)
(:import-from #:common-doc)
(:import-from #:common-doc.format)
(:import-from #:common-html.emitter)
(:import-from #:commondoc-markdown)
(:import-from #:spinneret
#:with-html)
(:import-from #:40ants-doc/utils
Expand Down
2 changes: 1 addition & 1 deletion src/commondoc/builder.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
(:use #:cl)
(:import-from #:40ants-doc/commondoc/markdown
#:parse-markdown)
(:import-from #:40ants-doc/utils)
(:import-from #:40ants-doc/object-package)
(:import-from #:40ants-doc/docstring)
(:import-from #:40ants-doc/reference)
(:export #:to-commondoc
#:reference-to-commondoc))
(in-package 40ants-doc/commondoc/builder)
Expand Down
12 changes: 9 additions & 3 deletions src/commondoc/bullet.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
#:with-tag)
(:import-from #:40ants-doc/render/args
#:arglist-to-string)
(:import-from #:common-doc)
(:import-from #:spinneret)
(:import-from #:40ants-doc/commondoc/arglist)
(:import-from #:40ants-doc/reference)
(:import-from #:40ants-doc/reference-api)
(:import-from #:40ants-doc/ignored-words
#:ignored-words)
(:import-from #:40ants-doc/dislocated-symbols
Expand All @@ -25,6 +29,8 @@
(:import-from #:commondoc-markdown/emitter
#:hash-link)
(:import-from #:40ants-doc/builder/printer)
(:import-from #:common-doc.format
#:emit-document)
(:export
#:make-bullet))
(in-package 40ants-doc/commondoc/bullet)
Expand Down Expand Up @@ -150,9 +156,9 @@
(common-doc::children obj))))))))


(defmethod common-doc.format:emit-document ((format commondoc-markdown:markdown)
(node bullet)
stream)
(defmethod emit-document ((format commondoc-markdown:markdown)
(node bullet)
stream)
(let* ((reference (doc-reference node))
(arglists (bullet-arglist node))
(locative-type (string-downcase
Expand Down
4 changes: 4 additions & 0 deletions src/commondoc/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
(:import-from #:40ants-doc/changelog)
(:import-from #:alexandria
#:when-let)
(:import-from #:common-html)
(:import-from #:common-doc)
(:import-from #:common-doc.ops)
(:import-from #:common-doc.format)
(:import-from #:local-time
#:parse-timestring
#:format-rfc1123-timestring)
Expand Down
2 changes: 2 additions & 0 deletions src/commondoc/format.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(uiop:define-package #:40ants-doc/commondoc/format
(:use #:cl)
(:import-from #:common-html)
(:import-from #:commondoc-markdown)
(:export #:with-format
#:current-files-extension
#:files-extension
Expand Down
8 changes: 6 additions & 2 deletions src/commondoc/image.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
(:import-from #:common-html.emitter
#:define-emitter)
(:import-from #:str)
(:import-from #:log)
(:import-from #:common-doc)
(:import-from #:40ants-doc/commondoc/html
#:with-html)
(:import-from #:40ants-doc/commondoc/page
Expand All @@ -12,7 +14,9 @@
(:import-from #:cl-ppcre
#:do-register-groups)
(:import-from #:40ants-doc/builder/vars
#:*current-asdf-system*))
#:*current-asdf-system*)
(:import-from #:40ants-doc/commondoc/mapper
#:map-nodes))
(in-package 40ants-doc/commondoc/image)

(defclass local-image (common-doc:image)
Expand Down Expand Up @@ -54,7 +58,7 @@
:width width
:height height)))))
(t node))))
(40ants-doc/commondoc/mapper:map-nodes document #'replacer)))
(map-nodes document #'replacer)))

(defun extract-width-and-height (path)
"Returns 3 values, real path, width and height. Width and height might be NIL.
Expand Down
5 changes: 4 additions & 1 deletion src/commondoc/mapper.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
(defpackage #:40ants-doc/commondoc/mapper
(:use #:cl)
(:import-from #:common-doc)
(:import-from #:common-doc.ops)
(:import-from #:40ants-doc/commondoc/bullet)
(:import-from #:40ants-doc/object-package
#:object-package)
(:export
#:map-nodes
#:node-supports-children
Expand Down Expand Up @@ -37,7 +40,7 @@
(defun call-with-node-package (func)
(let ((packages-stack nil))
(flet ((set-package (node)
(let ((package (or (40ants-doc/object-package::object-package node)
(let ((package (or (object-package node)
*package*)))
(push *package* packages-stack)
(setf *package* package)))
Expand Down
16 changes: 11 additions & 5 deletions src/commondoc/markdown.lisp
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
(uiop:define-package #:40ants-doc/commondoc/markdown
(:use #:cl)
(:import-from #:commondoc-markdown)
(:import-from #:str)
(:import-from #:commondoc-markdown
#:markdown-link)
(:import-from #:common-doc)
(:import-from #:common-doc.ops)
(:import-from #:common-doc.format)
(:import-from #:40ants-doc/commondoc/xref)
(:import-from #:40ants-doc/commondoc/mapper
#:node-supports-children)
(:import-from #:40ants-doc/swank
#:read-locative-from-string)
(:export
#:parse-markdown))
(in-package 40ants-doc/commondoc/markdown)
Expand All @@ -31,15 +37,15 @@
"Replaces unresolved markdown nodes with XREF objects."
(flet ((replacer (node)
(cond
((typep node 'commondoc-markdown::markdown-link)
((typep node 'markdown-link)
(let* ((children (common-doc:children node)))

(let* ((text (common-doc.ops:collect-all-text children))
(symbol (40ants-doc/swank::read-locative-from-string text))
(symbol (read-locative-from-string text))
(locative-name (commondoc-markdown:markdown-link-definition node))
(locative (when locative-name
(40ants-doc/swank::read-locative-from-string locative-name
:package (find-package "40ANTS-DOC/LOCATIVES")))))
(read-locative-from-string locative-name
:package (find-package "40ANTS-DOC/LOCATIVES")))))
(40ants-doc/commondoc/xref:make-xref text
:symbol symbol
:locative locative))))
Expand Down
10 changes: 6 additions & 4 deletions src/commondoc/page.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
#:make-code
#:make-text
#:make-web-link)
(:import-from #:common-doc.ops)
(:import-from #:str)
(:import-from #:common-html.emitter)
(:import-from #:40ants-doc/commondoc/xref)
(:import-from #:40ants-doc/locatives)
(:import-from #:40ants-doc/reference)
(:import-from #:common-html)
(:import-from #:40ants-doc/commondoc/html
#:with-html)
(:import-from #:common-html.emitter
#:define-emitter)
(:import-from #:40ants-doc/commondoc/bullet)
(:import-from #:40ants-doc/commondoc/section
#:documentation-section
#:section-definition)
(:import-from #:40ants-doc/reference-api)
(:import-from #:40ants-doc/commondoc/mapper
#:current-path
#:with-node-path)
Expand Down Expand Up @@ -44,8 +48,6 @@
#:supports-dislocated-symbols-p)
(:import-from #:40ants-doc/themes/api
#:with-page-template)
(:import-from #:alexandria
#:when-let)
(:import-from #:40ants-doc
#:section-external-docs)
(:export #:make-page
Expand Down
1 change: 0 additions & 1 deletion src/commondoc/piece.lisp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(uiop:define-package #:40ants-doc/commondoc/piece
(:use #:cl)
(:import-from #:40ants-doc/utils)
(:import-from #:40ants-doc/reference)
(:import-from #:40ants-doc/object-package))
(in-package 40ants-doc/commondoc/piece)
Expand Down
8 changes: 5 additions & 3 deletions src/commondoc/reference.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
(:import-from #:40ants-doc/commondoc/page
#:page)
(:import-from #:40ants-doc/reference
#:reference=))
#:reference=)
(:import-from #:40ants-doc/commondoc/mapper
#:map-nodes))
(in-package 40ants-doc/commondoc/reference)


Expand Down Expand Up @@ -52,7 +54,7 @@
:key #'car
:test #'reference=)))
node))
(40ants-doc/commondoc/mapper:map-nodes node #'collector
:on-going-down #'track-page))
(map-nodes node #'collector
:on-going-down #'track-page))

results)
23 changes: 17 additions & 6 deletions src/commondoc/section.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
(:use #:cl)
(:import-from #:40ants-doc)
(:import-from #:common-doc)
(:import-from #:common-doc.ops)
(:import-from #:common-doc.format)
(:import-from #:commondoc-markdown)
(:import-from #:40ants-doc/commondoc/html
#:with-html)
(:import-from #:common-html.emitter
Expand All @@ -25,6 +28,14 @@
#:reference-object)
(:import-from #:40ants-doc/object-package
#:object-package)
(:import-from #:40ants-doc/commondoc/builder
#:to-commondoc)
(:import-from #:40ants-doc/commondoc/mapper
#:map-nodes)
(:import-from #:40ants-doc/reference-api
#:canonical-reference)
(:import-from #:str
#:param-case)
(:export
#:documentation-section
#:section-definition
Expand All @@ -46,7 +57,7 @@

(defun make-section-body (section)
(loop for entry in (40ants-doc:section-entries section)
collect (40ants-doc/commondoc/builder:to-commondoc entry)))
collect (to-commondoc entry)))


(defun make-section-with-reference (title children reference)
Expand Down Expand Up @@ -76,13 +87,13 @@
title-text)))
(children (make-section-body section)))

(let* ((reference (40ants-doc/reference-api::canonical-reference section))
(let* ((reference (canonical-reference section))
(html-fragment (40ants-doc/utils::html-safe-name
(40ants-doc/reference::reference-to-anchor reference))))

(make-instance class-name
:definition section
:doc-reference (40ants-doc/reference-api::canonical-reference
:doc-reference (canonical-reference
section)
:title title
:reference html-fragment
Expand All @@ -98,7 +109,7 @@
(40ants-doc::section-ignore-words definition)))


(defmethod 40ants-doc/commondoc/builder:to-commondoc ((obj 40ants-doc:section))
(defmethod to-commondoc ((obj 40ants-doc:section))
(make-documentation-section obj))


Expand Down Expand Up @@ -150,8 +161,8 @@
(not (common-doc:reference node)))
(let* ((title (common-doc:title node))
(text (common-doc.ops:collect-all-text title))
(reference (str:param-case text)))
(reference (param-case text)))
(setf (common-doc:reference node)
reference)))
node))
(40ants-doc/commondoc/mapper:map-nodes document #'fill-fragments)))
(map-nodes document #'fill-fragments)))
Loading