Fossil

Check-in [7a14176e]
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 | jsonWikiMimeTypes
Files: files | file ages | folders
SHA1:7a14176ee0e6b0939fbd62ad462d1e12511a044b
User & Date: mistachkin 2016-10-18 08:22:52
Context
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
08:22
Enhancements to wiki MIME types supported for the JSON API. check-in: 7a14176e 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
                      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;
          blob_append(&raw,zBody,-1);
          zMimetype = wiki_filter_mimetypes(pWiki->zMimetype);
          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);