| | @@ -219,26 +219,38 @@ |
| 219 | 219 | @ } |
| 220 | 220 | @ </style> |
| 221 | 221 | @ </head> |
| 222 | 222 | @ <body> |
| 223 | 223 | ; |
| 224 | +const char zWebpageEnd[] = |
| 225 | +@ </body> |
| 226 | +@ </html> |
| 227 | +; |
| 224 | 228 | |
| 225 | 229 | /* |
| 226 | 230 | ** Print a header or footer on the overall diff output. |
| 227 | 231 | ** |
| 228 | 232 | ** This is only a factor for --webpage, in which case the header |
| 229 | 233 | ** is the HTML header CSS definitions and the footer is the HTML |
| 230 | 234 | ** close tags. |
| 231 | 235 | */ |
| 232 | | -void diff_header(u64 diffFlags){ |
| 233 | | - if( (diffFlags & DIFF_WEBPAGE)!=0 ){ |
| 234 | | - fossil_print("%s", zWebpageHdr); |
| 235 | | - } |
| 236 | | -} |
| 237 | | -void diff_footer(u64 diffFlags){ |
| 238 | | - if( (diffFlags & DIFF_WEBPAGE)!=0 ){ |
| 239 | | - fossil_print("</body></html>\n"); |
| 236 | +void diff_header(u64 diffFlags, Blob *pOut){ |
| 237 | + if( (diffFlags & DIFF_WEBPAGE)!=0 ){ |
| 238 | + if( pOut ){ |
| 239 | + blob_append(pOut, zWebpageHdr, -1); |
| 240 | + }else{ |
| 241 | + fossil_print("%s", zWebpageHdr); |
| 242 | + } |
| 243 | + } |
| 244 | +} |
| 245 | +void diff_footer(u64 diffFlags, Blob *pOut){ |
| 246 | + if( (diffFlags & DIFF_WEBPAGE)!=0 ){ |
| 247 | + if( pOut ){ |
| 248 | + blob_append(pOut, zWebpageEnd, -1); |
| 249 | + }else{ |
| 250 | + fossil_print("%s", zWebpageEnd); |
| 251 | + } |
| 240 | 252 | } |
| 241 | 253 | } |
| 242 | 254 | |
| 243 | 255 | /* |
| 244 | 256 | ** Show the difference between two files, one in memory and one on disk. |
| | @@ -1037,11 +1049,11 @@ |
| 1037 | 1049 | ridTo); |
| 1038 | 1050 | if( zFrom==0 ){ |
| 1039 | 1051 | fossil_fatal("check-in %s has no parent", zTo); |
| 1040 | 1052 | } |
| 1041 | 1053 | } |
| 1042 | | - diff_header(diffFlags); |
| 1054 | + diff_header(diffFlags, 0); |
| 1043 | 1055 | if( againstUndo ){ |
| 1044 | 1056 | if( db_lget_int("undo_available",0)==0 ){ |
| 1045 | 1057 | fossil_print("No undo or redo is available\n"); |
| 1046 | 1058 | return; |
| 1047 | 1059 | } |
| | @@ -1065,11 +1077,11 @@ |
| 1065 | 1077 | } |
| 1066 | 1078 | fossil_free(pFileDir[i].zName); |
| 1067 | 1079 | } |
| 1068 | 1080 | fossil_free(pFileDir); |
| 1069 | 1081 | } |
| 1070 | | - diff_footer(diffFlags); |
| 1082 | + diff_footer(diffFlags, 0); |
| 1071 | 1083 | if ( diffFlags & DIFF_NUMSTAT ){ |
| 1072 | 1084 | fossil_print("%10d %10d TOTAL over %d changed files\n", |
| 1073 | 1085 | g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]); |
| 1074 | 1086 | } |
| 1075 | 1087 | } |
| 1076 | 1088 | |