Fossil SCM
The "formatted" mode for the ticket history viewer assumed that all text was Fossil-Wiki formatted. It did not account for Markdown (since that feature was added long before Markdown formatting was added). And, indeed, there is no general way for it to know what the mimetype of the text is. Hence, disable formatted mode, and show all text as plaintext.
Commit
f1e8cd6977e0de32fc5b7e12a2492c8058daadfbbd507faba5aff0c4c204cf1b
Parent
4c9e24fdcc334b9…
1 file changed
+14
-26
+14
-26
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -935,15 +935,15 @@ | ||
| 935 | 935 | ** URL: /tkthistory?name=TICKETUUID |
| 936 | 936 | ** |
| 937 | 937 | ** Show the complete change history for a single ticket. Or (to put it |
| 938 | 938 | ** another way) show a list of artifacts associated with a single ticket. |
| 939 | 939 | ** |
| 940 | -** By default, the artifacts are decoded and formatted. If the | |
| 941 | -** "plaintext" query parameter is present, then icomment text fields | |
| 942 | -** are shown as plain text rather than being formatted according | |
| 943 | -** to mimetype. Or if the "raw" query parameter is present, then the | |
| 944 | -** undecoded and unformatted text of each artifact is displayed. | |
| 940 | +** By default, the artifacts are decoded and formatted. Text fields | |
| 941 | +** are formatted as text/plain, since in the general case Fossil does | |
| 942 | +** not have knowledge of the encoding. If the "raw" query parameter | |
| 943 | +** is present, then the* undecoded and unformatted text of each artifact | |
| 944 | +** is displayed. | |
| 945 | 945 | */ |
| 946 | 946 | void tkthistory_page(void){ |
| 947 | 947 | Stmt q; |
| 948 | 948 | char *zTitle; |
| 949 | 949 | const char *zUuid; |
| @@ -960,22 +960,13 @@ | ||
| 960 | 960 | style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid); |
| 961 | 961 | style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci", |
| 962 | 962 | g.zTop, zUuid); |
| 963 | 963 | style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid); |
| 964 | 964 | if( P("raw")!=0 ){ |
| 965 | - style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid); | |
| 966 | - style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid); | |
| 967 | - }else if( P("plaintext")!=0 ){ | |
| 968 | - style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid); | |
| 969 | - if( g.perm.Admin ){ | |
| 970 | - style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid); | |
| 971 | - } | |
| 972 | - }else{ | |
| 973 | - style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid); | |
| 974 | - if( g.perm.Admin ){ | |
| 975 | - style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid); | |
| 976 | - } | |
| 965 | + style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid); | |
| 966 | + }else if( g.perm.Admin ){ | |
| 967 | + style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid); | |
| 977 | 968 | } |
| 978 | 969 | style_header("%z", zTitle); |
| 979 | 970 | |
| 980 | 971 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); |
| 981 | 972 | if( tagid==0 ){ |
| @@ -983,10 +974,12 @@ | ||
| 983 | 974 | style_footer(); |
| 984 | 975 | return; |
| 985 | 976 | } |
| 986 | 977 | if( P("raw")!=0 ){ |
| 987 | 978 | @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2> |
| 979 | + }else{ | |
| 980 | + @ <h2>Artifacts Associated With Ticket %h(zUuid)</h2> | |
| 988 | 981 | } |
| 989 | 982 | db_prepare(&q, |
| 990 | 983 | "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL" |
| 991 | 984 | " FROM event, blob" |
| 992 | 985 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| @@ -1072,31 +1065,26 @@ | ||
| 1072 | 1065 | ** description of this object. |
| 1073 | 1066 | */ |
| 1074 | 1067 | void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){ |
| 1075 | 1068 | int i; |
| 1076 | 1069 | int wikiFlags = WIKI_NOBADLINKS; |
| 1077 | - const char *zBlock = "<blockquote>"; | |
| 1078 | - const char *zEnd = "</blockquote>"; | |
| 1079 | - if( P("plaintext")!=0 ){ | |
| 1080 | - wikiFlags |= WIKI_LINKSONLY; | |
| 1081 | - zBlock = "<blockquote><pre class='verbatim'>"; | |
| 1082 | - zEnd = "</pre></blockquote>"; | |
| 1083 | - } | |
| 1070 | + const char *zBlock = "<blockquote><pre class='verbatim'>"; | |
| 1071 | + const char *zEnd = "</pre></blockquote>"; | |
| 1084 | 1072 | if( zListType==0 ) zListType = "1"; |
| 1085 | 1073 | @ <ol type="%s(zListType)"> |
| 1086 | 1074 | for(i=0; i<pTkt->nField; i++){ |
| 1087 | 1075 | Blob val; |
| 1088 | 1076 | const char *z; |
| 1089 | 1077 | z = pTkt->aField[i].zName; |
| 1090 | 1078 | blob_set(&val, pTkt->aField[i].zValue); |
| 1091 | 1079 | if( z[0]=='+' ){ |
| 1092 | 1080 | @ <li>Appended to %h(&z[1]):%s(zBlock) |
| 1093 | - wiki_convert(&val, 0, wikiFlags); | |
| 1081 | + @ %h(blob_str(&val)) | |
| 1094 | 1082 | @ %s(zEnd)</li> |
| 1095 | 1083 | }else if( blob_size(&val)>50 || contains_newline(&val) ){ |
| 1096 | 1084 | @ <li>Change %h(z) to:%s(zBlock) |
| 1097 | - wiki_convert(&val, 0, wikiFlags); | |
| 1085 | + @ %h(blob_str(&val)) | |
| 1098 | 1086 | @ %s(zEnd)</li> |
| 1099 | 1087 | }else{ |
| 1100 | 1088 | @ <li>Change %h(z) to "%h(blob_str(&val))"</li> |
| 1101 | 1089 | } |
| 1102 | 1090 | blob_reset(&val); |
| 1103 | 1091 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -935,15 +935,15 @@ | |
| 935 | ** URL: /tkthistory?name=TICKETUUID |
| 936 | ** |
| 937 | ** Show the complete change history for a single ticket. Or (to put it |
| 938 | ** another way) show a list of artifacts associated with a single ticket. |
| 939 | ** |
| 940 | ** By default, the artifacts are decoded and formatted. If the |
| 941 | ** "plaintext" query parameter is present, then icomment text fields |
| 942 | ** are shown as plain text rather than being formatted according |
| 943 | ** to mimetype. Or if the "raw" query parameter is present, then the |
| 944 | ** undecoded and unformatted text of each artifact is displayed. |
| 945 | */ |
| 946 | void tkthistory_page(void){ |
| 947 | Stmt q; |
| 948 | char *zTitle; |
| 949 | const char *zUuid; |
| @@ -960,22 +960,13 @@ | |
| 960 | style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid); |
| 961 | style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci", |
| 962 | g.zTop, zUuid); |
| 963 | style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid); |
| 964 | if( P("raw")!=0 ){ |
| 965 | style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid); |
| 966 | style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid); |
| 967 | }else if( P("plaintext")!=0 ){ |
| 968 | style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid); |
| 969 | if( g.perm.Admin ){ |
| 970 | style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid); |
| 971 | } |
| 972 | }else{ |
| 973 | style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid); |
| 974 | if( g.perm.Admin ){ |
| 975 | style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid); |
| 976 | } |
| 977 | } |
| 978 | style_header("%z", zTitle); |
| 979 | |
| 980 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); |
| 981 | if( tagid==0 ){ |
| @@ -983,10 +974,12 @@ | |
| 983 | style_footer(); |
| 984 | return; |
| 985 | } |
| 986 | if( P("raw")!=0 ){ |
| 987 | @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2> |
| 988 | } |
| 989 | db_prepare(&q, |
| 990 | "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL" |
| 991 | " FROM event, blob" |
| 992 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| @@ -1072,31 +1065,26 @@ | |
| 1072 | ** description of this object. |
| 1073 | */ |
| 1074 | void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){ |
| 1075 | int i; |
| 1076 | int wikiFlags = WIKI_NOBADLINKS; |
| 1077 | const char *zBlock = "<blockquote>"; |
| 1078 | const char *zEnd = "</blockquote>"; |
| 1079 | if( P("plaintext")!=0 ){ |
| 1080 | wikiFlags |= WIKI_LINKSONLY; |
| 1081 | zBlock = "<blockquote><pre class='verbatim'>"; |
| 1082 | zEnd = "</pre></blockquote>"; |
| 1083 | } |
| 1084 | if( zListType==0 ) zListType = "1"; |
| 1085 | @ <ol type="%s(zListType)"> |
| 1086 | for(i=0; i<pTkt->nField; i++){ |
| 1087 | Blob val; |
| 1088 | const char *z; |
| 1089 | z = pTkt->aField[i].zName; |
| 1090 | blob_set(&val, pTkt->aField[i].zValue); |
| 1091 | if( z[0]=='+' ){ |
| 1092 | @ <li>Appended to %h(&z[1]):%s(zBlock) |
| 1093 | wiki_convert(&val, 0, wikiFlags); |
| 1094 | @ %s(zEnd)</li> |
| 1095 | }else if( blob_size(&val)>50 || contains_newline(&val) ){ |
| 1096 | @ <li>Change %h(z) to:%s(zBlock) |
| 1097 | wiki_convert(&val, 0, wikiFlags); |
| 1098 | @ %s(zEnd)</li> |
| 1099 | }else{ |
| 1100 | @ <li>Change %h(z) to "%h(blob_str(&val))"</li> |
| 1101 | } |
| 1102 | blob_reset(&val); |
| 1103 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -935,15 +935,15 @@ | |
| 935 | ** URL: /tkthistory?name=TICKETUUID |
| 936 | ** |
| 937 | ** Show the complete change history for a single ticket. Or (to put it |
| 938 | ** another way) show a list of artifacts associated with a single ticket. |
| 939 | ** |
| 940 | ** By default, the artifacts are decoded and formatted. Text fields |
| 941 | ** are formatted as text/plain, since in the general case Fossil does |
| 942 | ** not have knowledge of the encoding. If the "raw" query parameter |
| 943 | ** is present, then the* undecoded and unformatted text of each artifact |
| 944 | ** is displayed. |
| 945 | */ |
| 946 | void tkthistory_page(void){ |
| 947 | Stmt q; |
| 948 | char *zTitle; |
| 949 | const char *zUuid; |
| @@ -960,22 +960,13 @@ | |
| 960 | style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid); |
| 961 | style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci", |
| 962 | g.zTop, zUuid); |
| 963 | style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid); |
| 964 | if( P("raw")!=0 ){ |
| 965 | style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid); |
| 966 | }else if( g.perm.Admin ){ |
| 967 | style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid); |
| 968 | } |
| 969 | style_header("%z", zTitle); |
| 970 | |
| 971 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); |
| 972 | if( tagid==0 ){ |
| @@ -983,10 +974,12 @@ | |
| 974 | style_footer(); |
| 975 | return; |
| 976 | } |
| 977 | if( P("raw")!=0 ){ |
| 978 | @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2> |
| 979 | }else{ |
| 980 | @ <h2>Artifacts Associated With Ticket %h(zUuid)</h2> |
| 981 | } |
| 982 | db_prepare(&q, |
| 983 | "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL" |
| 984 | " FROM event, blob" |
| 985 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| @@ -1072,31 +1065,26 @@ | |
| 1065 | ** description of this object. |
| 1066 | */ |
| 1067 | void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){ |
| 1068 | int i; |
| 1069 | int wikiFlags = WIKI_NOBADLINKS; |
| 1070 | const char *zBlock = "<blockquote><pre class='verbatim'>"; |
| 1071 | const char *zEnd = "</pre></blockquote>"; |
| 1072 | if( zListType==0 ) zListType = "1"; |
| 1073 | @ <ol type="%s(zListType)"> |
| 1074 | for(i=0; i<pTkt->nField; i++){ |
| 1075 | Blob val; |
| 1076 | const char *z; |
| 1077 | z = pTkt->aField[i].zName; |
| 1078 | blob_set(&val, pTkt->aField[i].zValue); |
| 1079 | if( z[0]=='+' ){ |
| 1080 | @ <li>Appended to %h(&z[1]):%s(zBlock) |
| 1081 | @ %h(blob_str(&val)) |
| 1082 | @ %s(zEnd)</li> |
| 1083 | }else if( blob_size(&val)>50 || contains_newline(&val) ){ |
| 1084 | @ <li>Change %h(z) to:%s(zBlock) |
| 1085 | @ %h(blob_str(&val)) |
| 1086 | @ %s(zEnd)</li> |
| 1087 | }else{ |
| 1088 | @ <li>Change %h(z) to "%h(blob_str(&val))"</li> |
| 1089 | } |
| 1090 | blob_reset(&val); |
| 1091 |