Fossil

Check-in [ce8937fa]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enhancements to wiki MIME types supported for the JSON API.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ce8937facc63cdfe8e9f969398a6c61e19acef29
User & Date: drh 2016-10-20 12:51:57
Context
2016-10-20
16:13
"stash cat" worked the same as "stash diff", yet "stash cat -tk" worked the same as "stash show -tk". Make "stash cat" behave like "stash show" which matches the -tk case and also the documentation. Also add mention of DIFF-OPTIONS to the stash show|cat|diff|gdiff usage text. Remove unnecessary variable initialization in stash_get_id(), plus show the bad stash ID string rather than "0" if a non-numeric was used. check-in: 48ecfe66 user: andygoth tags: trunk
12:51
Enhancements to wiki MIME types supported for the JSON API. check-in: ce8937fa user: drh tags: trunk
2016-10-18
21:55
Make the new wiki MIME type handling more consistent with the existing code. Closed-Leaf check-in: 0dc1187e user: mistachkin tags: jsonWikiMimeTypes
2016-10-16
01:21
Merge fixes in this branch to trunk prior to release. check-in: b2d51b1b user: andybradford tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/json_wiki.c.

113
114
115
116
117
118
119



120

121














122
123
124
125
126
127
128
                      json_new_int((cson_int_t)(zBody?strlen(zBody):0)));
    }else{
      if( contentFormat>0 ){/*HTML-ize it*/
        Blob content = empty_blob;
        Blob raw = empty_blob;
        zFormat = "html";
        if(zBody && *zBody){



          blob_append(&raw,zBody,-1);

          wiki_convert(&raw,&content,0);














          len = (unsigned int)blob_size(&content);
        }
        cson_object_set(pay,"size",json_new_int((cson_int_t)len));
        cson_object_set(pay,"content",
                        cson_value_new_string(blob_buffer(&content),len));
        blob_reset(&content);
        blob_reset(&raw);







>
>
>

>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
                      json_new_int((cson_int_t)(zBody?strlen(zBody):0)));
    }else{
      if( contentFormat>0 ){/*HTML-ize it*/
        Blob content = empty_blob;
        Blob raw = empty_blob;
        zFormat = "html";
        if(zBody && *zBody){
          const char *zMimetype = pWiki->zMimetype;
          if( zMimetype==0 ) zMimetype = "text/plain";
          zMimetype = wiki_filter_mimetypes(zMimetype);
          blob_append(&raw,zBody,-1);
          if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){
            wiki_convert(&raw,&content,0);
          }else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){
            markdown_to_html(&raw,0,&content);
          }else if( fossil_strcmp(zMimetype, "text/plain")==0 ){
            htmlize_to_blob(&content,blob_str(&raw),blob_size(&raw));
          }else{
            json_set_err( FSL_JSON_E_UNKNOWN,
                          "Unsupported MIME type '%s' for wiki page '%s'.",
                          zMimetype, pWiki->zWikiTitle );
            blob_reset(&content);
            blob_reset(&raw);
            cson_free_object(pay);
            manifest_destroy(pWiki);
            return NULL;
          }
          len = (unsigned int)blob_size(&content);
        }
        cson_object_set(pay,"size",json_new_int((cson_int_t)len));
        cson_object_set(pay,"content",
                        cson_value_new_string(blob_buffer(&content),len));
        blob_reset(&content);
        blob_reset(&raw);