Fossil

Check-in [8af02551]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add an option to preserve newlines as hard line breaks on the www timeline display.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8af02551c5a71e05579843e414498fceffe8af83e341dc45a6ca74ac9e16a27d
User & Date: drh 2019-01-16 01:01:01
Context
2019-01-17
00:20
Add the bid= query parameter to the /timeline page. check-in: 8cb1b231 user: drh tags: trunk
2019-01-16
01:01
Add an option to preserve newlines as hard line breaks on the www timeline display. check-in: 8af02551 user: drh tags: trunk
00:14
For the "file info NAME" command, if NAME is directory, give a sensible error message. check-in: 0ee8c8cd user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/printf.c.

   226    226       if( altForm2 || db_get_boolean("timeline-block-markup", 0) ){
   227    227         wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
   228    228       }else{
   229    229         wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
   230    230       }
   231    231       if( db_get_boolean("timeline-plaintext", 0) ){
   232    232         wikiFlags |= WIKI_LINKSONLY;
          233  +    }
          234  +    if( db_get_boolean("timeline-hard-newlines", 0) ){
          235  +      wikiFlags |= WIKI_NEWLINE;
   233    236       }
   234    237     }
   235    238     return wikiFlags;
   236    239   }
   237    240   
   238    241   
   239    242   

Changes to src/setup.c.

   690    690                     "timeline-plaintext", "tpt", 0, 0);
   691    691     @ <p>In timeline displays, check-in comments are displayed literally,
   692    692     @ without any wiki or HTML interpretation.  Use CSS to change
   693    693     @ display formatting features such as fonts and line-wrapping behavior.
   694    694     @ (Property: "timeline-plaintext")</p>
   695    695   
   696    696     @ <hr />
   697         -  onoff_attribute("Truncate comment at first blank line",
          697  +  onoff_attribute("Truncate comment at first blank line (Git-style)",
   698    698                     "timeline-truncate-at-blank", "ttb", 0, 0);
   699    699     @ <p>In timeline displays, check-in comments are displayed only through
   700         -  @ the first blank line. (Property: "timeline-truncate-at-blank")</p>
          700  +  @ the first blank line.  This is the traditional way to display comments
          701  +  @ in Git repositories (Property: "timeline-truncate-at-blank")</p>
          702  +
          703  +  @ <hr />
          704  +  onoff_attribute("Break comments at newline characters",
          705  +                  "timeline-hard-newlines", "thnl", 0, 0);
          706  +  @ <p>In timeline displays, newline characters in check-in comments force
          707  +  @ a line break on the display.
          708  +  @ (Property: "timeline-hard-newlines")</p>
   701    709   
   702    710     @ <hr />
   703    711     onoff_attribute("Use Universal Coordinated Time (UTC)",
   704    712                     "timeline-utc", "utc", 1, 0);
   705    713     @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
   706    714     @ Zulu) instead of in local time.  On this server, local time is currently
   707    715     tmDiff = db_double(0.0, "SELECT julianday('now')");

Changes to src/wikiformat.c.

    27     27   */
    28     28   #define WIKI_HTMLONLY       0x001  /* HTML markup only.  No wiki */
    29     29   #define WIKI_INLINE         0x002  /* Do not surround with <p>..</p> */
    30     30   #define WIKI_NOBLOCK        0x004  /* No block markup of any kind */
    31     31   #define WIKI_BUTTONS        0x008  /* Allow sub-menu buttons */
    32     32   #define WIKI_NOBADLINKS     0x010  /* Ignore broken hyperlinks */
    33     33   #define WIKI_LINKSONLY      0x020  /* No markup.  Only decorate links */
           34  +#define WIKI_NEWLINE        0x040  /* Honor \n - break lines at each \n */
    34     35   #endif
    35     36   
    36     37   
    37     38   /*
    38     39   ** These are the only markup attributes allowed.
    39     40   */
    40     41   enum allowed_attr_t {
................................................................................
   679    680     }
   680    681     if( (p->state & ALLOW_WIKI)!=0 ){
   681    682       if( z[0]=='\n' ){
   682    683         n = paragraphBreakLength(z);
   683    684         if( n>0 ){
   684    685           *pTokenType = TOKEN_PARAGRAPH;
   685    686           return n;
   686         -      }else if( fossil_isspace(z[1]) ){
          687  +      }else{
   687    688           *pTokenType = TOKEN_NEWLINE;
   688    689           return 1;
   689    690         }
   690    691       }
   691    692       if( (p->state & AT_NEWLINE)!=0 && fossil_isspace(z[0]) ){
   692    693         n = listItemLength(z, '*');
   693    694         if( n>0 ){
................................................................................
  1377   1378             blob_append(p->pOut, "\n\n", 1);
  1378   1379             p->wantAutoParagraph = 1;
  1379   1380           }
  1380   1381           p->state |= AT_PARAGRAPH|AT_NEWLINE;
  1381   1382           break;
  1382   1383         }
  1383   1384         case TOKEN_NEWLINE: {
  1384         -        blob_append(p->pOut, "\n", 1);
         1385  +        if( p->renderFlags & WIKI_NEWLINE ){
         1386  +          blob_append(p->pOut, "<br>\n", 5);
         1387  +        }else{
         1388  +          blob_append(p->pOut, "\n", 1);
         1389  +        }
  1385   1390           p->state |= AT_NEWLINE;
  1386   1391           break;
  1387   1392         }
  1388   1393         case TOKEN_BUL_LI: {
  1389   1394           if( inlineOnly ){
  1390   1395             blob_append(p->pOut, " &bull; ", -1);
  1391   1396           }else{