Skip to content
GitLab
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
eba6c66e
Commit
eba6c66e
authored
Nov 23, 2017
by
Antoine Martin
Browse files
Include README in Introduction if one is found
parent
87c26529
Changes
5
Hide whitespace changes
Inline
Side-by-side
file.lisp
View file @
eba6c66e
...
...
@@ -57,3 +57,34 @@
(
when
makeinfo
(
clean-or-create
(
from-quickref-dir
"logs/makeinfo/"
))
(
clean-or-create
(
from-quickref-dir
"website/"
))))
(
defun
find-readme
(
release-name
)
(
let
((
asd-file
(
ql-dist:base-directory
(
ql-dist:find-release
release-name
))))
(
car
(
directory
(
merge-pathnames
"README.*"
asd-file
)))))
(
defun
file-to-string
(
pathname
)
(
with-open-file
(
file
pathname
)
(
alexandria:read-file-into-string
file
)))
(
defmacro
read-write-file
((
pathname
content
stream
)
&body
body
)
`
(
let
((
,
content
(
file-to-string
,
pathname
)))
(
with-open-file
(
,
stream
,
pathname
:direction
:output
:if-exists
:supersede
)
,@
body
)))
(
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\\>"
html-text
(
format
nil
"<h2 class=\"chapter\">1 Introduction</h2>
<pre>
~A
</pre>"
(
file-to-string
readme-pathname
)))
stream
)))
map-declt.lisp
View file @
eba6c66e
...
...
@@ -21,5 +21,9 @@
: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
))
(
format
t
"FINISHED BUILDING PACKAGE ~A~%"
primary-system
))
quickref.asd
View file @
eba6c66e
(
asdf:defsystem
quickref
:author
"Antoine Martin"
:depends-on
(
:quicklisp
:alexandria
:net.didierverna.declt
)
:depends-on
(
:quicklisp
:alexandria
:net.didierverna.declt
:cl-ppcre
)
:serial
t
:components
((
:file
"quickref"
)
(
:file
"qrmapper"
)
...
...
quickref.lisp
View file @
eba6c66e
...
...
@@ -5,6 +5,8 @@
(
:import-from
:sb-ext
:run-program
:native-namestring
)
(
:import-from
:cl-ppcre
:regex-replace
)
(
:export
:print-primary-systems
:get-primary-system-name
:from-quickref-dir
...
...
website.lisp
View file @
eba6c66e
...
...
@@ -98,26 +98,35 @@ The resulting file is written at ~/quickref/index.html"
(
format
file
"</body>~%"
)))
(
defun
build-texi
(
texi
)
(
format
t
"Generating html file for ~A~%"
(
pathname-name
texi
))
(
let
((
out
(
with-output-to-string
(
out
)
(
sb-ext:run-program
*makeinfo-path*
(
nconc
(
list
"--html"
(
namestring
texi
)
"-o"
(
namestring
(
from-quickref-dir
(
format
nil
"website/~A.html"
(
pathname-name
texi
))))
"--css-ref"
"/document.css"
"-c"
"TOP_NODE_UP_URL=/"
"--no-split"
)
(
if
*log-errors*
'
(
"--force"
)
nil
))
:output
out
))))
(
when
(
not
(
string=
out
""
))
(
if
*log-errors*
(
log-texi-error
out
texi
)
(
format
t
out
)))))
(
let
((
texi-name
(
pathname-name
texi
)))
(
format
t
"Generating html file for ~A"
texi-name
)
(
let
((
out
(
with-output-to-string
(
out
)
(
sb-ext:run-program
*makeinfo-path*
(
nconc
(
list
"--html"
(
namestring
texi
)
"-o"
(
namestring
(
from-quickref-dir
(
format
nil
"website/~A.html"
texi-name
)))
"--css-ref"
"/document.css"
"-c"
"TOP_NODE_UP_URL=/"
"--no-split"
)
(
if
*log-errors*
'
(
"--force"
)
nil
))
:output
out
))))
(
when
(
not
(
string=
out
""
))
(
if
*log-errors*
(
log-texi-error
out
texi
)
(
format
t
out
))))
;; Add README in Introduction if we find one
(
let
((
readme-path
(
find-readme
texi-name
)))
(
when
readme-path
(
format
t
" with README"
)
(
use-readme-intro
(
from-quickref-dir
(
format
nil
"website/~A.html"
texi-name
))
readme-path
))))
(
format
t
"~%"
))
(
defun
build-texis
(
&key
(
makeinfo-path
*makeinfo-path*
)
(
log-errors
*log-errors*
))
"Calls makeinfo on each .texi file, places the resulting html files in ~/quickref/"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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