Fossil

Changes On Branch jsonWikiMimeTypes
Login

Changes On Branch jsonWikiMimeTypes

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

Changes In Branch jsonWikiMimeTypes Excluding Merge-Ins

This is equivalent to a diff from b2d51b1b22 to 0dc1187e79

2016-10-20
12:51
Enhancements to wiki MIME types supported for the JSON API. ... (check-in: ce8937facc 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: 0dc1187e79 user: mistachkin tags: jsonWikiMimeTypes)
08:22
Enhancements to wiki MIME types supported for the JSON API. ... (check-in: 7a14176ee0 user: mistachkin tags: jsonWikiMimeTypes)
2016-10-16
01:21
Merge fixes in this branch to trunk prior to release. ... (check-in: b2d51b1b22 user: andybradford tags: trunk)
00:22
Merge updates from trunk. ... (Closed-Leaf check-in: 5634375d0b user: mistachkin tags: stash-fixes)
2016-10-15
05:02
Coding style, removing superfluous 'then' clauses from tester.tcl. ... (check-in: 4946b5b186 user: mistachkin tags: trunk)

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);