On 2018-07-01 20:03, Lester L. Martin II wrote:
On 2018-07-01 19:52, Lester L. Martin II wrote:
Note:
Have noticed that the functions, utilized without highlighting,
actually generate 2 new lines, one at the beginning, and one at
the end. This breaks line numbering (file grew longer in lines).
Believe this has existed *before* I worked on my syntax
highlighting and line numbering patch. If anyone can confirm
this is the case in Fossil 2.6 (have to inspect the html
markup), please let me know. This behaviour isn't exhibited
in the default builtin line numbering code, just the
non-line-numbering code.
Will follow up with a patch to fix that as well likely.
Apparently the previous patch (generated by fossil diff) wouldn't
work properly. This patch is generated by fossil diff -i... and
has worked at least locally. Thanks to an IRC user for letting
me know the patch was failing to apply properly. Please let me
know if this won't apply.
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