Fossil SCM

Add a configuration option that will truncate the display of check-in comments on timelines at the first blank line.

drh 2015-12-25 03:20 trunk
Commit 96101215aefb4691b26e85337d2a2dbd1d845ec4
2 files changed +6 +15
--- src/setup.c
+++ src/setup.c
@@ -1375,10 +1375,16 @@
13751375
"timeline-plaintext", "tpt", 0, 0);
13761376
@ <p>In timeline displays, check-in comments are displayed literally,
13771377
@ without any wiki or HTML interpretation. (Note: Use CSS to change
13781378
@ display formatting features such as fonts and line-wrapping behavior.)</p>
13791379
1380
+ @ <hr />
1381
+ onoff_attribute("Truncate comment at first blank line",
1382
+ "timeline-truncate-at-blank", "ttb", 0, 0);
1383
+ @ <p>In timeline displays, check-in comments are displayed only through
1384
+ @ the first blank line.</p>
1385
+
13801386
@ <hr />
13811387
onoff_attribute("Use Universal Coordinated Time (UTC)",
13821388
"timeline-utc", "utc", 1, 0);
13831389
@ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
13841390
@ Zulu) instead of in local time. On this server, local time is currently
13851391
--- src/setup.c
+++ src/setup.c
@@ -1375,10 +1375,16 @@
1375 "timeline-plaintext", "tpt", 0, 0);
1376 @ <p>In timeline displays, check-in comments are displayed literally,
1377 @ without any wiki or HTML interpretation. (Note: Use CSS to change
1378 @ display formatting features such as fonts and line-wrapping behavior.)</p>
1379
 
 
 
 
 
 
1380 @ <hr />
1381 onoff_attribute("Use Universal Coordinated Time (UTC)",
1382 "timeline-utc", "utc", 1, 0);
1383 @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
1384 @ Zulu) instead of in local time. On this server, local time is currently
1385
--- src/setup.c
+++ src/setup.c
@@ -1375,10 +1375,16 @@
1375 "timeline-plaintext", "tpt", 0, 0);
1376 @ <p>In timeline displays, check-in comments are displayed literally,
1377 @ without any wiki or HTML interpretation. (Note: Use CSS to change
1378 @ display formatting features such as fonts and line-wrapping behavior.)</p>
1379
1380 @ <hr />
1381 onoff_attribute("Truncate comment at first blank line",
1382 "timeline-truncate-at-blank", "ttb", 0, 0);
1383 @ <p>In timeline displays, check-in comments are displayed only through
1384 @ the first blank line.</p>
1385
1386 @ <hr />
1387 onoff_attribute("Use Universal Coordinated Time (UTC)",
1388 "timeline-utc", "utc", 1, 0);
1389 @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
1390 @ Zulu) instead of in local time. On this server, local time is currently
1391
--- src/timeline.c
+++ src/timeline.c
@@ -230,18 +230,20 @@
230230
Stmt fchngQuery; /* Query for file changes on check-ins */
231231
static Stmt qbranch;
232232
int pendingEndTr = 0; /* True if a </td></tr> is needed */
233233
int vid = 0; /* Current checkout version */
234234
int dateFormat = 0; /* 0: HH:MM (default) */
235
+ int bCommentGitStyle = 0; /* Only show comments through first blank line */
235236
const char *zDateFmt;
236237
237238
if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
238239
vid = db_lget_int("checkout", 0);
239240
}
240241
zPrevDate[0] = 0;
241242
mxWikiLen = db_get_int("timeline-max-comment", 0);
242243
dateFormat = db_get_int("timeline-date-format", 0);
244
+ bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
243245
zDateFmt = P("datefmt");
244246
if( zDateFmt ) dateFormat = atoi(zDateFmt);
245247
if( tmFlags & TIMELINE_GRAPH ){
246248
pGraph = graph_init();
247249
}
@@ -434,10 +436,23 @@
434436
db_column_blob(pQuery, commentColumn, &comment);
435437
if( zType[0]!='c' ){
436438
/* Comments for anything other than a check-in are generated by
437439
** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
438440
wiki_convert(&comment, 0, WIKI_INLINE);
441
+ }else if( bCommentGitStyle ){
442
+ /* Truncate comment at first blank line */
443
+ int ii, jj;
444
+ int n = blob_size(&comment);
445
+ char *z = blob_str(&comment);
446
+ for(ii=0; ii<n; ii++){
447
+ if( z[ii]=='\n' ){
448
+ for(jj=ii+1; jj<n && z[jj]!='\n' && fossil_isspace(z[jj]); jj++){}
449
+ if( z[jj]=='\n' ) break;
450
+ }
451
+ }
452
+ z[ii] = 0;
453
+ @ <span class="timelineComment">%W(z)</span>
439454
}else if( mxWikiLen>0 && blob_size(&comment)>mxWikiLen ){
440455
Blob truncated;
441456
blob_zero(&truncated);
442457
blob_append(&truncated, blob_buffer(&comment), mxWikiLen);
443458
blob_append(&truncated, "...", 3);
444459
--- src/timeline.c
+++ src/timeline.c
@@ -230,18 +230,20 @@
230 Stmt fchngQuery; /* Query for file changes on check-ins */
231 static Stmt qbranch;
232 int pendingEndTr = 0; /* True if a </td></tr> is needed */
233 int vid = 0; /* Current checkout version */
234 int dateFormat = 0; /* 0: HH:MM (default) */
 
235 const char *zDateFmt;
236
237 if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
238 vid = db_lget_int("checkout", 0);
239 }
240 zPrevDate[0] = 0;
241 mxWikiLen = db_get_int("timeline-max-comment", 0);
242 dateFormat = db_get_int("timeline-date-format", 0);
 
243 zDateFmt = P("datefmt");
244 if( zDateFmt ) dateFormat = atoi(zDateFmt);
245 if( tmFlags & TIMELINE_GRAPH ){
246 pGraph = graph_init();
247 }
@@ -434,10 +436,23 @@
434 db_column_blob(pQuery, commentColumn, &comment);
435 if( zType[0]!='c' ){
436 /* Comments for anything other than a check-in are generated by
437 ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
438 wiki_convert(&comment, 0, WIKI_INLINE);
 
 
 
 
 
 
 
 
 
 
 
 
 
439 }else if( mxWikiLen>0 && blob_size(&comment)>mxWikiLen ){
440 Blob truncated;
441 blob_zero(&truncated);
442 blob_append(&truncated, blob_buffer(&comment), mxWikiLen);
443 blob_append(&truncated, "...", 3);
444
--- src/timeline.c
+++ src/timeline.c
@@ -230,18 +230,20 @@
230 Stmt fchngQuery; /* Query for file changes on check-ins */
231 static Stmt qbranch;
232 int pendingEndTr = 0; /* True if a </td></tr> is needed */
233 int vid = 0; /* Current checkout version */
234 int dateFormat = 0; /* 0: HH:MM (default) */
235 int bCommentGitStyle = 0; /* Only show comments through first blank line */
236 const char *zDateFmt;
237
238 if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
239 vid = db_lget_int("checkout", 0);
240 }
241 zPrevDate[0] = 0;
242 mxWikiLen = db_get_int("timeline-max-comment", 0);
243 dateFormat = db_get_int("timeline-date-format", 0);
244 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
245 zDateFmt = P("datefmt");
246 if( zDateFmt ) dateFormat = atoi(zDateFmt);
247 if( tmFlags & TIMELINE_GRAPH ){
248 pGraph = graph_init();
249 }
@@ -434,10 +436,23 @@
436 db_column_blob(pQuery, commentColumn, &comment);
437 if( zType[0]!='c' ){
438 /* Comments for anything other than a check-in are generated by
439 ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
440 wiki_convert(&comment, 0, WIKI_INLINE);
441 }else if( bCommentGitStyle ){
442 /* Truncate comment at first blank line */
443 int ii, jj;
444 int n = blob_size(&comment);
445 char *z = blob_str(&comment);
446 for(ii=0; ii<n; ii++){
447 if( z[ii]=='\n' ){
448 for(jj=ii+1; jj<n && z[jj]!='\n' && fossil_isspace(z[jj]); jj++){}
449 if( z[jj]=='\n' ) break;
450 }
451 }
452 z[ii] = 0;
453 @ <span class="timelineComment">%W(z)</span>
454 }else if( mxWikiLen>0 && blob_size(&comment)>mxWikiLen ){
455 Blob truncated;
456 blob_zero(&truncated);
457 blob_append(&truncated, blob_buffer(&comment), mxWikiLen);
458 blob_append(&truncated, "...", 3);
459

Keyboard Shortcuts

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