Mercurial > emacs
annotate lisp/calendar/cal-html.el @ 110149:4ac2b883320e
Forgor to save ChangeLog for previous commit.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Thu, 02 Sep 2010 12:20:20 +0200 |
parents | 280c8ae2476d |
children | 417b1e4d63cd |
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 |
106815 | 3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
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 |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
10 ;; Package: calendar |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
11 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
12 ;; 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
|
13 |
94653
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
14 ;; 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
|
15 ;; 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
|
16 ;; 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
|
17 ;; (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
|
18 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
19 ;; 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
|
20 ;; 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
|
21 ;; 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
|
22 ;; 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
|
23 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
24 ;; 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
|
25 ;; 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
|
26 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
27 ;;; Commentary: |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
28 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
29 ;; 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
|
30 ;; 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
|
31 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
32 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
33 ;;; Code: |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
34 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
35 (require 'calendar) |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
38 (defgroup calendar-html nil |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
39 "Options for HTML calendars." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
40 :prefix "cal-html-" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
41 :group 'calendar) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
42 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
43 (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
|
44 "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
|
45 :type 'string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
46 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
47 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
48 (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
|
49 "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
|
50 :type 'boolean |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
51 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
52 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
53 (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
|
54 "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
|
55 :type 'integer |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
56 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
57 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
58 (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
|
59 (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
|
60 calendar-day-name-array) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
61 "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
|
62 :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
|
63 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
64 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
65 (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
|
66 (concat |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
67 "<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
|
68 " BODY { background: #bde; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
69 " 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
|
70 " TABLE { padding: 2pt; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
71 " TH { background: #dee; }\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
72 " 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
|
73 " 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
|
74 " 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
|
75 " 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
|
76 " 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
|
77 " 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
|
78 " 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
|
79 " 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
|
80 " 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
|
81 "</STYLE>\n\n") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
82 "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
|
83 :type 'string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
84 :group 'calendar-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
85 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
86 ;;; End customizable variables. |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
89 ;;; 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
|
90 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
91 (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
|
92 "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
|
93 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
94 (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
|
95 "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
|
96 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
97 (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
|
98 "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
|
99 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
100 (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
|
101 "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
|
102 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
103 (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
|
104 "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
|
105 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
106 (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
|
107 "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
|
108 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
109 (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
|
110 "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
|
111 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
112 (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
|
113 "</TABLE>\n<!-- ================================================== -->\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
114 "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
|
115 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
116 (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
|
117 "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
|
118 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
119 (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
|
120 (concat |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
121 "<HTML>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
122 "<HEAD>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
123 "<TITLE>Calendar</TITLE>\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
124 "<!--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
|
125 cal-html-css-default |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
126 "<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
|
127 "</HEAD>\n\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
128 "<BODY>\n\n") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
129 "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
|
130 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
131 (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
|
132 '(("&" . "&") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
133 ("\n" . "<BR>\n")) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
134 "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
|
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
138 (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
|
139 "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
|
140 (format "<!-- ====== %s ====== -->\n" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
141 (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
|
142 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
143 (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
|
144 "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
|
145 (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
|
146 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
147 (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
|
148 "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
|
149 (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
|
150 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
151 (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
|
152 "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
|
153 (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
|
154 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
155 (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
|
156 "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
|
157 (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
|
158 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
|
159 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
160 (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
|
161 "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
|
162 (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
|
163 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
164 (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
|
165 "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
|
166 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
|
167 (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
|
168 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
169 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
170 (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
|
171 "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
|
172 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
|
173 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
|
174 (insert (cal-html-h3 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
175 (cal-html-href |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
176 (concat (and change-dir |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
177 (member month '(1 12)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
178 (format "../%d/" year)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
179 (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
|
180 (calendar-month-name month))))) |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
183 (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
|
184 "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
|
185 (insert (cal-html-h1 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
186 (format "%s %s" |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
187 (calendar-month-name month) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
188 (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
|
189 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
190 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
191 (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
|
192 "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
|
193 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
|
194 `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
|
195 (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
|
196 "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
|
197 (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
|
198 cal-html-directory)))) |
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 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
201 ;; page header |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
202 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
203 (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
|
204 "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
|
205 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
|
206 (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
|
207 (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
|
208 (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
|
209 (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
|
210 (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
|
211 (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
|
212 (cal-html-insert-link-yearpage month year) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
213 (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
|
214 (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
|
215 (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
|
216 (insert cal-html-b-tabledata-string) ; minical |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
217 (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
|
218 (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
|
219 (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
|
220 (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
|
221 (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
|
222 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
223 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
224 ;; 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
|
225 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
226 (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
|
227 "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
|
228 (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
|
229 (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
|
230 calendar-week-start-day) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
231 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
232 (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
|
233 (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
|
234 (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
|
235 calendar-week-start-day)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
236 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
237 (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
|
238 date) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
239 ;; Start writing table. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
240 (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
|
241 (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
|
242 ;; Weekdays row. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
243 (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
|
244 (dotimes (i 7) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
245 (insert (cal-html-th |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
246 (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
|
247 (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
|
248 (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
|
249 ;; Initial empty slots. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
250 (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
|
251 (dotimes (i blank-days) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
252 (insert |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
253 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
|
254 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
|
255 ;; Numbers. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
256 (dotimes (i last) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
257 (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
|
258 ;; New row? |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
259 (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
|
260 (/= (1+ i) last)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
261 (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
|
262 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
|
263 ;; 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
|
264 (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
|
265 (insert |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
266 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
|
267 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
|
268 (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
|
269 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
|
270 (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
|
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 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
274 ;; 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
|
275 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
276 (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
|
277 "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
|
278 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
|
279 (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
|
280 (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
|
281 (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
|
282 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
|
283 (dotimes (i 12) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
284 (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
|
285 (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
|
286 (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
|
287 (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
|
288 (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
|
289 (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
|
290 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
|
291 (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
|
292 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
|
293 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
|
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 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
297 ;; HTMLify |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
300 (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
|
301 "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
|
302 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
|
303 (if (stringp string) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
304 (replace-regexp-in-string |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
305 (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
|
306 (lambda (x) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
307 (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
|
308 string) |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
312 (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
|
313 "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
|
314 (let ((start |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
315 (cond |
92963
9b1631fe02a8
(cal-html-insert-link-yearpage, (cal-html-htmlify-list): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92831
diff
changeset
|
316 ((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
|
317 ((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
|
318 ((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
|
319 (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
|
320 (nth 2 entry))) |
73517
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
321 "NO-YEAR") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
322 (t "NORMAL")))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
323 (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
|
324 (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
|
325 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
326 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
327 (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
|
328 "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
|
329 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
|
330 (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
|
331 (let (result) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
332 (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
|
333 (and (car p) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
334 (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
|
335 (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
|
336 "<BR>\n ")) |
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 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
340 ;; Monthly calendar |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
341 ;;------------------------------------------------------------ |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
342 |
92831
65bc0cdc7f5f
(diary-list-entries): Fix autoload.
Glenn Morris <rgm@gnu.org>
parents:
92584
diff
changeset
|
343 (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
|
344 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
345 (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
|
346 "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
|
347 (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
|
348 (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
|
349 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
350 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
351 (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
|
352 "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
|
353 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
|
354 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
|
355 (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
|
356 (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
|
357 calendar-week-start-day) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
358 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
359 (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
|
360 date) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
361 (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
|
362 (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
|
363 (dotimes (i last) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
364 (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
|
365 (insert |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
366 (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
|
367 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
|
368 ;; Number & day name. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
369 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
|
370 (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
|
371 (format "<em>%d</em> " |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
372 (calendar-day-number date)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
373 "") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
374 (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
|
375 (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
|
376 (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
|
377 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
|
378 ;; Diary entries. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
379 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
|
380 (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
|
381 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
|
382 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
|
383 ;; 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
|
384 (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
|
385 (/= (1+ i) last)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
386 (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
|
387 (cal-html-b-table |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
388 "class=agenda border=1"))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
389 (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
|
390 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
391 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
392 (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
|
393 "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
|
394 (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
|
395 (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
|
396 (calendar-absolute-from-gregorian |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
397 (list month |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
398 (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
|
399 year))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
400 (with-temp-buffer |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
401 (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
|
402 (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
|
403 (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
|
404 (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
|
405 (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
|
406 (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
|
407 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
408 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
409 ;;; User commands. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
410 |
92831
65bc0cdc7f5f
(diary-list-entries): Fix autoload.
Glenn Morris <rgm@gnu.org>
parents:
92584
diff
changeset
|
411 ;;;###cal-autoload |
96064
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
412 (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
|
413 "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
|
414 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
|
415 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
|
416 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
|
417 are overwritten." |
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
418 (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
|
419 (date (calendar-cursor-to-date t event)) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
420 (month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
92963
diff
changeset
|
421 (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
|
422 (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
|
423 (make-directory dir t) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
424 (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
|
425 |
92831
65bc0cdc7f5f
(diary-list-entries): Fix autoload.
Glenn Morris <rgm@gnu.org>
parents:
92584
diff
changeset
|
426 ;;;###cal-autoload |
96064
1a48e0bd73d8
(cal-html-cursor-month, cal-html-cursor-year): Handle mouse events.
Glenn Morris <rgm@gnu.org>
parents:
95413
diff
changeset
|
427 (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
|
428 "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
|
429 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
|
430 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
|
431 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
|
432 (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
|
433 (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
|
434 (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
|
435 (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
|
436 (make-directory dir t) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
437 (with-temp-buffer |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
438 (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
|
439 (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
|
440 (dotimes (i 12) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
441 (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
|
442 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
443 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
444 (provide 'cal-html) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
445 |
73527 | 446 ;; 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
|
447 ;;; cal-html.el ends here |