Fossil SCM
Add a configuration option that will truncate the display of check-in comments on timelines at the first blank line.
Commit
96101215aefb4691b26e85337d2a2dbd1d845ec4
Parent
953357515ccf2fc…
2 files changed
+6
+15
+6
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -1375,10 +1375,16 @@ | ||
| 1375 | 1375 | "timeline-plaintext", "tpt", 0, 0); |
| 1376 | 1376 | @ <p>In timeline displays, check-in comments are displayed literally, |
| 1377 | 1377 | @ without any wiki or HTML interpretation. (Note: Use CSS to change |
| 1378 | 1378 | @ display formatting features such as fonts and line-wrapping behavior.)</p> |
| 1379 | 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 | + | |
| 1380 | 1386 | @ <hr /> |
| 1381 | 1387 | onoff_attribute("Use Universal Coordinated Time (UTC)", |
| 1382 | 1388 | "timeline-utc", "utc", 1, 0); |
| 1383 | 1389 | @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or |
| 1384 | 1390 | @ Zulu) instead of in local time. On this server, local time is currently |
| 1385 | 1391 |
| --- 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 |
+15
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -230,18 +230,20 @@ | ||
| 230 | 230 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 231 | 231 | static Stmt qbranch; |
| 232 | 232 | int pendingEndTr = 0; /* True if a </td></tr> is needed */ |
| 233 | 233 | int vid = 0; /* Current checkout version */ |
| 234 | 234 | int dateFormat = 0; /* 0: HH:MM (default) */ |
| 235 | + int bCommentGitStyle = 0; /* Only show comments through first blank line */ | |
| 235 | 236 | const char *zDateFmt; |
| 236 | 237 | |
| 237 | 238 | if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){ |
| 238 | 239 | vid = db_lget_int("checkout", 0); |
| 239 | 240 | } |
| 240 | 241 | zPrevDate[0] = 0; |
| 241 | 242 | mxWikiLen = db_get_int("timeline-max-comment", 0); |
| 242 | 243 | dateFormat = db_get_int("timeline-date-format", 0); |
| 244 | + bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0); | |
| 243 | 245 | zDateFmt = P("datefmt"); |
| 244 | 246 | if( zDateFmt ) dateFormat = atoi(zDateFmt); |
| 245 | 247 | if( tmFlags & TIMELINE_GRAPH ){ |
| 246 | 248 | pGraph = graph_init(); |
| 247 | 249 | } |
| @@ -434,10 +436,23 @@ | ||
| 434 | 436 | db_column_blob(pQuery, commentColumn, &comment); |
| 435 | 437 | if( zType[0]!='c' ){ |
| 436 | 438 | /* Comments for anything other than a check-in are generated by |
| 437 | 439 | ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */ |
| 438 | 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> | |
| 439 | 454 | }else if( mxWikiLen>0 && blob_size(&comment)>mxWikiLen ){ |
| 440 | 455 | Blob truncated; |
| 441 | 456 | blob_zero(&truncated); |
| 442 | 457 | blob_append(&truncated, blob_buffer(&comment), mxWikiLen); |
| 443 | 458 | blob_append(&truncated, "...", 3); |
| 444 | 459 |
| --- 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 |