Fossil SCM
Updated the wiki CLI command to account for the sandbox pseudo-page and removed an obsolete TODO.
Commit
7bc942704d2c9356db444bb910dcd67b1c43121d86a22024d2a0d99588fb0fb4
Parent
d9f4b6dbedbe051…
2 files changed
+39
-33
+2
-1
+39
-33
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -1917,13 +1917,18 @@ | ||
| 1917 | 1917 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 1918 | 1918 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 1919 | 1919 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| 1920 | 1920 | ** means UTC. |
| 1921 | 1921 | ** |
| 1922 | +** The "Sandbox" wiki pseudo-page is a special case. Its name is | |
| 1923 | +** checked case-insensitively and either "create" or "commit" may be | |
| 1924 | +** used to update its contents. | |
| 1922 | 1925 | */ |
| 1923 | 1926 | void wiki_cmd(void){ |
| 1924 | 1927 | int n; |
| 1928 | + int isSandbox = 0; /* true if dealing with sandbox pseudo-page */ | |
| 1929 | + | |
| 1925 | 1930 | db_find_and_open_repository(0, 0); |
| 1926 | 1931 | if( g.argc<3 ){ |
| 1927 | 1932 | goto wiki_cmd_usage; |
| 1928 | 1933 | } |
| 1929 | 1934 | n = strlen(g.argv[2]); |
| @@ -1930,14 +1935,14 @@ | ||
| 1930 | 1935 | if( n==0 ){ |
| 1931 | 1936 | goto wiki_cmd_usage; |
| 1932 | 1937 | } |
| 1933 | 1938 | |
| 1934 | 1939 | if( strncmp(g.argv[2],"export",n)==0 ){ |
| 1935 | - const char *zPageName; /* Name of the wiki page to export */ | |
| 1940 | + const char *zPageName = 0; /* Name of the wiki page to export */ | |
| 1936 | 1941 | const char *zFile; /* Name of the output file (0=stdout) */ |
| 1937 | 1942 | const char *zETime; /* The name of the technote to export */ |
| 1938 | - int rid; /* Artifact ID of the wiki page */ | |
| 1943 | + int rid = 0; /* Artifact ID of the wiki page */ | |
| 1939 | 1944 | int i; /* Loop counter */ |
| 1940 | 1945 | char *zBody = 0; /* Wiki page content */ |
| 1941 | 1946 | Blob body = empty_blob; /* Wiki page content */ |
| 1942 | 1947 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| 1943 | 1948 | int fHtml = 0; /* Export in HTML form */ |
| @@ -1955,17 +1960,18 @@ | ||
| 1955 | 1960 | if( !zETime ){ |
| 1956 | 1961 | if( (g.argc!=4) && (g.argc!=5) ){ |
| 1957 | 1962 | usage("export ?-html? PAGENAME ?FILE?"); |
| 1958 | 1963 | } |
| 1959 | 1964 | zPageName = g.argv[3]; |
| 1960 | - rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" | |
| 1961 | - " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" | |
| 1962 | - " ORDER BY x.mtime DESC LIMIT 1", | |
| 1963 | - zPageName | |
| 1964 | - ); | |
| 1965 | - if( (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){ | |
| 1966 | - zBody = pWiki->zWiki; | |
| 1965 | + isSandbox = is_sandbox(zPageName); | |
| 1966 | + if(isSandbox){ | |
| 1967 | + zBody = db_get("sandbox", 0); | |
| 1968 | + }else{ | |
| 1969 | + wiki_fetch_by_name(zPageName, 0, &rid, &pWiki); | |
| 1970 | + if(pWiki){ | |
| 1971 | + zBody = pWiki->zWiki; | |
| 1972 | + } | |
| 1967 | 1973 | } |
| 1968 | 1974 | if( zBody==0 ){ |
| 1969 | 1975 | fossil_fatal("wiki page [%s] not found",zPageName); |
| 1970 | 1976 | } |
| 1971 | 1977 | zFile = (g.argc==4) ? "-" : g.argv[4]; |
| @@ -1991,30 +1997,24 @@ | ||
| 1991 | 1997 | blob_init(&body, zBody, -1); |
| 1992 | 1998 | if(fHtml==0){ |
| 1993 | 1999 | blob_append(&body, "\n", 1); |
| 1994 | 2000 | }else{ |
| 1995 | 2001 | Blob html = empty_blob; /* HTML-ized content */ |
| 1996 | - const char * zMimetype = wiki_filter_mimetypes(pWiki->zMimetype); | |
| 2002 | + const char * zMimetype = isSandbox | |
| 2003 | + ? db_get("sandbox-mimetype", "text/x-fossil-wiki") | |
| 2004 | + : wiki_filter_mimetypes(pWiki->zMimetype); | |
| 1997 | 2005 | if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){ |
| 1998 | 2006 | wiki_convert(&body,&html,0); |
| 1999 | 2007 | }else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){ |
| 2000 | - markdown_to_html(&body,0,&html) | |
| 2001 | - /* TODO: add -HTML|-H flag to work like -html|-h but also | |
| 2002 | - ** add <html><body> tag wrappers around the output. The | |
| 2003 | - ** hurdle here is that the markdown converter resets its | |
| 2004 | - ** input blob before appending the output, which is | |
| 2005 | - ** different from wiki_convert() and htmlize_to_blob(), and | |
| 2006 | - ** precludes us simply appending the opening <html><body> | |
| 2007 | - ** part to the body | |
| 2008 | - */; | |
| 2008 | + markdown_to_html(&body,0,&html); | |
| 2009 | 2009 | safe_html_context(DOCSRC_WIKI); |
| 2010 | 2010 | safe_html(&html); |
| 2011 | 2011 | }else if( fossil_strcmp(zMimetype, "text/plain")==0 ){ |
| 2012 | 2012 | htmlize_to_blob(&html,zBody,i); |
| 2013 | 2013 | }else{ |
| 2014 | 2014 | fossil_fatal("Unsupported MIME type '%s' for wiki page '%s'.", |
| 2015 | - zMimetype, pWiki->zWikiTitle ); | |
| 2015 | + zMimetype, pWiki ? pWiki->zWikiTitle : zPageName ); | |
| 2016 | 2016 | } |
| 2017 | 2017 | blob_reset(&body); |
| 2018 | 2018 | body = html /* transfer memory */; |
| 2019 | 2019 | } |
| 2020 | 2020 | pFile = fossil_fopen_for_output(zFile); |
| @@ -2056,28 +2056,28 @@ | ||
| 2056 | 2056 | if( g.argc==4 ){ |
| 2057 | 2057 | blob_read_from_channel(&content, stdin, -1); |
| 2058 | 2058 | }else{ |
| 2059 | 2059 | blob_read_from_file(&content, g.argv[4], ExtFILE); |
| 2060 | 2060 | } |
| 2061 | + isSandbox = is_sandbox(zPageName); | |
| 2061 | 2062 | if ( !zETime ){ |
| 2062 | - rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" | |
| 2063 | - " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" | |
| 2064 | - " ORDER BY x.mtime DESC LIMIT 1", | |
| 2065 | - zPageName | |
| 2066 | - ); | |
| 2067 | - if( rid>0 ){ | |
| 2068 | - pWiki = manifest_get(rid, CFTYPE_WIKI, 0); | |
| 2063 | + if( !isSandbox ){ | |
| 2064 | + wiki_fetch_by_name(zPageName, 0, &rid, &pWiki); | |
| 2069 | 2065 | } |
| 2070 | 2066 | }else{ |
| 2071 | 2067 | rid = wiki_technote_to_rid(zETime); |
| 2072 | 2068 | if( rid>0 ){ |
| 2073 | 2069 | pWiki = manifest_get(rid, CFTYPE_EVENT, 0); |
| 2074 | 2070 | } |
| 2075 | 2071 | } |
| 2076 | 2072 | if( !zMimeType || !*zMimeType ){ |
| 2077 | 2073 | /* Try to deduce the mime type based on the prior version. */ |
| 2078 | - if( pWiki!=0 && (pWiki->zMimetype && *pWiki->zMimetype) ){ | |
| 2074 | + if(isSandbox){ | |
| 2075 | + zMimeType = | |
| 2076 | + wiki_filter_mimetypes(db_get("sandbox-mimetype", | |
| 2077 | + "text/x-fossil-wiki")); | |
| 2078 | + }else if( pWiki!=0 && (pWiki->zMimetype && *pWiki->zMimetype) ){ | |
| 2079 | 2079 | zMimeType = pWiki->zMimetype; |
| 2080 | 2080 | } |
| 2081 | 2081 | }else{ |
| 2082 | 2082 | zMimeType = wiki_filter_mimetypes(zMimeType); |
| 2083 | 2083 | } |
| @@ -2087,24 +2087,30 @@ | ||
| 2087 | 2087 | }else{ |
| 2088 | 2088 | /* Creating a tech note with same timestamp is permitted |
| 2089 | 2089 | and should create a new tech note */ |
| 2090 | 2090 | rid = 0; |
| 2091 | 2091 | } |
| 2092 | - }else if( !isCreate && rid == 0 ){ | |
| 2092 | + }else if( !isCreate && rid==0 && isSandbox==0 ){ | |
| 2093 | 2093 | if ( !zETime ){ |
| 2094 | 2094 | fossil_fatal("no such wiki page: %s", zPageName); |
| 2095 | 2095 | }else{ |
| 2096 | 2096 | fossil_fatal("no such tech note: %s", zETime); |
| 2097 | 2097 | } |
| 2098 | 2098 | } |
| 2099 | 2099 | |
| 2100 | 2100 | if( !zETime ){ |
| 2101 | - wiki_cmd_commit(zPageName, rid, &content, zMimeType, 1); | |
| 2102 | - if( g.argv[2][1]=='r' ){ | |
| 2103 | - fossil_print("Created new wiki page %s.\n", zPageName); | |
| 2101 | + if(isSandbox){ | |
| 2102 | + db_set("sandbox",blob_str(&content),0); | |
| 2103 | + db_set("sandbox-mimetype",zMimeType,0); | |
| 2104 | + fossil_print("Updated sandbox pseudo-page.\n"); | |
| 2104 | 2105 | }else{ |
| 2105 | - fossil_print("Updated wiki page %s.\n", zPageName); | |
| 2106 | + wiki_cmd_commit(zPageName, rid, &content, zMimeType, 1); | |
| 2107 | + if( g.argv[2][1]=='r' ){ | |
| 2108 | + fossil_print("Created new wiki page %s.\n", zPageName); | |
| 2109 | + }else{ | |
| 2110 | + fossil_print("Updated wiki page %s.\n", zPageName); | |
| 2111 | + } | |
| 2106 | 2112 | } |
| 2107 | 2113 | }else{ |
| 2108 | 2114 | if( rid != -1 ){ |
| 2109 | 2115 | char *zMETime; /* Normalized, mutable version of zETime */ |
| 2110 | 2116 | zMETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", |
| 2111 | 2117 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1917,13 +1917,18 @@ | |
| 1917 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 1918 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 1919 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| 1920 | ** means UTC. |
| 1921 | ** |
| 1922 | */ |
| 1923 | void wiki_cmd(void){ |
| 1924 | int n; |
| 1925 | db_find_and_open_repository(0, 0); |
| 1926 | if( g.argc<3 ){ |
| 1927 | goto wiki_cmd_usage; |
| 1928 | } |
| 1929 | n = strlen(g.argv[2]); |
| @@ -1930,14 +1935,14 @@ | |
| 1930 | if( n==0 ){ |
| 1931 | goto wiki_cmd_usage; |
| 1932 | } |
| 1933 | |
| 1934 | if( strncmp(g.argv[2],"export",n)==0 ){ |
| 1935 | const char *zPageName; /* Name of the wiki page to export */ |
| 1936 | const char *zFile; /* Name of the output file (0=stdout) */ |
| 1937 | const char *zETime; /* The name of the technote to export */ |
| 1938 | int rid; /* Artifact ID of the wiki page */ |
| 1939 | int i; /* Loop counter */ |
| 1940 | char *zBody = 0; /* Wiki page content */ |
| 1941 | Blob body = empty_blob; /* Wiki page content */ |
| 1942 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| 1943 | int fHtml = 0; /* Export in HTML form */ |
| @@ -1955,17 +1960,18 @@ | |
| 1955 | if( !zETime ){ |
| 1956 | if( (g.argc!=4) && (g.argc!=5) ){ |
| 1957 | usage("export ?-html? PAGENAME ?FILE?"); |
| 1958 | } |
| 1959 | zPageName = g.argv[3]; |
| 1960 | rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" |
| 1961 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" |
| 1962 | " ORDER BY x.mtime DESC LIMIT 1", |
| 1963 | zPageName |
| 1964 | ); |
| 1965 | if( (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){ |
| 1966 | zBody = pWiki->zWiki; |
| 1967 | } |
| 1968 | if( zBody==0 ){ |
| 1969 | fossil_fatal("wiki page [%s] not found",zPageName); |
| 1970 | } |
| 1971 | zFile = (g.argc==4) ? "-" : g.argv[4]; |
| @@ -1991,30 +1997,24 @@ | |
| 1991 | blob_init(&body, zBody, -1); |
| 1992 | if(fHtml==0){ |
| 1993 | blob_append(&body, "\n", 1); |
| 1994 | }else{ |
| 1995 | Blob html = empty_blob; /* HTML-ized content */ |
| 1996 | const char * zMimetype = wiki_filter_mimetypes(pWiki->zMimetype); |
| 1997 | if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){ |
| 1998 | wiki_convert(&body,&html,0); |
| 1999 | }else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){ |
| 2000 | markdown_to_html(&body,0,&html) |
| 2001 | /* TODO: add -HTML|-H flag to work like -html|-h but also |
| 2002 | ** add <html><body> tag wrappers around the output. The |
| 2003 | ** hurdle here is that the markdown converter resets its |
| 2004 | ** input blob before appending the output, which is |
| 2005 | ** different from wiki_convert() and htmlize_to_blob(), and |
| 2006 | ** precludes us simply appending the opening <html><body> |
| 2007 | ** part to the body |
| 2008 | */; |
| 2009 | safe_html_context(DOCSRC_WIKI); |
| 2010 | safe_html(&html); |
| 2011 | }else if( fossil_strcmp(zMimetype, "text/plain")==0 ){ |
| 2012 | htmlize_to_blob(&html,zBody,i); |
| 2013 | }else{ |
| 2014 | fossil_fatal("Unsupported MIME type '%s' for wiki page '%s'.", |
| 2015 | zMimetype, pWiki->zWikiTitle ); |
| 2016 | } |
| 2017 | blob_reset(&body); |
| 2018 | body = html /* transfer memory */; |
| 2019 | } |
| 2020 | pFile = fossil_fopen_for_output(zFile); |
| @@ -2056,28 +2056,28 @@ | |
| 2056 | if( g.argc==4 ){ |
| 2057 | blob_read_from_channel(&content, stdin, -1); |
| 2058 | }else{ |
| 2059 | blob_read_from_file(&content, g.argv[4], ExtFILE); |
| 2060 | } |
| 2061 | if ( !zETime ){ |
| 2062 | rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" |
| 2063 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" |
| 2064 | " ORDER BY x.mtime DESC LIMIT 1", |
| 2065 | zPageName |
| 2066 | ); |
| 2067 | if( rid>0 ){ |
| 2068 | pWiki = manifest_get(rid, CFTYPE_WIKI, 0); |
| 2069 | } |
| 2070 | }else{ |
| 2071 | rid = wiki_technote_to_rid(zETime); |
| 2072 | if( rid>0 ){ |
| 2073 | pWiki = manifest_get(rid, CFTYPE_EVENT, 0); |
| 2074 | } |
| 2075 | } |
| 2076 | if( !zMimeType || !*zMimeType ){ |
| 2077 | /* Try to deduce the mime type based on the prior version. */ |
| 2078 | if( pWiki!=0 && (pWiki->zMimetype && *pWiki->zMimetype) ){ |
| 2079 | zMimeType = pWiki->zMimetype; |
| 2080 | } |
| 2081 | }else{ |
| 2082 | zMimeType = wiki_filter_mimetypes(zMimeType); |
| 2083 | } |
| @@ -2087,24 +2087,30 @@ | |
| 2087 | }else{ |
| 2088 | /* Creating a tech note with same timestamp is permitted |
| 2089 | and should create a new tech note */ |
| 2090 | rid = 0; |
| 2091 | } |
| 2092 | }else if( !isCreate && rid == 0 ){ |
| 2093 | if ( !zETime ){ |
| 2094 | fossil_fatal("no such wiki page: %s", zPageName); |
| 2095 | }else{ |
| 2096 | fossil_fatal("no such tech note: %s", zETime); |
| 2097 | } |
| 2098 | } |
| 2099 | |
| 2100 | if( !zETime ){ |
| 2101 | wiki_cmd_commit(zPageName, rid, &content, zMimeType, 1); |
| 2102 | if( g.argv[2][1]=='r' ){ |
| 2103 | fossil_print("Created new wiki page %s.\n", zPageName); |
| 2104 | }else{ |
| 2105 | fossil_print("Updated wiki page %s.\n", zPageName); |
| 2106 | } |
| 2107 | }else{ |
| 2108 | if( rid != -1 ){ |
| 2109 | char *zMETime; /* Normalized, mutable version of zETime */ |
| 2110 | zMETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", |
| 2111 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1917,13 +1917,18 @@ | |
| 1917 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 1918 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 1919 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| 1920 | ** means UTC. |
| 1921 | ** |
| 1922 | ** The "Sandbox" wiki pseudo-page is a special case. Its name is |
| 1923 | ** checked case-insensitively and either "create" or "commit" may be |
| 1924 | ** used to update its contents. |
| 1925 | */ |
| 1926 | void wiki_cmd(void){ |
| 1927 | int n; |
| 1928 | int isSandbox = 0; /* true if dealing with sandbox pseudo-page */ |
| 1929 | |
| 1930 | db_find_and_open_repository(0, 0); |
| 1931 | if( g.argc<3 ){ |
| 1932 | goto wiki_cmd_usage; |
| 1933 | } |
| 1934 | n = strlen(g.argv[2]); |
| @@ -1930,14 +1935,14 @@ | |
| 1935 | if( n==0 ){ |
| 1936 | goto wiki_cmd_usage; |
| 1937 | } |
| 1938 | |
| 1939 | if( strncmp(g.argv[2],"export",n)==0 ){ |
| 1940 | const char *zPageName = 0; /* Name of the wiki page to export */ |
| 1941 | const char *zFile; /* Name of the output file (0=stdout) */ |
| 1942 | const char *zETime; /* The name of the technote to export */ |
| 1943 | int rid = 0; /* Artifact ID of the wiki page */ |
| 1944 | int i; /* Loop counter */ |
| 1945 | char *zBody = 0; /* Wiki page content */ |
| 1946 | Blob body = empty_blob; /* Wiki page content */ |
| 1947 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| 1948 | int fHtml = 0; /* Export in HTML form */ |
| @@ -1955,17 +1960,18 @@ | |
| 1960 | if( !zETime ){ |
| 1961 | if( (g.argc!=4) && (g.argc!=5) ){ |
| 1962 | usage("export ?-html? PAGENAME ?FILE?"); |
| 1963 | } |
| 1964 | zPageName = g.argv[3]; |
| 1965 | isSandbox = is_sandbox(zPageName); |
| 1966 | if(isSandbox){ |
| 1967 | zBody = db_get("sandbox", 0); |
| 1968 | }else{ |
| 1969 | wiki_fetch_by_name(zPageName, 0, &rid, &pWiki); |
| 1970 | if(pWiki){ |
| 1971 | zBody = pWiki->zWiki; |
| 1972 | } |
| 1973 | } |
| 1974 | if( zBody==0 ){ |
| 1975 | fossil_fatal("wiki page [%s] not found",zPageName); |
| 1976 | } |
| 1977 | zFile = (g.argc==4) ? "-" : g.argv[4]; |
| @@ -1991,30 +1997,24 @@ | |
| 1997 | blob_init(&body, zBody, -1); |
| 1998 | if(fHtml==0){ |
| 1999 | blob_append(&body, "\n", 1); |
| 2000 | }else{ |
| 2001 | Blob html = empty_blob; /* HTML-ized content */ |
| 2002 | const char * zMimetype = isSandbox |
| 2003 | ? db_get("sandbox-mimetype", "text/x-fossil-wiki") |
| 2004 | : wiki_filter_mimetypes(pWiki->zMimetype); |
| 2005 | if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){ |
| 2006 | wiki_convert(&body,&html,0); |
| 2007 | }else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){ |
| 2008 | markdown_to_html(&body,0,&html); |
| 2009 | safe_html_context(DOCSRC_WIKI); |
| 2010 | safe_html(&html); |
| 2011 | }else if( fossil_strcmp(zMimetype, "text/plain")==0 ){ |
| 2012 | htmlize_to_blob(&html,zBody,i); |
| 2013 | }else{ |
| 2014 | fossil_fatal("Unsupported MIME type '%s' for wiki page '%s'.", |
| 2015 | zMimetype, pWiki ? pWiki->zWikiTitle : zPageName ); |
| 2016 | } |
| 2017 | blob_reset(&body); |
| 2018 | body = html /* transfer memory */; |
| 2019 | } |
| 2020 | pFile = fossil_fopen_for_output(zFile); |
| @@ -2056,28 +2056,28 @@ | |
| 2056 | if( g.argc==4 ){ |
| 2057 | blob_read_from_channel(&content, stdin, -1); |
| 2058 | }else{ |
| 2059 | blob_read_from_file(&content, g.argv[4], ExtFILE); |
| 2060 | } |
| 2061 | isSandbox = is_sandbox(zPageName); |
| 2062 | if ( !zETime ){ |
| 2063 | if( !isSandbox ){ |
| 2064 | wiki_fetch_by_name(zPageName, 0, &rid, &pWiki); |
| 2065 | } |
| 2066 | }else{ |
| 2067 | rid = wiki_technote_to_rid(zETime); |
| 2068 | if( rid>0 ){ |
| 2069 | pWiki = manifest_get(rid, CFTYPE_EVENT, 0); |
| 2070 | } |
| 2071 | } |
| 2072 | if( !zMimeType || !*zMimeType ){ |
| 2073 | /* Try to deduce the mime type based on the prior version. */ |
| 2074 | if(isSandbox){ |
| 2075 | zMimeType = |
| 2076 | wiki_filter_mimetypes(db_get("sandbox-mimetype", |
| 2077 | "text/x-fossil-wiki")); |
| 2078 | }else if( pWiki!=0 && (pWiki->zMimetype && *pWiki->zMimetype) ){ |
| 2079 | zMimeType = pWiki->zMimetype; |
| 2080 | } |
| 2081 | }else{ |
| 2082 | zMimeType = wiki_filter_mimetypes(zMimeType); |
| 2083 | } |
| @@ -2087,24 +2087,30 @@ | |
| 2087 | }else{ |
| 2088 | /* Creating a tech note with same timestamp is permitted |
| 2089 | and should create a new tech note */ |
| 2090 | rid = 0; |
| 2091 | } |
| 2092 | }else if( !isCreate && rid==0 && isSandbox==0 ){ |
| 2093 | if ( !zETime ){ |
| 2094 | fossil_fatal("no such wiki page: %s", zPageName); |
| 2095 | }else{ |
| 2096 | fossil_fatal("no such tech note: %s", zETime); |
| 2097 | } |
| 2098 | } |
| 2099 | |
| 2100 | if( !zETime ){ |
| 2101 | if(isSandbox){ |
| 2102 | db_set("sandbox",blob_str(&content),0); |
| 2103 | db_set("sandbox-mimetype",zMimeType,0); |
| 2104 | fossil_print("Updated sandbox pseudo-page.\n"); |
| 2105 | }else{ |
| 2106 | wiki_cmd_commit(zPageName, rid, &content, zMimeType, 1); |
| 2107 | if( g.argv[2][1]=='r' ){ |
| 2108 | fossil_print("Created new wiki page %s.\n", zPageName); |
| 2109 | }else{ |
| 2110 | fossil_print("Updated wiki page %s.\n", zPageName); |
| 2111 | } |
| 2112 | } |
| 2113 | }else{ |
| 2114 | if( rid != -1 ){ |
| 2115 | char *zMETime; /* Normalized, mutable version of zETime */ |
| 2116 | zMETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", |
| 2117 |
+2
-1
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -63,11 +63,12 @@ | ||
| 63 | 63 | * The [/help?cmd=/wikiedit|wiki editor] has been modernized and is |
| 64 | 64 | now Ajax-based. The WYSIWYG editing option for Fossil-format wiki |
| 65 | 65 | pages was removed. (Please let us know, via the site's Support menu, |
| 66 | 66 | if that removal unduly impacts you.) This also changes the semantics |
| 67 | 67 | of the wiki "Sandbox": that pseudo-page may be freely edited but |
| 68 | - no longer saved via the UI. | |
| 68 | + no longer saved via the UI (the [/help?cmd=wiki|wiki CLI command] | |
| 69 | + can, though). | |
| 69 | 70 | * Countless documentation enhancements. |
| 70 | 71 | |
| 71 | 72 | <a name='v2_11'></a> |
| 72 | 73 | <h2>Changes for Version 2.11 (2020-05-25)</h2> |
| 73 | 74 | |
| 74 | 75 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -63,11 +63,12 @@ | |
| 63 | * The [/help?cmd=/wikiedit|wiki editor] has been modernized and is |
| 64 | now Ajax-based. The WYSIWYG editing option for Fossil-format wiki |
| 65 | pages was removed. (Please let us know, via the site's Support menu, |
| 66 | if that removal unduly impacts you.) This also changes the semantics |
| 67 | of the wiki "Sandbox": that pseudo-page may be freely edited but |
| 68 | no longer saved via the UI. |
| 69 | * Countless documentation enhancements. |
| 70 | |
| 71 | <a name='v2_11'></a> |
| 72 | <h2>Changes for Version 2.11 (2020-05-25)</h2> |
| 73 | |
| 74 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -63,11 +63,12 @@ | |
| 63 | * The [/help?cmd=/wikiedit|wiki editor] has been modernized and is |
| 64 | now Ajax-based. The WYSIWYG editing option for Fossil-format wiki |
| 65 | pages was removed. (Please let us know, via the site's Support menu, |
| 66 | if that removal unduly impacts you.) This also changes the semantics |
| 67 | of the wiki "Sandbox": that pseudo-page may be freely edited but |
| 68 | no longer saved via the UI (the [/help?cmd=wiki|wiki CLI command] |
| 69 | can, though). |
| 70 | * Countless documentation enhancements. |
| 71 | |
| 72 | <a name='v2_11'></a> |
| 73 | <h2>Changes for Version 2.11 (2020-05-25)</h2> |
| 74 | |
| 75 |