Format flowed was breaking the patch, it's now attached, sorry for the trouble.
-- Lester L. Martin II
Index: src/db.c ================================================================== --- src/db.c +++ src/db.c @@ -3259,10 +3259,15 @@ ** A shell command used to launch your preferred ** web browser when given a URL as an argument. ** Defaults to "start" on windows, "open" on Mac, ** and "firefox" on Unix. */ +/* +** SETTING: syntax-hl boolean default=off +** This is a boolean set such that themes can use TH1 code +** to detect if they should enable syntax highlighting. +*/ /* ** Look up a control setting by its name. Return a pointer to the Setting ** object, or NULL if there is no such setting. ** Index: src/info.c ================================================================== --- src/info.c +++ src/info.c @@ -665,11 +665,11 @@ " FROM blob, event" " WHERE blob.rid=%d" " AND event.objid=%d", rid, rid ); - + cookie_link_parameter("diff","diff","2"); diffType = atoi(PD("diff","2")); if( db_step(&q1)==SQLITE_ROW ){ const char *zUuid = db_column_text(&q1, 0); int nUuid = db_column_bytes(&q1, 0); @@ -2150,29 +2150,36 @@ @ </iframe> }else{ style_submenu_element("Hex", "%s/hexdump?name=%s", g.zTop, zUuid); blob_to_utf8_no_bom(&content, 0); zMime = mimetype_from_content(&content); - @ <blockquote> if( zMime==0 ){ - const char *z; + const char *z, *ext, *name; + char *tmp; z = blob_str(&content); - if( zLn ){ + name = blob_str(&downloadName); + ext = (tmp = strrchr(name, '.')) == NULL ? "" : tmp+1; + @ <pre> + if( zLn && (db_get_boolean("syntax-hl", 0) != 0) ) { + @ <code class="%h(ext)">%h(z)</code> + }else if( zLn ){ output_text_with_line_numbers(z, zLn); }else{ - @ <pre> - @ %h(z) - @ </pre> + @ <code class="%h(ext)">%h(z)</code> } + @ </pre> }else if( strncmp(zMime, "image/", 6)==0 ){ + @ <blockquote> @ <i>(file is %d(blob_size(&content)) bytes of image data)</i><br /> @ <img src="%R/raw/%s(zUuid)?m=%s(zMime)" /> style_submenu_element("Image", "%R/raw/%s?m=%s", zUuid, zMime); + @ </blockquote> }else{ + @ <blockquote> @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i> + @ </blockquote> } - @ </blockquote> } } style_footer(); } @@ -2227,11 +2234,11 @@ if( strcmp(zModAction,"approve")==0 ){ moderation_approve(rid); } } zTktTitle = db_table_has_column("repository", "ticket", "title" ) - ? db_text("(No title)", + ? db_text("(No title)", "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName) : 0; style_header("Ticket Change Details"); style_submenu_element("Raw", "%R/artifact/%s", zUuid); style_submenu_element("History", "%R/tkthistory/%s", zTktName);
_______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users