Index: src/json_diff.c ================================================================== --- src/json_diff.c +++ src/json_diff.c @@ -29,20 +29,24 @@ ** Generates a diff between two versions (zFrom and zTo), using nContext ** content lines in the output. On success, returns a new JSON String ** object. On error it sets g.json's error state and returns NULL. ** ** If fSbs is true (non-0) them side-by-side diffs are used. +** +** If fHtml is true then HTML markup is added to the diff. */ cson_value * json_generate_diff(const char *zFrom, const char *zTo, - int nContext, char fSbs){ + int nContext, char fSbs, + char fHtml){ int fromid; int toid; int outLen; Blob from = empty_blob, to = empty_blob, out = empty_blob; cson_value * rc = NULL; int flags = (DIFF_CONTEXT_MASK & nContext) - | (fSbs ? DIFF_SIDEBYSIDE : 0); + | (fSbs ? DIFF_SIDEBYSIDE : 0) + | (fHtml ? DIFF_HTML : 0); fromid = name_to_typed_rid(zFrom, "*"); if(fromid<=0){ json_set_err(FSL_JSON_E_UNRESOLVED_UUID, "Could not resolve 'from' ID."); return NULL; @@ -85,10 +89,11 @@ cson_value * v = NULL; char const * zFrom; char const * zTo; int nContext = 0; char doSBS; + char doHtml; if(!g.perm.Read){ json_set_err(FSL_JSON_E_DENIED, "Requires 'o' permissions."); return NULL; } @@ -110,11 +115,12 @@ "Required 'v2' parameter is missing."); return NULL; } nContext = json_find_option_int("context",NULL,"c",5); doSBS = json_find_option_bool("sbs",NULL,"y",0); - v = json_generate_diff(zFrom, zTo, nContext, doSBS); + doHtml = json_find_option_bool("html",NULL,"h",0); + v = json_generate_diff(zFrom, zTo, nContext, doSBS, doHtml); if(!v){ if(!g.json.resultCode){ json_set_err(FSL_JSON_E_UNKNOWN, "Generating diff failed for unknown reason."); }