Fossil SCM
Move the implementation of the test-markdown-render command so that it is beside the test-wiki-render command in wikiformat.c. Also make minor enhancements to the help text for both commands.
Commit
fcb20df757ad8f214b5270ef0d24de139579ebdbe8e83d6d44437e43d6984858
Parent
199b20d0e150d31…
2 files changed
-21
+23
-21
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -1619,31 +1619,10 @@ | ||
| 1619 | 1619 | |
| 1620 | 1620 | wiki_cmd_usage: |
| 1621 | 1621 | usage("export|create|commit|list ..."); |
| 1622 | 1622 | } |
| 1623 | 1623 | |
| 1624 | -/* | |
| 1625 | -** COMMAND: test-markdown-render | |
| 1626 | -** | |
| 1627 | -** Usage: %fossil test-markdown-render FILE | |
| 1628 | -** | |
| 1629 | -** Render markdown wiki from FILE to stdout. | |
| 1630 | -** | |
| 1631 | -*/ | |
| 1632 | -void test_markdown_render(void){ | |
| 1633 | - Blob in, out; | |
| 1634 | - db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); | |
| 1635 | - verify_all_options(); | |
| 1636 | - if( g.argc!=3 ) usage("FILE"); | |
| 1637 | - blob_zero(&out); | |
| 1638 | - blob_read_from_file(&in, g.argv[2], ExtFILE); | |
| 1639 | - markdown_to_html(&in, 0, &out); | |
| 1640 | - blob_write_to_file(&out, "-"); | |
| 1641 | - blob_reset(&in); | |
| 1642 | - blob_reset(&out); | |
| 1643 | -} | |
| 1644 | - | |
| 1645 | 1624 | /* |
| 1646 | 1625 | ** Allowed flags for wiki_render_associated |
| 1647 | 1626 | */ |
| 1648 | 1627 | #if INTERFACE |
| 1649 | 1628 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 1650 | 1629 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1619,31 +1619,10 @@ | |
| 1619 | |
| 1620 | wiki_cmd_usage: |
| 1621 | usage("export|create|commit|list ..."); |
| 1622 | } |
| 1623 | |
| 1624 | /* |
| 1625 | ** COMMAND: test-markdown-render |
| 1626 | ** |
| 1627 | ** Usage: %fossil test-markdown-render FILE |
| 1628 | ** |
| 1629 | ** Render markdown wiki from FILE to stdout. |
| 1630 | ** |
| 1631 | */ |
| 1632 | void test_markdown_render(void){ |
| 1633 | Blob in, out; |
| 1634 | db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); |
| 1635 | verify_all_options(); |
| 1636 | if( g.argc!=3 ) usage("FILE"); |
| 1637 | blob_zero(&out); |
| 1638 | blob_read_from_file(&in, g.argv[2], ExtFILE); |
| 1639 | markdown_to_html(&in, 0, &out); |
| 1640 | blob_write_to_file(&out, "-"); |
| 1641 | blob_reset(&in); |
| 1642 | blob_reset(&out); |
| 1643 | } |
| 1644 | |
| 1645 | /* |
| 1646 | ** Allowed flags for wiki_render_associated |
| 1647 | */ |
| 1648 | #if INTERFACE |
| 1649 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 1650 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1619,31 +1619,10 @@ | |
| 1619 | |
| 1620 | wiki_cmd_usage: |
| 1621 | usage("export|create|commit|list ..."); |
| 1622 | } |
| 1623 | |
| 1624 | /* |
| 1625 | ** Allowed flags for wiki_render_associated |
| 1626 | */ |
| 1627 | #if INTERFACE |
| 1628 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 1629 |
+23
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -1777,10 +1777,13 @@ | ||
| 1777 | 1777 | /* |
| 1778 | 1778 | ** COMMAND: test-wiki-render |
| 1779 | 1779 | ** |
| 1780 | 1780 | ** Usage: %fossil test-wiki-render FILE [OPTIONS] |
| 1781 | 1781 | ** |
| 1782 | +** Translate the input FILE from Fossil-wiki into HTML and write | |
| 1783 | +** the resulting HTML on standard output. | |
| 1784 | +** | |
| 1782 | 1785 | ** Options: |
| 1783 | 1786 | ** --buttons Set the WIKI_BUTTONS flag |
| 1784 | 1787 | ** --htmlonly Set the WIKI_HTMLONLY flag |
| 1785 | 1788 | ** --linksonly Set the WIKI_LINKSONLY flag |
| 1786 | 1789 | ** --nobadlinks Set the WIKI_NOBADLINKS flag |
| @@ -1802,10 +1805,30 @@ | ||
| 1802 | 1805 | blob_zero(&out); |
| 1803 | 1806 | blob_read_from_file(&in, g.argv[2], ExtFILE); |
| 1804 | 1807 | wiki_convert(&in, &out, flags); |
| 1805 | 1808 | blob_write_to_file(&out, "-"); |
| 1806 | 1809 | } |
| 1810 | + | |
| 1811 | +/* | |
| 1812 | +** COMMAND: test-markdown-render | |
| 1813 | +** | |
| 1814 | +** Usage: %fossil test-markdown-render FILE | |
| 1815 | +** | |
| 1816 | +** Render markdown in FILE as HTML on stdout. | |
| 1817 | +*/ | |
| 1818 | +void test_markdown_render(void){ | |
| 1819 | + Blob in, out; | |
| 1820 | + db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); | |
| 1821 | + verify_all_options(); | |
| 1822 | + if( g.argc!=3 ) usage("FILE"); | |
| 1823 | + blob_zero(&out); | |
| 1824 | + blob_read_from_file(&in, g.argv[2], ExtFILE); | |
| 1825 | + markdown_to_html(&in, 0, &out); | |
| 1826 | + blob_write_to_file(&out, "-"); | |
| 1827 | + blob_reset(&in); | |
| 1828 | + blob_reset(&out); | |
| 1829 | +} | |
| 1807 | 1830 | |
| 1808 | 1831 | /* |
| 1809 | 1832 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1810 | 1833 | ** Return true (nonzero) if a title is found. Return zero if there is |
| 1811 | 1834 | ** not title. |
| 1812 | 1835 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1777,10 +1777,13 @@ | |
| 1777 | /* |
| 1778 | ** COMMAND: test-wiki-render |
| 1779 | ** |
| 1780 | ** Usage: %fossil test-wiki-render FILE [OPTIONS] |
| 1781 | ** |
| 1782 | ** Options: |
| 1783 | ** --buttons Set the WIKI_BUTTONS flag |
| 1784 | ** --htmlonly Set the WIKI_HTMLONLY flag |
| 1785 | ** --linksonly Set the WIKI_LINKSONLY flag |
| 1786 | ** --nobadlinks Set the WIKI_NOBADLINKS flag |
| @@ -1802,10 +1805,30 @@ | |
| 1802 | blob_zero(&out); |
| 1803 | blob_read_from_file(&in, g.argv[2], ExtFILE); |
| 1804 | wiki_convert(&in, &out, flags); |
| 1805 | blob_write_to_file(&out, "-"); |
| 1806 | } |
| 1807 | |
| 1808 | /* |
| 1809 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1810 | ** Return true (nonzero) if a title is found. Return zero if there is |
| 1811 | ** not title. |
| 1812 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1777,10 +1777,13 @@ | |
| 1777 | /* |
| 1778 | ** COMMAND: test-wiki-render |
| 1779 | ** |
| 1780 | ** Usage: %fossil test-wiki-render FILE [OPTIONS] |
| 1781 | ** |
| 1782 | ** Translate the input FILE from Fossil-wiki into HTML and write |
| 1783 | ** the resulting HTML on standard output. |
| 1784 | ** |
| 1785 | ** Options: |
| 1786 | ** --buttons Set the WIKI_BUTTONS flag |
| 1787 | ** --htmlonly Set the WIKI_HTMLONLY flag |
| 1788 | ** --linksonly Set the WIKI_LINKSONLY flag |
| 1789 | ** --nobadlinks Set the WIKI_NOBADLINKS flag |
| @@ -1802,10 +1805,30 @@ | |
| 1805 | blob_zero(&out); |
| 1806 | blob_read_from_file(&in, g.argv[2], ExtFILE); |
| 1807 | wiki_convert(&in, &out, flags); |
| 1808 | blob_write_to_file(&out, "-"); |
| 1809 | } |
| 1810 | |
| 1811 | /* |
| 1812 | ** COMMAND: test-markdown-render |
| 1813 | ** |
| 1814 | ** Usage: %fossil test-markdown-render FILE |
| 1815 | ** |
| 1816 | ** Render markdown in FILE as HTML on stdout. |
| 1817 | */ |
| 1818 | void test_markdown_render(void){ |
| 1819 | Blob in, out; |
| 1820 | db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); |
| 1821 | verify_all_options(); |
| 1822 | if( g.argc!=3 ) usage("FILE"); |
| 1823 | blob_zero(&out); |
| 1824 | blob_read_from_file(&in, g.argv[2], ExtFILE); |
| 1825 | markdown_to_html(&in, 0, &out); |
| 1826 | blob_write_to_file(&out, "-"); |
| 1827 | blob_reset(&in); |
| 1828 | blob_reset(&out); |
| 1829 | } |
| 1830 | |
| 1831 | /* |
| 1832 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1833 | ** Return true (nonzero) if a title is found. Return zero if there is |
| 1834 | ** not title. |
| 1835 |