Mercurial > emacs
annotate lisp/calendar/cal-html.el @ 102591:f42a82e7d735
(cal-tex-preamble-extra): Add an example string value to help people
with the formatting.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sun, 15 Mar 2009 21:32:14 +0000 |
parents | a9dc0e7c3f2b |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1 ;;; cal-html.el --- functions for printing HTML calendars |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
2 |
100908 | 3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
92584
727105264b1c
Add autoload cookies to functions formerly autoloaded in calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
79703
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
5 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
6 ;; Author: Anna M. Bigatti <bigatti@dima.unige.it> |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
7 ;; Keywords: calendar |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
8 ;; Human-Keywords: calendar, diary, HTML |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
9 ;; Created: 23 Aug 2002 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
10 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
11 ;; This file is part of GNU Emacs. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
12 |
94653
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
14 ;; it under the terms of the GNU General Public License as published by |
94653
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
16 ;; (at your option) any later version. |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
17 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
21 ;; GNU General Public License for more details. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
22 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
94653
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
25 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
26 ;;; Commentary: |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
27 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
28 ;; This package writes HTML calendar files using the user's diary |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
29 ;; file. See the Emacs manual for details. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
30 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
31 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
32 ;;; Code: |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
33 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
34 (require 'calendar) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
35 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
36 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
37 (defgroup calendar-html nil |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
38 "Options for HTML calendars." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
39 :prefix "cal-html-" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
40 :group 'calendar) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
41 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
42 (defcustom cal-html-directory "~/public_html" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
43 "Directory for HTML pages generated by cal-html." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
44 :type 'string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
45 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
46 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
47 (defcustom cal-html-print-day-number-flag nil |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
48 "Non-nil means print the day-of-the-year number in the monthly cal-html page." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
49 :type 'boolean |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
50 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
51 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
52 (defcustom cal-html-year-index-cols 3 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
53 "Number of columns in the cal-html yearly index page." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
54 :type 'integer |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
55 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
56 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
57 (defcustom cal-html-day-abbrev-array |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
58 (calendar-abbrev-construct calendar-day-abbrev-array |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
59 calendar-day-name-array) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
60 "Array of seven strings for abbreviated day names (starting with Sunday)." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
61 :type '(vector string string string string string string string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
62 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
63 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
64 (defcustom cal-html-css-default |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
65 (concat |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
66 "<STYLE TYPE=\"text/css\">\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
67 " BODY { background: #bde; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
68 " H1 { text-align: center; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
69 " TABLE { padding: 2pt; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
70 " TH { background: #dee; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
71 " TABLE.year { width: 100%; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
72 " TABLE.agenda { width: 100%; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
73 " TABLE.header { width: 100%; text-align: center; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
74 " TABLE.minical TD { background: white; text-align: center; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
75 " TABLE.agenda TD { background: white; text-align: left; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
76 " TABLE.agenda TH { text-align: left; width: 20%; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
77 " SPAN.NO-YEAR { color: #0b3; font-weight: bold; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
78 " SPAN.ANN { color: #0bb; font-weight: bold; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
79 " SPAN.BLOCK { color: #048; font-style: italic; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
80 "</STYLE>\n\n") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
81 "Default cal-html css style. You can override this with a \"cal.css\" file." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
82 :type 'string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
83 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
84 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
85 ;;; End customizable variables. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
86 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
87 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
88 ;;; HTML and CSS code constants. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
89 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
90 (defconst cal-html-e-document-string "<BR><BR>\n</BODY>\n</HTML>" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
91 "HTML code for end of page.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
92 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
93 (defconst cal-html-b-tablerow-string "<TR>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
94 "HTML code for beginning of table row.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
95 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
96 (defconst cal-html-e-tablerow-string "</TR>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
97 "HTML code for end of table row.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
98 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
99 (defconst cal-html-b-tabledata-string " <TD>" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
100 "HTML code for beginning of table data.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
101 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
102 (defconst cal-html-e-tabledata-string " </TD>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
103 "HTML code for end of table data.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
104 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
105 (defconst cal-html-b-tableheader-string " <TH>" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
106 "HTML code for beginning of table header.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
107 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
108 (defconst cal-html-e-tableheader-string " </TH>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
109 "HTML code for end of table header.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
110 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
111 (defconst cal-html-e-table-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
112 "</TABLE>\n<!-- ================================================== -->\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
113 "HTML code for end of table.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
114 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
115 (defconst cal-html-minical-day-format " <TD><a href=%s#%d>%d</TD>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
116 "HTML code for a day in the minical - links NUM to month-page#NUM.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
117 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
118 (defconst cal-html-b-document-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
119 (concat |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
120 "<HTML>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
121 "<HEAD>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
122 "<TITLE>Calendar</TITLE>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
123 "<!--This buffer was produced by cal-html.el-->\n\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
124 cal-html-css-default |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
125 "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"cal.css\">\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
126 "</HEAD>\n\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
127 "<BODY>\n\n") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
128 "Initial block for html page.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
129 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
130 (defconst cal-html-html-subst-list |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
131 '(("&" . "&") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
132 ("\n" . "<BR>\n")) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
133 "Alist of symbols and their HTML replacements.") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
134 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
135 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
136 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
137 (defun cal-html-comment (string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
138 "Return STRING as html comment." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
139 (format "<!-- ====== %s ====== -->\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
140 (replace-regexp-in-string "--" "++" string))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
141 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
142 (defun cal-html-href (link string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
143 "Return a hyperlink to url LINK with text STRING." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
144 (format "<A HREF=\"%s\">%s</A>" link string)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
145 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
146 (defun cal-html-h3 (string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
147 "Return STRING as html header h3." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
148 (format "\n <H3>%s</H3>\n" string)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
149 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
150 (defun cal-html-h1 (string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
151 "Return STRING as html header h1." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
152 (format "\n <H1>%s</H1>\n" string)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
153 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
154 (defun cal-html-th (string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
155 "Return STRING as html table header." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
156 (format "%s%s%s" cal-html-b-tableheader-string string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
157 cal-html-e-tableheader-string)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
158 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
159 (defun cal-html-b-table (arg) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
160 "Return table tag with attribute ARG." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
161 (format "\n<TABLE %s>\n" arg)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
162 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
163 (defun cal-html-monthpage-name (month year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
164 "Return name of html page for numeric MONTH and four-digit YEAR. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
165 For example, \"2006-08.html\" for 8 2006." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
166 (format "%d-%.2d.html" year month)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
167 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
168 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
169 (defun cal-html-insert-link-monthpage (month year &optional change-dir) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
170 "Insert a link to the html page for numeric MONTH and four-digit YEAR. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
171 If optional argument CHANGE-DIR is non-nil and MONTH is 1 or 2, |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
172 the link points to a different year and so has a directory part." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
173 (insert (cal-html-h3 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
174 (cal-html-href |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
175 (concat (and change-dir |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
176 (member month '(1 12)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
177 (format "../%d/" year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
178 (cal-html-monthpage-name month year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
179 (calendar-month-name month))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
180 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
181 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
182 (defun cal-html-insert-link-yearpage (month year) |
92963
9b1631fe02a8
(cal-html-insert-link-yearpage, (cal-html-htmlify-list): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92831
diff
changeset
|
183 "Insert a link tagged with MONTH name, to index page for four-digit YEAR." |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
184 (insert (cal-html-h1 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
185 (format "%s %s" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
186 (calendar-month-name month) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
187 (cal-html-href "index.html" (number-to-string year)))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
188 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
189 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
190 (defun cal-html-year-dir-ask-user (year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
191 "Prompt for the html calendar output directory for four-digit YEAR. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
192 Return the expanded directory name, which is based on |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
193 `cal-html-directory' by default." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
194 (expand-file-name (read-directory-name |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
195 "Enter HTML calendar directory name: " |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
196 (expand-file-name (format "%d" year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
197 cal-html-directory)))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
198 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
199 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
200 ;; page header |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
201 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
202 (defun cal-html-insert-month-header (month year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
203 "Insert the header for the numeric MONTH page for four-digit YEAR. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
204 Contains links to previous and next month and year, and current minical." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
205 (insert (cal-html-b-table "class=header")) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
206 (insert cal-html-b-tablerow-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
207 (insert cal-html-b-tabledata-string) ; month links |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
208 (calendar-increment-month month year -1) ; previous month |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
209 (cal-html-insert-link-monthpage month year t) ; t --> change-dir |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
210 (calendar-increment-month month year 1) ; current month |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
211 (cal-html-insert-link-yearpage month year) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
212 (calendar-increment-month month year 1) ; next month |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
213 (cal-html-insert-link-monthpage month year t) ; t --> change-dir |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
214 (insert cal-html-e-tabledata-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
215 (insert cal-html-b-tabledata-string) ; minical |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
216 (calendar-increment-month month year -1) |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
217 (cal-html-insert-minical month year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
218 (insert cal-html-e-tabledata-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
219 (insert cal-html-e-tablerow-string) ; end |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
220 (insert cal-html-e-table-string)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
221 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
222 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
223 ;; minical: a small month calendar with links |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
224 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
225 (defun cal-html-insert-minical (month year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
226 "Insert a minical for numeric MONTH of YEAR." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
227 (let* ((blank-days ; at start of month |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
228 (mod (- (calendar-day-of-week (list month 1 year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
229 calendar-week-start-day) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
230 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
231 (last (calendar-last-day-of-month month year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
232 (end-blank-days ; at end of month |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
233 (mod (- 6 (- (calendar-day-of-week (list month last year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
234 calendar-week-start-day)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
235 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
236 (monthpage-name (cal-html-monthpage-name month year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
237 date) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
238 ;; Start writing table. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
239 (insert (cal-html-comment "MINICAL") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
240 (cal-html-b-table "class=minical border=1 align=center")) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
241 ;; Weekdays row. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
242 (insert cal-html-b-tablerow-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
243 (dotimes (i 7) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
244 (insert (cal-html-th |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
245 (aref cal-html-day-abbrev-array |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
246 (mod (+ i calendar-week-start-day) 7))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
247 (insert cal-html-e-tablerow-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
248 ;; Initial empty slots. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
249 (insert cal-html-b-tablerow-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
250 (dotimes (i blank-days) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
251 (insert |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
252 cal-html-b-tabledata-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
253 cal-html-e-tabledata-string)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
254 ;; Numbers. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
255 (dotimes (i last) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
256 (insert (format cal-html-minical-day-format monthpage-name i (1+ i))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
257 ;; New row? |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
258 (if (and (zerop (mod (+ i 1 blank-days) 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
259 (/= (1+ i) last)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
260 (insert cal-html-e-tablerow-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
261 cal-html-b-tablerow-string))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
262 ;; End empty slots (for some browsers like konqueror). |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
263 (dotimes (i end-blank-days) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
264 (insert |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
265 cal-html-b-tabledata-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
266 cal-html-e-tabledata-string))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
267 (insert cal-html-e-tablerow-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
268 cal-html-e-table-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
269 (cal-html-comment "MINICAL end"))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
270 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
271 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
272 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
273 ;; year index page with minicals |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
274 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
275 (defun cal-html-insert-year-minicals (year cols) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
276 "Make a one page yearly mini-calendar for four-digit YEAR. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
277 There are 12/cols rows of COLS months each." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
278 (insert cal-html-b-document-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
279 (insert (cal-html-h1 (number-to-string year))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
280 (insert (cal-html-b-table "class=year") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
281 cal-html-b-tablerow-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
282 (dotimes (i 12) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
283 (insert cal-html-b-tabledata-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
284 (cal-html-insert-link-monthpage (1+ i) year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
285 (cal-html-insert-minical (1+ i) year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
286 (insert cal-html-e-tabledata-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
287 (if (zerop (mod (1+ i) cols)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
288 (insert cal-html-e-tablerow-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
289 cal-html-b-tablerow-string))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
290 (insert cal-html-e-tablerow-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
291 cal-html-e-table-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
292 cal-html-e-document-string)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
293 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
294 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
295 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
296 ;; HTMLify |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
297 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
298 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
299 (defun cal-html-htmlify-string (string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
300 "Protect special characters in STRING from HTML. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
301 Characters are replaced according to `cal-html-html-subst-list'." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
302 (if (stringp string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
303 (replace-regexp-in-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
304 (regexp-opt (mapcar 'car cal-html-html-subst-list)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
305 (lambda (x) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
306 (cdr (assoc x cal-html-html-subst-list))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
307 string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
308 "")) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
309 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
310 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
311 (defun cal-html-htmlify-entry (entry) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
312 "Convert a diary entry ENTRY to html with the appropriate class specifier." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
313 (let ((start |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
314 (cond |
92963
9b1631fe02a8
(cal-html-insert-link-yearpage, (cal-html-htmlify-list): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92831
diff
changeset
|
315 ((string-match "block" (nth 2 entry)) "BLOCK") |
9b1631fe02a8
(cal-html-insert-link-yearpage, (cal-html-htmlify-list): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92831
diff
changeset
|
316 ((string-match "anniversary" (nth 2 entry)) "ANN") |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
317 ((not (string-match |
92963
9b1631fe02a8
(cal-html-insert-link-yearpage, (cal-html-htmlify-list): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92831
diff
changeset
|
318 (number-to-string (nth 2 (car entry))) |
9b1631fe02a8
(cal-html-insert-link-yearpage, (cal-html-htmlify-list): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92831
diff
changeset
|
319 (nth 2 entry))) |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
320 "NO-YEAR") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
321 (t "NORMAL")))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
322 (format "<span class=%s>%s</span>" start |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
323 (cal-html-htmlify-string (cadr entry))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
324 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
325 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
326 (defun cal-html-htmlify-list (date-list date) |
92963
9b1631fe02a8
(cal-html-insert-link-yearpage, (cal-html-htmlify-list): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92831
diff
changeset
|
327 "Return a string of concatenated, HTML-ified diary entries. |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
328 DATE-LIST is a list of diary entries. Return only those matching DATE." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
329 (mapconcat (lambda (x) (cal-html-htmlify-entry x)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
330 (let (result) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
331 (dolist (p date-list (reverse result)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
332 (and (car p) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
333 (calendar-date-equal date (car p)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
334 (setq result (cons p result))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
335 "<BR>\n ")) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
336 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
337 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
338 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
339 ;; Monthly calendar |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
340 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
341 |
92831
65bc0cdc7f5f
(diary-list-entries): Fix autoload.
Glenn Morris <rgm@gnu.org>
parents:
92584
diff
changeset
|
342 (autoload 'diary-list-entries "diary-lib") |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
343 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
344 (defun cal-html-list-diary-entries (d1 d2) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
345 "Generate a list of all diary-entries from absolute date D1 to D2." |
95413
2b0558bc8d53
(cal-html-list-diary-entries): Use LIST-ONLY argument of
Glenn Morris <rgm@gnu.org>
parents:
94653
diff
changeset
|
346 (diary-list-entries (calendar-gregorian-from-absolute d1) |
2b0558bc8d53
(cal-html-list-diary-entries): Use LIST-ONLY argument of
Glenn Morris <rgm@gnu.org>
parents:
94653
diff
changeset
|
347 (1+ (- d2 d1)) t)) |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
348 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
349 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
350 (defun cal-html-insert-agenda-days (month year diary-list) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
351 "Insert HTML commands for a range of days in monthly calendars. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
352 HTML commands are inserted for the days of the numeric MONTH in |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
353 four-digit YEAR. Diary entries in DIARY-LIST are included." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
354 (let ((blank-days ; at start of month |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
355 (mod (- (calendar-day-of-week (list month 1 year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
356 calendar-week-start-day) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
357 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
358 (last (calendar-last-day-of-month month year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
359 date) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
360 (insert "<a name=0>\n") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
361 (insert (cal-html-b-table "class=agenda border=1")) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
362 (dotimes (i last) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
363 (setq date (list month (1+ i) year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
364 (insert |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
365 (format "<a name=%d></a>\n" (1+ i)) ; link |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
366 cal-html-b-tablerow-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
367 ;; Number & day name. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
368 cal-html-b-tableheader-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
369 (if cal-html-print-day-number-flag |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
370 (format "<em>%d</em> " |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
371 (calendar-day-number date)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
372 "") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
373 (format "%d %s" (1+ i) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
374 (aref calendar-day-name-array |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
375 (calendar-day-of-week date))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
376 cal-html-e-tableheader-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
377 ;; Diary entries. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
378 cal-html-b-tabledata-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
379 (cal-html-htmlify-list diary-list date) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
380 cal-html-e-tabledata-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
381 cal-html-e-tablerow-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
382 ;; If end of week and not end of month, make new table. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
383 (if (and (zerop (mod (+ i 1 blank-days) 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
384 (/= (1+ i) last)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
385 (insert cal-html-e-table-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
386 (cal-html-b-table |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
387 "class=agenda border=1"))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
388 (insert cal-html-e-table-string)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
389 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
390 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
391 (defun cal-html-one-month (month year dir) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
392 "Write an HTML calendar file for numeric MONTH of YEAR in directory DIR." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
393 (let ((diary-list (cal-html-list-diary-entries |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
394 (calendar-absolute-from-gregorian (list month 1 year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
395 (calendar-absolute-from-gregorian |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
396 (list month |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
397 (calendar-last-day-of-month month year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
398 year))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
399 (with-temp-buffer |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
400 (insert cal-html-b-document-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
401 (cal-html-insert-month-header month year) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
402 (cal-html-insert-agenda-days month year diary-list) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
403 (insert cal-html-e-document-string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
404 (write-file (expand-file-name |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
405 (cal-html-monthpage-name month year) dir))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
406 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
407 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
408 ;;; User commands. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
409 |
92831
65bc0cdc7f5f
(diary-list-entries): Fix autoload.
Glenn Morris <rgm@gnu.org>
parents:
92584
diff
changeset
|
410 ;;;###cal-autoload |
96064
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
411 (defun cal-html-cursor-month (month year dir &optional event) |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
412 "Write an HTML calendar file for numeric MONTH of four-digit YEAR. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
413 The output directory DIR is created if necessary. Interactively, |
96064
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
414 MONTH and YEAR are taken from the calendar cursor position, or from |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
415 the position specified by EVENT. Note that any existing output files |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
416 are overwritten." |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
417 (interactive (let* ((event last-nonmenu-event) |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
418 (date (calendar-cursor-to-date t event)) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
419 (month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
420 (year (calendar-extract-year date))) |
96064
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
421 (list month year (cal-html-year-dir-ask-user year) event))) |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
422 (make-directory dir t) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
423 (cal-html-one-month month year dir)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
424 |
92831
65bc0cdc7f5f
(diary-list-entries): Fix autoload.
Glenn Morris <rgm@gnu.org>
parents:
92584
diff
changeset
|
425 ;;;###cal-autoload |
96064
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
426 (defun cal-html-cursor-year (year dir &optional event) |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
427 "Write HTML calendar files (index and monthly pages) for four-digit YEAR. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
428 The output directory DIR is created if necessary. Interactively, |
96064
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
429 YEAR is taken from the calendar cursor position, or from the position |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
430 specified by EVENT. Note that any existing output files are overwritten." |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
431 (interactive (let* ((event last-nonmenu-event) |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
432 (year (calendar-extract-year |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
433 (calendar-cursor-to-date t event)))) |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
434 (list year (cal-html-year-dir-ask-user year) event))) |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
435 (make-directory dir t) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
436 (with-temp-buffer |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
437 (cal-html-insert-year-minicals year cal-html-year-index-cols) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
438 (write-file (expand-file-name "index.html" dir))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
439 (dotimes (i 12) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
440 (cal-html-one-month (1+ i) year dir))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
441 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
442 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
443 (provide 'cal-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
444 |
73527 | 445 ;; arch-tag: 4e73377d-d2c1-46ea-a103-02c111da5f57 |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
446 ;;; cal-html.el ends here |