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.

drh 2019-09-24 10:44 trunk
Commit fcb20df757ad8f214b5270ef0d24de139579ebdbe8e83d6d44437e43d6984858
2 files changed -21 +23
-21
--- src/wiki.c
+++ src/wiki.c
@@ -1619,31 +1619,10 @@
16191619
16201620
wiki_cmd_usage:
16211621
usage("export|create|commit|list ...");
16221622
}
16231623
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
-
16451624
/*
16461625
** Allowed flags for wiki_render_associated
16471626
*/
16481627
#if INTERFACE
16491628
#define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */
16501629
--- 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
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1777,10 +1777,13 @@
17771777
/*
17781778
** COMMAND: test-wiki-render
17791779
**
17801780
** Usage: %fossil test-wiki-render FILE [OPTIONS]
17811781
**
1782
+** Translate the input FILE from Fossil-wiki into HTML and write
1783
+** the resulting HTML on standard output.
1784
+**
17821785
** Options:
17831786
** --buttons Set the WIKI_BUTTONS flag
17841787
** --htmlonly Set the WIKI_HTMLONLY flag
17851788
** --linksonly Set the WIKI_LINKSONLY flag
17861789
** --nobadlinks Set the WIKI_NOBADLINKS flag
@@ -1802,10 +1805,30 @@
18021805
blob_zero(&out);
18031806
blob_read_from_file(&in, g.argv[2], ExtFILE);
18041807
wiki_convert(&in, &out, flags);
18051808
blob_write_to_file(&out, "-");
18061809
}
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
+}
18071830
18081831
/*
18091832
** Search for a <title>...</title> at the beginning of a wiki page.
18101833
** Return true (nonzero) if a title is found. Return zero if there is
18111834
** not title.
18121835
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button