Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Antoine Martin
quickref
Commits
6b7e26b0
Commit
6b7e26b0
authored
Mar 18, 2018
by
Didier Verna
Browse files
Copyright and headers/footers in all Lisp files, prettify.
parent
f8ef0d2c
Changes
6
Hide whitespace changes
Inline
Side-by-side
file.lisp
View file @
6b7e26b0
;;; file.lisp --- Additional file utilities
;; Copyright (C) 2018 EPITA Research and Development Laboratory
;; Author: Antoine Martin <antoine4.martin@epita.fr>
;; This file is part of Quickref.
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;; Code:
(
in-package
:quickref
)
(
defparameter
*quickref-basedir*
(
user-homedir-pathname
))
(
defun
from-quickref-dir
(
relative-path
)
...
...
@@ -22,32 +46,32 @@
(
defun
get-directory-list
(
path
)
(
loop
for
dir
in
(
directory
(
all-directories
path
))
collect
(
car
(
last
(
pathname-directory
dir
)))))
collect
(
car
(
last
(
pathname-directory
dir
)))))
(
defun
get-file-list
(
path
)
(
loop
for
file
in
(
directory
(
all-files
path
))
nconc
(
if
(
string=
(
pathname-name
file
)
"index"
)
nil
(
list
(
pathname-name
file
)))))
nconc
(
if
(
string=
(
pathname-name
file
)
"index"
)
nil
(
list
(
pathname-name
file
)))))
(
defun
get-texi-pathnames
()
(
loop
for
pathname
in
(
directory
(
all-files
(
from-quickref-dir
"texis/"
)))
collect
pathname
))
collect
pathname
))
(
defun
clean-or-create
(
directory
)
(
if
(
probe-file
directory
)
(
clean-directory
directory
)
(
ensure-directories-exist
directory
)))
(
clean-directory
directory
)
(
ensure-directories-exist
directory
)))
(
defun
log-texi-error
(
err
texi
)
(
let
((
filepathname
(
from-quickref-dir
(
format
nil
"logs/makeinfo/~A.log"
(
pathname-name
texi
)))))
(
pathname-name
texi
)))))
(
with-open-file
(
file
filepathname
:direction
:output
:if-exists
:supersede
:if-does-not-exist
:create
)
:direction
:output
:if-exists
:supersede
:if-does-not-exist
:create
)
(
format
file
err
))))
(
defun
setup-quickref-dir
(
&key
declt
makeinfo
)
...
...
@@ -61,8 +85,8 @@
(
defun
find-readme
(
release-name
)
(
let*
((
release
(
ql-dist:find-release
release-name
))
(
asd-file
(
if
release
(
ql-dist:base-directory
release
)
(
asdf:system-source-directory
release-name
))))
(
ql-dist:base-directory
release
)
(
asdf:system-source-directory
release-name
))))
(
car
(
directory
(
merge-pathnames
"README.*"
asd-file
)))))
(
defun
file-to-string
(
pathname
)
...
...
@@ -94,23 +118,23 @@
(
if
(
find
(
string-downcase
(
pathname-type
readme
))
'
(
"md"
"markdown"
"mdown"
"mkdn"
"mdwn"
"mkd"
)
:test
#'
string=
)
(
handler-case
(
cmark-markdown-to-html
readme-txt
(
length
readme-txt
)
0
)
(
error
()
(
with-output-to-string
(
out
)
(
parse-string-and-print-to-stream
readme-txt
out
))))
(
format
nil
"<pre style=\"white-space: pre-wrap;\">~%~A~%</pre>"
readme-txt
))))
(
handler-case
(
cmark-markdown-to-html
readme-txt
(
length
readme-txt
)
0
)
(
error
()
(
with-output-to-string
(
out
)
(
parse-string-and-print-to-stream
readme-txt
out
))))
(
format
nil
"<pre style=\"white-space: pre-wrap;\">~%~A~%</pre>"
readme-txt
))))
(
defun
use-readme-intro
(
html-pathname
readme-pathname
)
(
read-write-file
(
html-pathname
html-text
stream
)
(
write-sequence
(
regex-replace
"\\<h2 class=\\\"chapter\\\"\\>1 Introduction\\<\\/h2\\>\\n"
html-text
(
list
:match
(
format-readme
readme-pathname
)))
stream
)))
(
write-sequence
(
regex-replace
"\\<h2 class=\\\"chapter\\\"\\>1 Introduction\\<\\/h2\\>\\n"
html-text
(
list
:match
(
format-readme
readme-pathname
)))
stream
)))
(
defun
file-copy
(
source
destination
)
(
with-open-file
(
in
source
:direction
:input
)
...
...
@@ -125,3 +149,5 @@
(
dolist
(
file
styles
)
(
file-copy
(
merge-pathnames
file
css-dir
)
(
merge-pathnames
file
website-dir
)))))
;; file.lisp ends here
map-declt.lisp
View file @
6b7e26b0
;;;; This file has to be run through qlmapper:map-releases "file"
;;; map-declt.lisp --- Declt mapping code
;; Copyright (C) 2018 EPITA Research and Development Laboratory
;; Author: Antoine Martin <antoine4.martin@epita.fr>
;; This file is part of Quickref.
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;; Comment:
;; This file is passed as an argument to QLMAPPER:MAP-RELEASES.
;;; Code:
(
when
*remove-cache*
(
sb-ext:run-program
"/bin/rm"
...
...
@@ -12,7 +38,7 @@
(
net.didierverna.declt:nickname-package
)
(
let
((
primary-system
(
quickref:get-primary-system-name
cl-user::*qrmapper-object-name*
)))
(
quickref:get-primary-system-name
cl-user::*qrmapper-object-name*
)))
;; #### TODO: encapsulate this into an error catching form.
(
format
t
"STARTED BUILDING PACKAGE ~A~%"
primary-system
)
(
when
primary-system
...
...
@@ -22,9 +48,11 @@
:library
cl-user::*qrmapper-object-name*
:texi-file
(
quickref:from-quickref-dir
(
format
nil
"texis/~A.texi"
cl-user::*qrmapper-object-name*
))
cl-user::*qrmapper-object-name*
))
:introduction
(
if
(
quickref:find-readme
cl-user::*qrmapper-object-name*
)
""
nil
))
""
nil
))
(
format
t
"FINISHED BUILDING PACKAGE ~A~%"
primary-system
))
;;; map-declt.lisp ends here
qrmapper-init.lisp
View file @
6b7e26b0
;;; qrmapper-init.lisp --- qrmapper initialization file
;; Copyright (C) 2018 EPITA Research and Development Laboratory
;; Author: Antoine Martin <antoine4.martin@epita.fr>
;; This file is part of Quickref.
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;; Code:
(
in-package
#:cl-user
)
(
defmacro
with-qrmapper-output
((
stream
file
)
&body
body
)
`
(
with-open-file
(
,
stream
,
file
:direction
:output
:if-exists
:append
:if-does-not-exist
:create
)
:if-exists
:append
:if-does-not-exist
:create
)
,@
body
))
(
export
'with-qrmapper-output
)
;; qrmapper-init.lisp ends here
quickref.asd
View file @
6b7e26b0
;;; quickref.asd --- ASDF system definition
;; Copyright (C) 2018 EPITA Research and Development Laboratory
;; Author: Antoine Martin <antoine4.martin@epita.fr>
;; This file is part of Quickref.
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;; Code:
(
asdf:defsystem
quickref
:author
"Antoine Martin"
:depends-on
(
:quicklisp
:alexandria
:net.didierverna.declt
...
...
@@ -7,3 +30,5 @@
(
:file
"qrmapper"
)
(
:file
"website"
)
(
:file
"file"
)))
;;; quickref.asd ends here
quickref.lisp
View file @
6b7e26b0
;;; quickref.lisp --- Entry points
;; Copyright (C) 2018 EPITA Research and Development Laboratory
;; Author: Antoine Martin <antoine4.martin@epita.fr>
;; This file is part of Quickref.
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;; Code:
(
defpackage
quickref
(
:use
:cl
)
(
:import-from
:alexandria
:starts-with-subseq
)
:starts-with-subseq
)
(
:import-from
:sb-ext
:run-program
:native-namestring
)
:run-program
:native-namestring
)
(
:import-from
:sb-thread
:make-thread
:make-mutex
:make-waitqueue
:with-mutex
:condition-notify
:condition-wait
:join-thread
)
:make-thread
:make-mutex
:make-waitqueue
:with-mutex
:condition-notify
:condition-wait
:join-thread
)
(
:import-from
:cl-ppcre
:regex-replace
)
:regex-replace
)
(
:import-from
:clmark
:cmark-markdown-to-html
)
:cmark-markdown-to-html
)
(
:import-from
:3bmd
:parse-string-and-print-to-stream
)
:parse-string-and-print-to-stream
)
(
:export
:print-primary-systems
:get-primary-system-name
:from-quickref-dir
...
...
@@ -32,8 +55,8 @@
(
defun
remove-cl-prefix
(
name
)
(
if
(
starts-with-subseq
"cl-"
name
)
(
subseq
name
3
)
name
))
(
subseq
name
3
)
name
))
(
defun
get-release-name
(
system
)
(
ql-dist:name
(
ql-dist:release
system
)))
...
...
@@ -126,11 +149,11 @@ The resulting .texi file is placed inside the release's directory, in
(
defparameter
*remove-cache*
nil
)
(
defun
refresh
(
&key
(
makeinfo-path
*makeinfo-path*
)
(
log-errors
*log-errors*
)
(
remove-cache
*remove-cache*
)
parallel
uninstall
)
(
makeinfo-path
*makeinfo-path*
)
(
log-errors
*log-errors*
)
(
remove-cache
*remove-cache*
)
parallel
uninstall
)
"Run the whole Quickref process, from generating the .texi files with Declt
to creating the corresponding html files with makeinfo.
...
...
@@ -155,9 +178,11 @@ be found in ~/texi-logfiles/ and ~/declt-logfiles/ for now."
(
ql:update-all-dists
:prompt
nil
)
(
ql:update-client
:prompt
nil
)
(
if
parallel
(
build-parallel
)
(
progn
(
build-releases
)
(
build-texis
)))
(
build-parallel
)
(
progn
(
build-releases
)
(
build-texis
)))
(
build-index
)
(
copy-stylesheets
)))
;; quickref.lisp ends here
website.lisp
View file @
6b7e26b0
;;; website.lisp --- Website generation routines
;; Copyright (C) 2018 EPITA Research and Development Laboratory
;; Author: Antoine Martin <antoine4.martin@epita.fr>
;; This file is part of Quickref.
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;; Code:
(
in-package
:quickref
)
(
defun
get-columns-length
(
size
)
...
...
@@ -153,3 +176,5 @@ The resulting file is written at ~/quickref/index.html"
(
format
nil
"texis/~A.texi"
release
))))
(
when
(
probe-file
file
)
(
build-texi
file
)))))))
;;; website.lisp ends here
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment