Fossil SCM

Make it easier to use Events as quick notes: Display the title just above the text on Event pages. If there's no title in the wiki text, use the comment as a title.

ben 2011-09-07 08:12 trunk
Commit 27a4518e13c41e6016757469dcae30d7baa54225
1 file changed +13 -5
+13 -5
--- src/event.c
+++ src/event.c
@@ -64,12 +64,14 @@
6464
char *zETime; /* Time of the event */
6565
char *zATime; /* Time the artifact was created */
6666
int specRid; /* rid specified by aid= parameter */
6767
int prevRid, nextRid; /* Previous or next edits of this event */
6868
Manifest *pEvent; /* Parsed event artifact */
69
+ Blob comment; /* Comment shown in timeline */
6970
Blob fullbody; /* Complete content of the event body */
7071
Blob title; /* Title extracted from the event body */
72
+ int haveTitle; /* Whether a title was extracted */
7173
Blob tail; /* Event body that comes after the title */
7274
Stmt q1; /* Query to search for the event */
7375
int showDetail; /* True to show details */
7476
7577
@@ -116,12 +118,14 @@
116118
*/
117119
pEvent = manifest_get(rid, CFTYPE_EVENT);
118120
if( pEvent==0 ){
119121
fossil_panic("Object #%d is not an event", rid);
120122
}
123
+ blob_init(&comment, pEvent->zComment, -1);
121124
blob_init(&fullbody, pEvent->zWiki, -1);
122
- if( wiki_find_title(&fullbody, &title, &tail) ){
125
+ haveTitle = wiki_find_title(&fullbody, &title, &tail);
126
+ if( haveTitle ){
123127
style_header(blob_str(&title));
124128
}else{
125129
style_header("Event %S", zEventId);
126130
tail = fullbody;
127131
}
@@ -160,11 +164,10 @@
160164
}
161165
162166
if( showDetail && g.okHistory ){
163167
int i;
164168
const char *zClr = 0;
165
- Blob comment;
166169
167170
zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
168171
@ <p>Event [<a href="%s(g.zTop)/artifact/%s(zUuid)">%S(zUuid)</a>] at
169172
@ [<a href="%s(g.zTop)/timeline?c=%T(zETime)">%s(zETime)</a>]
170173
@ entered by user <b>%h(pEvent->zUser)</b> on
@@ -179,17 +182,22 @@
179182
if( zClr ){
180183
@ <div style="background-color: %h(zClr);">
181184
}else{
182185
@ <div>
183186
}
184
- blob_init(&comment, pEvent->zComment, -1);
185
- wiki_convert(&comment, 0, WIKI_INLINE);
186
- blob_reset(&comment);
187
+ if( haveTitle ){
188
+ /* Don't display comment if it's used as the inline title below */
189
+ wiki_convert(&comment, 0, WIKI_INLINE);
190
+ }
187191
@ </div>
188192
@ </blockquote><hr />
189193
}
190194
195
+ @ <h2>
196
+ wiki_convert(haveTitle ? &title : &comment, 0, WIKI_INLINE);
197
+ @ </h2>
198
+
191199
wiki_convert(&tail, 0, 0);
192200
style_footer();
193201
manifest_destroy(pEvent);
194202
}
195203
196204
--- src/event.c
+++ src/event.c
@@ -64,12 +64,14 @@
64 char *zETime; /* Time of the event */
65 char *zATime; /* Time the artifact was created */
66 int specRid; /* rid specified by aid= parameter */
67 int prevRid, nextRid; /* Previous or next edits of this event */
68 Manifest *pEvent; /* Parsed event artifact */
 
69 Blob fullbody; /* Complete content of the event body */
70 Blob title; /* Title extracted from the event body */
 
71 Blob tail; /* Event body that comes after the title */
72 Stmt q1; /* Query to search for the event */
73 int showDetail; /* True to show details */
74
75
@@ -116,12 +118,14 @@
116 */
117 pEvent = manifest_get(rid, CFTYPE_EVENT);
118 if( pEvent==0 ){
119 fossil_panic("Object #%d is not an event", rid);
120 }
 
121 blob_init(&fullbody, pEvent->zWiki, -1);
122 if( wiki_find_title(&fullbody, &title, &tail) ){
 
123 style_header(blob_str(&title));
124 }else{
125 style_header("Event %S", zEventId);
126 tail = fullbody;
127 }
@@ -160,11 +164,10 @@
160 }
161
162 if( showDetail && g.okHistory ){
163 int i;
164 const char *zClr = 0;
165 Blob comment;
166
167 zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
168 @ <p>Event [<a href="%s(g.zTop)/artifact/%s(zUuid)">%S(zUuid)</a>] at
169 @ [<a href="%s(g.zTop)/timeline?c=%T(zETime)">%s(zETime)</a>]
170 @ entered by user <b>%h(pEvent->zUser)</b> on
@@ -179,17 +182,22 @@
179 if( zClr ){
180 @ <div style="background-color: %h(zClr);">
181 }else{
182 @ <div>
183 }
184 blob_init(&comment, pEvent->zComment, -1);
185 wiki_convert(&comment, 0, WIKI_INLINE);
186 blob_reset(&comment);
 
187 @ </div>
188 @ </blockquote><hr />
189 }
190
 
 
 
 
191 wiki_convert(&tail, 0, 0);
192 style_footer();
193 manifest_destroy(pEvent);
194 }
195
196
--- src/event.c
+++ src/event.c
@@ -64,12 +64,14 @@
64 char *zETime; /* Time of the event */
65 char *zATime; /* Time the artifact was created */
66 int specRid; /* rid specified by aid= parameter */
67 int prevRid, nextRid; /* Previous or next edits of this event */
68 Manifest *pEvent; /* Parsed event artifact */
69 Blob comment; /* Comment shown in timeline */
70 Blob fullbody; /* Complete content of the event body */
71 Blob title; /* Title extracted from the event body */
72 int haveTitle; /* Whether a title was extracted */
73 Blob tail; /* Event body that comes after the title */
74 Stmt q1; /* Query to search for the event */
75 int showDetail; /* True to show details */
76
77
@@ -116,12 +118,14 @@
118 */
119 pEvent = manifest_get(rid, CFTYPE_EVENT);
120 if( pEvent==0 ){
121 fossil_panic("Object #%d is not an event", rid);
122 }
123 blob_init(&comment, pEvent->zComment, -1);
124 blob_init(&fullbody, pEvent->zWiki, -1);
125 haveTitle = wiki_find_title(&fullbody, &title, &tail);
126 if( haveTitle ){
127 style_header(blob_str(&title));
128 }else{
129 style_header("Event %S", zEventId);
130 tail = fullbody;
131 }
@@ -160,11 +164,10 @@
164 }
165
166 if( showDetail && g.okHistory ){
167 int i;
168 const char *zClr = 0;
 
169
170 zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
171 @ <p>Event [<a href="%s(g.zTop)/artifact/%s(zUuid)">%S(zUuid)</a>] at
172 @ [<a href="%s(g.zTop)/timeline?c=%T(zETime)">%s(zETime)</a>]
173 @ entered by user <b>%h(pEvent->zUser)</b> on
@@ -179,17 +182,22 @@
182 if( zClr ){
183 @ <div style="background-color: %h(zClr);">
184 }else{
185 @ <div>
186 }
187 if( haveTitle ){
188 /* Don't display comment if it's used as the inline title below */
189 wiki_convert(&comment, 0, WIKI_INLINE);
190 }
191 @ </div>
192 @ </blockquote><hr />
193 }
194
195 @ <h2>
196 wiki_convert(haveTitle ? &title : &comment, 0, WIKI_INLINE);
197 @ </h2>
198
199 wiki_convert(&tail, 0, 0);
200 style_footer();
201 manifest_destroy(pEvent);
202 }
203
204

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button