Fossil SCM
Don't duplicate title in body
Commit
5ab4db5a16bfe227e661b39c06cfc1491e8e58cdd7cb2dd4dc90a8316c53bea2
Parent
b36643651c6fb68…
1 file changed
+15
-14
+15
-14
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -408,25 +408,26 @@ | ||
| 408 | 408 | struct Blob *output_title, /* Put title here. May be NULL */ |
| 409 | 409 | struct Blob *output_body /* Put document body here. */ |
| 410 | 410 | ){ |
| 411 | 411 | blob_reset(output_body); |
| 412 | 412 | char * markdown_string = blob_str(input_markdown); |
| 413 | - char *cmark_result = cmark_markdown_to_html(markdown_string, blob_size(input_markdown), 0 ); | |
| 414 | 413 | if( output_title ) { |
| 415 | - blob_reset(output_title); | |
| 416 | - if (strlen(markdown_string) > 0 && markdown_string[0] == '#' ) { | |
| 417 | - if (strlen(markdown_string + 1) > 0) { | |
| 418 | - char * title_start = markdown_string + 1; | |
| 419 | - int i = 0; | |
| 420 | - while (markdown_string[i]!='\0' && | |
| 421 | - (markdown_string[i]!='\n' && markdown_string[i]!='\r') ) { | |
| 422 | - i++; | |
| 423 | - } | |
| 424 | - blob_append(output_title, title_start, i); | |
| 425 | - } | |
| 426 | - } | |
| 427 | - } | |
| 414 | + blob_reset(output_title); | |
| 415 | + if (strlen(markdown_string) > 0 && markdown_string[0] == '#' ) { | |
| 416 | + if (strlen(markdown_string + 1) > 0) { | |
| 417 | + char * title_start = markdown_string + 1; | |
| 418 | + int i = 0; | |
| 419 | + while (markdown_string[i]!='\0' && | |
| 420 | + (markdown_string[i]!='\n' && markdown_string[i]!='\r') ) { | |
| 421 | + i++; | |
| 422 | + } | |
| 423 | + blob_append(output_title, title_start, i); | |
| 424 | + markdown_string = markdown_string+i; | |
| 425 | + } | |
| 426 | + } | |
| 427 | + } | |
| 428 | + char *cmark_result = cmark_markdown_to_html(markdown_string, strlen(markdown_string), 0 ); | |
| 428 | 429 | html_prolog(output_body,0); |
| 429 | 430 | blob_append(output_body, cmark_result, strlen(cmark_result)); |
| 430 | 431 | html_epilog(output_body,0); |
| 431 | 432 | free(cmark_result); |
| 432 | 433 | } |
| 433 | 434 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -408,25 +408,26 @@ | |
| 408 | struct Blob *output_title, /* Put title here. May be NULL */ |
| 409 | struct Blob *output_body /* Put document body here. */ |
| 410 | ){ |
| 411 | blob_reset(output_body); |
| 412 | char * markdown_string = blob_str(input_markdown); |
| 413 | char *cmark_result = cmark_markdown_to_html(markdown_string, blob_size(input_markdown), 0 ); |
| 414 | if( output_title ) { |
| 415 | blob_reset(output_title); |
| 416 | if (strlen(markdown_string) > 0 && markdown_string[0] == '#' ) { |
| 417 | if (strlen(markdown_string + 1) > 0) { |
| 418 | char * title_start = markdown_string + 1; |
| 419 | int i = 0; |
| 420 | while (markdown_string[i]!='\0' && |
| 421 | (markdown_string[i]!='\n' && markdown_string[i]!='\r') ) { |
| 422 | i++; |
| 423 | } |
| 424 | blob_append(output_title, title_start, i); |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | html_prolog(output_body,0); |
| 429 | blob_append(output_body, cmark_result, strlen(cmark_result)); |
| 430 | html_epilog(output_body,0); |
| 431 | free(cmark_result); |
| 432 | } |
| 433 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -408,25 +408,26 @@ | |
| 408 | struct Blob *output_title, /* Put title here. May be NULL */ |
| 409 | struct Blob *output_body /* Put document body here. */ |
| 410 | ){ |
| 411 | blob_reset(output_body); |
| 412 | char * markdown_string = blob_str(input_markdown); |
| 413 | if( output_title ) { |
| 414 | blob_reset(output_title); |
| 415 | if (strlen(markdown_string) > 0 && markdown_string[0] == '#' ) { |
| 416 | if (strlen(markdown_string + 1) > 0) { |
| 417 | char * title_start = markdown_string + 1; |
| 418 | int i = 0; |
| 419 | while (markdown_string[i]!='\0' && |
| 420 | (markdown_string[i]!='\n' && markdown_string[i]!='\r') ) { |
| 421 | i++; |
| 422 | } |
| 423 | blob_append(output_title, title_start, i); |
| 424 | markdown_string = markdown_string+i; |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | char *cmark_result = cmark_markdown_to_html(markdown_string, strlen(markdown_string), 0 ); |
| 429 | html_prolog(output_body,0); |
| 430 | blob_append(output_body, cmark_result, strlen(cmark_result)); |
| 431 | html_epilog(output_body,0); |
| 432 | free(cmark_result); |
| 433 | } |
| 434 |