-
Notifications
You must be signed in to change notification settings - Fork 0
/
specials.lisp
124 lines (109 loc) · 6.21 KB
/
specials.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: LW-DOC; Base: 10 -*-
;;; $Header: /usr/local/cvsrep/lw-doc/specials.lisp,v 1.26 2012-05-04 20:56:45 edi Exp $
;;; Copyright (c) 2005-2012, Dr. Edmund Weitz. All rights reserved.
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;; * Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;; * Redistributions in binary form must reproduce the above
;;; copyright notice, this list of conditions and the following
;;; disclaimer in the documentation and/or other materials
;;; provided with the distribution.
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(in-package :lw-doc)
(defvar *docs-base-path*
(make-pathname :name nil
:type nil
:version nil
:defaults
#+(or lispworks7.0 lispworks6.1)
(sys:lispworks-dir "manual/online/")
#-(or lispworks7.0 lispworks6.1)
(sys:lispworks-dir "manual/online/web/"))
"A pathname denoting the directory where the browsable
documentation can be found.")
(defvar *index-pages*
(flet ((find-highest-numbered-html-file (pattern)
"Finds and returns the pathname with the highest number
following the last hyphen in its name of those files in
*DOCS-BASE-PATH* which match PATTERN \(if any)."
(lw:when-let (path
(first (sort (directory (merge-pathnames pattern *docs-base-path*))
#'>
:key (lambda (pathname)
(let* ((basename (pathname-name pathname))
(hyphen-pos (position #\- basename :from-end t)))
(or (parse-integer (subseq (pathname-name pathname)
(1+ hyphen-pos))
:junk-allowed t)
-1000000))))))
(regex-replace-all "\\\\" (enough-namestring path *docs-base-path*) "/"))))
`(#+win32
("COM" ,(find-highest-numbered-html-file "COM/html/com-*.htm"))
("ED" #+win32 ,(find-highest-numbered-html-file "EDUG-W/html/eduser-w-*.htm")
#+linux ,(find-highest-numbered-html-file "EDUG-U/html/eduser-u-*.htm")
#+freebsd ,(find-highest-numbered-html-file "EDUG-U/html/eduser-u-*.htm")
#+darwin ,(find-highest-numbered-html-file "EDUG-M/html/eduser-m-*.htm"))
("DLV" ,(or (find-highest-numbered-html-file "DV/html/delivery-*.htm")
(find-highest-numbered-html-file "DV/html/deluser-*.htm")))
("FLI" ,(find-highest-numbered-html-file "FLI/html/fli-*.htm"))
("LW" ,(or (find-highest-numbered-html-file "LW/html/lw-*.htm")
(find-highest-numbered-html-file "LWRM/html/lwref-*.htm")))
#+lispworks7.0
("CAPI" #+linux ,(find-highest-numbered-html-file "CAPI-U/html/capi-u-*.htm")
#+freebsd ,(find-highest-numbered-html-file "CAPI-U/html/capi-u-*.htm")
#+darwin ,(find-highest-numbered-html-file "CAPI-M/html/capi-m-*.htm"))
#-lispworks7.0
("CAPI" ,(find-highest-numbered-html-file "CAPRM/html/capiref-*.htm"))
#+darwin
("OBJC" ,(find-highest-numbered-html-file "OBJC/html/objc-*.htm"))
("CORBA" ,(find-highest-numbered-html-file "CORBA/html/corba-*.htm"))
("KW" #+linux ,(find-highest-numbered-html-file "KW-U/html/kwprolog-u-*.htm")
#+freebsd ,(find-highest-numbered-html-file "KW-U/html/kwprolog-u-*.htm")
#+darwin ,(find-highest-numbered-html-file "KW-M/html/kwprolog-m-*.htm"))
#+(or linux freebsd)
("CLIM" ,(find-highest-numbered-html-file "CLIM/html/climuser-*.htm"))))
"An alist mapping shortcuts for LW documentation sections to
the relative location of their index page.")
(defvar *link-table* (make-hash-table :test #'equal)
"A hash table which maps symbols and editor commands to lists
with link information.")
(defvar *sorted-table* (make-hash-table :test #'equal)
"A hash table which maps characters to a list of all
\(permuted) index entries starting with the corresponding
character.")
(defconstant +html-entities+ '(("amp" . "&")
("lt" . "<")
("gt" . ">")
("nbsp" . " "))
"An alist mapping some names of HTML entities to the characters
they denote.")
(defvar *link-prefix* nil
"During the computation of the permuted index this variable can
be bound to a prefix which will be added to each link.")
(defvar *lw-link-prefix*
#+lispworks4.4 "http://www.lispworks.com/documentation/lw445/"
#+lispworks5.0 "http://www.lispworks.com/documentation/lw50/"
#+lispworks5.1 "http://www.lispworks.com/documentation/lw51/"
#+lispworks6.0 "http://www.lispworks.com/documentation/lw60/"
#+lispworks6.1 "http://www.lispworks.com/documentation/lw61/"
#+lispworks7.0 "http://www.lispworks.com/documentation/lw70/"
"The prefix for the LispWorks online documentation.")
(defvar *html-stream* nil
"During the creation of the permuted index this variable is
bound to the stream the HTML content is written to.")
(defvar *target-dir* nil
"During the computation of the permuted index this variable is
bound to a pathname denoting the directory where the index should
be created.")