Fossil SCM
Fix minor issues with markdown rendering in wiki.
Commit
4be82a52a558b11a2032e5e7411ca672d562fc10e5de33fb49f8a20788504ae1
Parent
34f36bc211906c9…
1 file changed
+5
-3
+5
-3
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -1683,11 +1683,11 @@ | ||
| 1683 | 1683 | && (zEnd = strchr(z+n+1,')'))!=0 |
| 1684 | 1684 | ){ |
| 1685 | 1685 | /* Markdown-style hyperlinks: [display-text](URL) or [](URL) */ |
| 1686 | 1686 | if( n>2 ){ |
| 1687 | 1687 | zDisplay = &z[1]; |
| 1688 | - z[n] = 0; | |
| 1688 | + z[n-1] = 0; | |
| 1689 | 1689 | }else{ |
| 1690 | 1690 | zDisplay = 0; |
| 1691 | 1691 | } |
| 1692 | 1692 | zTarget = &z[n+1]; |
| 1693 | 1693 | for(i=n+1; z[i] && z[i]!=')' && z[i]!=' '; i++){} |
| @@ -1733,12 +1733,14 @@ | ||
| 1733 | 1733 | case TOKEN_BACKSLASH: { |
| 1734 | 1734 | if( (p->state & WIKI_MARKDOWN_FONT)==0 ){ |
| 1735 | 1735 | /* Ignore backslashes in traditional Wiki */ |
| 1736 | 1736 | blob_append_char(p->pOut, '\\'); |
| 1737 | 1737 | n = 1; |
| 1738 | - }else{ | |
| 1738 | + }else if( (z[1]&0x80)!=0 ){ | |
| 1739 | 1739 | blob_append_char(p->pOut, z[1]); |
| 1740 | + }else{ | |
| 1741 | + blob_appendf(p->pOut,"&#%d;", z[1]); | |
| 1740 | 1742 | } |
| 1741 | 1743 | break; |
| 1742 | 1744 | } |
| 1743 | 1745 | case TOKEN_MDCODE: { |
| 1744 | 1746 | if( (p->state & WIKI_MARKDOWN_FONT)==0 ){ |
| @@ -2087,11 +2089,11 @@ | ||
| 2087 | 2089 | ** --text Run the output through html_to_plaintext(). |
| 2088 | 2090 | ** --tokenize Output a tokenization of the input file |
| 2089 | 2091 | */ |
| 2090 | 2092 | void test_wiki_render(void){ |
| 2091 | 2093 | Blob in, out; |
| 2092 | - int flags = 0; | |
| 2094 | + int flags = ALLOW_LINKS; | |
| 2093 | 2095 | int bText, bTokenize; |
| 2094 | 2096 | if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; |
| 2095 | 2097 | if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY; |
| 2096 | 2098 | if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY; |
| 2097 | 2099 | if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS; |
| 2098 | 2100 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1683,11 +1683,11 @@ | |
| 1683 | && (zEnd = strchr(z+n+1,')'))!=0 |
| 1684 | ){ |
| 1685 | /* Markdown-style hyperlinks: [display-text](URL) or [](URL) */ |
| 1686 | if( n>2 ){ |
| 1687 | zDisplay = &z[1]; |
| 1688 | z[n] = 0; |
| 1689 | }else{ |
| 1690 | zDisplay = 0; |
| 1691 | } |
| 1692 | zTarget = &z[n+1]; |
| 1693 | for(i=n+1; z[i] && z[i]!=')' && z[i]!=' '; i++){} |
| @@ -1733,12 +1733,14 @@ | |
| 1733 | case TOKEN_BACKSLASH: { |
| 1734 | if( (p->state & WIKI_MARKDOWN_FONT)==0 ){ |
| 1735 | /* Ignore backslashes in traditional Wiki */ |
| 1736 | blob_append_char(p->pOut, '\\'); |
| 1737 | n = 1; |
| 1738 | }else{ |
| 1739 | blob_append_char(p->pOut, z[1]); |
| 1740 | } |
| 1741 | break; |
| 1742 | } |
| 1743 | case TOKEN_MDCODE: { |
| 1744 | if( (p->state & WIKI_MARKDOWN_FONT)==0 ){ |
| @@ -2087,11 +2089,11 @@ | |
| 2087 | ** --text Run the output through html_to_plaintext(). |
| 2088 | ** --tokenize Output a tokenization of the input file |
| 2089 | */ |
| 2090 | void test_wiki_render(void){ |
| 2091 | Blob in, out; |
| 2092 | int flags = 0; |
| 2093 | int bText, bTokenize; |
| 2094 | if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; |
| 2095 | if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY; |
| 2096 | if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY; |
| 2097 | if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS; |
| 2098 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1683,11 +1683,11 @@ | |
| 1683 | && (zEnd = strchr(z+n+1,')'))!=0 |
| 1684 | ){ |
| 1685 | /* Markdown-style hyperlinks: [display-text](URL) or [](URL) */ |
| 1686 | if( n>2 ){ |
| 1687 | zDisplay = &z[1]; |
| 1688 | z[n-1] = 0; |
| 1689 | }else{ |
| 1690 | zDisplay = 0; |
| 1691 | } |
| 1692 | zTarget = &z[n+1]; |
| 1693 | for(i=n+1; z[i] && z[i]!=')' && z[i]!=' '; i++){} |
| @@ -1733,12 +1733,14 @@ | |
| 1733 | case TOKEN_BACKSLASH: { |
| 1734 | if( (p->state & WIKI_MARKDOWN_FONT)==0 ){ |
| 1735 | /* Ignore backslashes in traditional Wiki */ |
| 1736 | blob_append_char(p->pOut, '\\'); |
| 1737 | n = 1; |
| 1738 | }else if( (z[1]&0x80)!=0 ){ |
| 1739 | blob_append_char(p->pOut, z[1]); |
| 1740 | }else{ |
| 1741 | blob_appendf(p->pOut,"&#%d;", z[1]); |
| 1742 | } |
| 1743 | break; |
| 1744 | } |
| 1745 | case TOKEN_MDCODE: { |
| 1746 | if( (p->state & WIKI_MARKDOWN_FONT)==0 ){ |
| @@ -2087,11 +2089,11 @@ | |
| 2089 | ** --text Run the output through html_to_plaintext(). |
| 2090 | ** --tokenize Output a tokenization of the input file |
| 2091 | */ |
| 2092 | void test_wiki_render(void){ |
| 2093 | Blob in, out; |
| 2094 | int flags = ALLOW_LINKS; |
| 2095 | int bText, bTokenize; |
| 2096 | if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; |
| 2097 | if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY; |
| 2098 | if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY; |
| 2099 | if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS; |
| 2100 |