Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Updated the wiki CLI command to account for the sandbox pseudo-page and removed an obsolete TODO. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7bc942704d2c9356db444bb910dcd67b |
User & Date: | stephan 2020-08-01 18:47:13.842 |
Context
2020-08-01
| ||
21:31 | Ported several features between wikiedit and fileedit, improving them both a bit. ... (check-in: 0d5006bed5 user: stephan tags: trunk) | |
18:47 | Updated the wiki CLI command to account for the sandbox pseudo-page and removed an obsolete TODO. ... (check-in: 7bc942704d user: stephan tags: trunk) | |
17:56 | Style tweaks and re-did how the OPTION elements are marked is-new/is-modified so that the mobile browsers can show that state. ... (check-in: d9f4b6dbed user: stephan tags: trunk) | |
Changes
Changes to src/wiki.c.
︙ | ︙ | |||
1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 | ** ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in ** year-month-day form, it may be truncated, the "T" may be replaced by ** a space, and it may also name a timezone offset from UTC as "-HH:MM" ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" ** means UTC. ** */ void wiki_cmd(void){ int n; db_find_and_open_repository(0, 0); if( g.argc<3 ){ goto wiki_cmd_usage; } n = strlen(g.argv[2]); if( n==0 ){ goto wiki_cmd_usage; } if( strncmp(g.argv[2],"export",n)==0 ){ | > > > > > | | | 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 | ** ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in ** year-month-day form, it may be truncated, the "T" may be replaced by ** a space, and it may also name a timezone offset from UTC as "-HH:MM" ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" ** means UTC. ** ** The "Sandbox" wiki pseudo-page is a special case. Its name is ** checked case-insensitively and either "create" or "commit" may be ** used to update its contents. */ void wiki_cmd(void){ int n; int isSandbox = 0; /* true if dealing with sandbox pseudo-page */ db_find_and_open_repository(0, 0); if( g.argc<3 ){ goto wiki_cmd_usage; } n = strlen(g.argv[2]); if( n==0 ){ goto wiki_cmd_usage; } if( strncmp(g.argv[2],"export",n)==0 ){ const char *zPageName = 0; /* Name of the wiki page to export */ const char *zFile; /* Name of the output file (0=stdout) */ const char *zETime; /* The name of the technote to export */ int rid = 0; /* Artifact ID of the wiki page */ int i; /* Loop counter */ char *zBody = 0; /* Wiki page content */ Blob body = empty_blob; /* Wiki page content */ Manifest *pWiki = 0; /* Parsed wiki page content */ int fHtml = 0; /* Export in HTML form */ FILE * pFile = 0; /* Output file */ int fPre = 0; /* Indicates that -h|-H should be |
︙ | ︙ | |||
1953 1954 1955 1956 1957 1958 1959 | zETime = find_option("technote","t",1); verify_all_options(); if( !zETime ){ if( (g.argc!=4) && (g.argc!=5) ){ usage("export ?-html? PAGENAME ?FILE?"); } zPageName = g.argv[3]; | < < < | > | > > | | > | 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 | zETime = find_option("technote","t",1); verify_all_options(); if( !zETime ){ if( (g.argc!=4) && (g.argc!=5) ){ usage("export ?-html? PAGENAME ?FILE?"); } zPageName = g.argv[3]; isSandbox = is_sandbox(zPageName); if(isSandbox){ zBody = db_get("sandbox", 0); }else{ wiki_fetch_by_name(zPageName, 0, &rid, &pWiki); if(pWiki){ zBody = pWiki->zWiki; } } if( zBody==0 ){ fossil_fatal("wiki page [%s] not found",zPageName); } zFile = (g.argc==4) ? "-" : g.argv[4]; }else{ if( (g.argc!=3) && (g.argc!=4) ){ |
︙ | ︙ | |||
1989 1990 1991 1992 1993 1994 1995 | for(i=strlen(zBody); i>0 && fossil_isspace(zBody[i-1]); i--){} zBody[i] = 0; blob_init(&body, zBody, -1); if(fHtml==0){ blob_append(&body, "\n", 1); }else{ Blob html = empty_blob; /* HTML-ized content */ | > > | | < < < < < < < < | | 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 | for(i=strlen(zBody); i>0 && fossil_isspace(zBody[i-1]); i--){} zBody[i] = 0; blob_init(&body, zBody, -1); if(fHtml==0){ blob_append(&body, "\n", 1); }else{ Blob html = empty_blob; /* HTML-ized content */ const char * zMimetype = isSandbox ? db_get("sandbox-mimetype", "text/x-fossil-wiki") : wiki_filter_mimetypes(pWiki->zMimetype); if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){ wiki_convert(&body,&html,0); }else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){ markdown_to_html(&body,0,&html); safe_html_context(DOCSRC_WIKI); safe_html(&html); }else if( fossil_strcmp(zMimetype, "text/plain")==0 ){ htmlize_to_blob(&html,zBody,i); }else{ fossil_fatal("Unsupported MIME type '%s' for wiki page '%s'.", zMimetype, pWiki ? pWiki->zWikiTitle : zPageName ); } blob_reset(&body); body = html /* transfer memory */; } pFile = fossil_fopen_for_output(zFile); if(fHtml==2){ fwrite("<html><body>", 1, 12, pFile); |
︙ | ︙ | |||
2054 2055 2056 2057 2058 2059 2060 2061 | } zPageName = g.argv[3]; if( g.argc==4 ){ blob_read_from_channel(&content, stdin, -1); }else{ blob_read_from_file(&content, g.argv[4], ExtFILE); } if ( !zETime ){ | > < < < < < | | > > > > | | > > > > > | | | | | > | 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 | } zPageName = g.argv[3]; if( g.argc==4 ){ blob_read_from_channel(&content, stdin, -1); }else{ blob_read_from_file(&content, g.argv[4], ExtFILE); } isSandbox = is_sandbox(zPageName); if ( !zETime ){ if( !isSandbox ){ wiki_fetch_by_name(zPageName, 0, &rid, &pWiki); } }else{ rid = wiki_technote_to_rid(zETime); if( rid>0 ){ pWiki = manifest_get(rid, CFTYPE_EVENT, 0); } } if( !zMimeType || !*zMimeType ){ /* Try to deduce the mime type based on the prior version. */ if(isSandbox){ zMimeType = wiki_filter_mimetypes(db_get("sandbox-mimetype", "text/x-fossil-wiki")); }else if( pWiki!=0 && (pWiki->zMimetype && *pWiki->zMimetype) ){ zMimeType = pWiki->zMimetype; } }else{ zMimeType = wiki_filter_mimetypes(zMimeType); } if( isCreate && rid>0 ){ if ( !zETime ){ fossil_fatal("wiki page %s already exists", zPageName); }else{ /* Creating a tech note with same timestamp is permitted and should create a new tech note */ rid = 0; } }else if( !isCreate && rid==0 && isSandbox==0 ){ if ( !zETime ){ fossil_fatal("no such wiki page: %s", zPageName); }else{ fossil_fatal("no such tech note: %s", zETime); } } if( !zETime ){ if(isSandbox){ db_set("sandbox",blob_str(&content),0); db_set("sandbox-mimetype",zMimeType,0); fossil_print("Updated sandbox pseudo-page.\n"); }else{ wiki_cmd_commit(zPageName, rid, &content, zMimeType, 1); if( g.argv[2][1]=='r' ){ fossil_print("Created new wiki page %s.\n", zPageName); }else{ fossil_print("Updated wiki page %s.\n", zPageName); } } }else{ if( rid != -1 ){ char *zMETime; /* Normalized, mutable version of zETime */ zMETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime); event_cmd_commit(zMETime, rid, &content, zMimeType, zPageName, |
︙ | ︙ |
Changes to www/changes.wiki.
︙ | ︙ | |||
61 62 63 64 65 66 67 | "[/help?cmd=sql|fossil sql]" command. * [./delta_format.wiki|Delta compression] is now applied to forum edits. * The [/help?cmd=/wikiedit|wiki editor] has been modernized and is now Ajax-based. The WYSIWYG editing option for Fossil-format wiki pages was removed. (Please let us know, via the site's Support menu, if that removal unduly impacts you.) This also changes the semantics of the wiki "Sandbox": that pseudo-page may be freely edited but | | > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | "[/help?cmd=sql|fossil sql]" command. * [./delta_format.wiki|Delta compression] is now applied to forum edits. * The [/help?cmd=/wikiedit|wiki editor] has been modernized and is now Ajax-based. The WYSIWYG editing option for Fossil-format wiki pages was removed. (Please let us know, via the site's Support menu, if that removal unduly impacts you.) This also changes the semantics of the wiki "Sandbox": that pseudo-page may be freely edited but no longer saved via the UI (the [/help?cmd=wiki|wiki CLI command] can, though). * Countless documentation enhancements. <a name='v2_11'></a> <h2>Changes for Version 2.11 (2020-05-25)</h2> * Support [/md_rules|Markdown] in the default ticket configuration. * Timestamp strings in [./checkin_names.wiki|object names] |
︙ | ︙ |