Mercurial > emacs
annotate lisp/calendar/cal-html.el @ 77041:831765c54f39
(c-electric-paren): clean-up space-before-funcall: only insert space when on
identifier, etc. Patch by David Hansen.
----------------------------------------------------------------------
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Sat, 07 Apr 2007 19:50:06 +0000 |
parents | 7a3f13e2dd57 |
children | 93e11478c954 |
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 |
75346 | 3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 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
|
4 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
5 ;; 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
|
6 ;; Keywords: calendar |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
7 ;; 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
|
8 ;; Created: 23 Aug 2002 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
9 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
10 ;; 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
|
11 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
15 ;; any later version. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
16 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
17 ;; 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
|
18 ;; 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
|
19 ;; 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
|
20 ;; 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
|
21 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
25 ;; Boston, MA 02110-1301, USA. |
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) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
184 "Insert a link to index page for four-digit YEAR, tagged using MONTH name." |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
209 (increment-calendar-month month year -1) ; previous month |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
211 (increment-calendar-month month year 1) ; current month |
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) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
213 (increment-calendar-month month year 1) ; next month |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
217 (increment-calendar-month month year -1) |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
316 ((string-match "block" (car (cddr entry))) "BLOCK") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
317 ((string-match "anniversary" (car (cddr entry))) "ANN") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
318 ((not (string-match |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
319 (number-to-string (car (cddr (car entry)))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
320 (car (cddr entry)))) |
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) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
328 "Return a string of concatenated, HTMLified diary entries. |
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
343 (autoload 'diary-list-entries "diary-lib" nil t) |
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." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
347 (let (diary-display-hook) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
348 (diary-list-entries |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
349 (calendar-gregorian-from-absolute d1) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
350 (1+ (- d2 d1))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
351 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
352 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
353 (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
|
354 "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
|
355 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
|
356 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
|
357 (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
|
358 (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
|
359 calendar-week-start-day) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
360 7)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
361 (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
|
362 date) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
363 (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
|
364 (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
|
365 (dotimes (i last) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
366 (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
|
367 (insert |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
368 (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
|
369 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
|
370 ;; Number & day name. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
371 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
|
372 (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
|
373 (format "<em>%d</em> " |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
374 (calendar-day-number date)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
375 "") |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
376 (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
|
377 (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
|
378 (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
|
379 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
|
380 ;; Diary entries. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
381 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
|
382 (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
|
383 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
|
384 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
|
385 ;; 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
|
386 (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
|
387 (/= (1+ i) last)) |
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 (cal-html-b-table |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
390 "class=agenda border=1"))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
391 (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
|
392 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
393 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
394 (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
|
395 "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
|
396 (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
|
397 (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
|
398 (calendar-absolute-from-gregorian |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
399 (list month |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
400 (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
|
401 year))))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
402 (with-temp-buffer |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
403 (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
|
404 (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
|
405 (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
|
406 (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
|
407 (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
|
408 (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
|
409 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
410 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
411 ;;; User commands. |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
412 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
413 (defun cal-html-cursor-month (month year dir) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
414 "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
|
415 The output directory DIR is created if necessary. Interactively, |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
416 MONTH and YEAR are taken from the calendar cursor position. Note |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
417 that any existing output files are overwritten." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
418 (interactive (let* ((date (calendar-cursor-to-date t)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
419 (month (extract-calendar-month date)) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
420 (year (extract-calendar-year date))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
421 (list month year (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
|
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 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
425 (defun cal-html-cursor-year (year dir) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
426 "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
|
427 The output directory DIR is created if necessary. Interactively, |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
428 YEAR is taken from the calendar cursor position. Note that any |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
429 existing output files are overwritten." |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
430 (interactive (let ((year (extract-calendar-year |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
431 (calendar-cursor-to-date t)))) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
432 (list year (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
|
433 (make-directory dir t) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
434 (with-temp-buffer |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
435 (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
|
436 (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
|
437 (dotimes (i 12) |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
438 (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
|
439 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
440 |
2881aec6b925
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
441 (provide 'cal-html) |
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 |
73527 | 444 ;; 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
|
445 ;;; cal-html.el ends here |