Skip to contentSkip to conversation

Pass "-O xhtml" param to highlight instead of "-xhtml"

PATCH In review Adam Tkac 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Adam Tkac

author
#0 lore raw

PATCH 1/1 Pass "-O xhtml" param to highlight instead of "-xhtml"

Hello,

attached patch fixes the gitweb.perl script. Current highlight utility doesn't recognize --xhtml parameter, it recognizes only "-O xhtml" parameter.

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=672293

Regards, Adam

Signature · 1 line
Adam Tkac, Red Hat, Inc.
Quoted 1 line

From ec8043a730c165d8b438ccaba7c3cf5dc5fa65bc Mon Sep 17 00:00:00 2001

From: Adam Tkac <[email protected]>
Date: Wed, 26 Jan 2011 17:46:29 +0100
Subject: [PATCH] Pass "-O xhtml" parameter instead of "--xhtml" to hightlight in gitweb.

---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +1 -1
index 1025c2f..88556f4 100755
@@ -3468,7 +3468,7 @@ sub run_highlighter {
 	close $fd;
 	open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
 	          quote_command($highlight_bin).
-	          " --xhtml --fragment --syntax $syntax |"
+	          " -O xhtml --fragment --syntax $syntax |"
 		or die_error(500, "Couldn't open file or run syntax highlighter");
 	return $fd;
 }
Signature · 1 line
1.7.3.5
#1 lore raw
Quoted 3 lines · Adam Tkac

Hello,

attached patch fixes the gitweb.perl script.

Please don't send patches as attachements, but inline. See Documentation/SubmittingPatches

Quoted 4 lines

Current highlight utility doesn't recognize "--xhtml" parameter, it recognizes only "-O xhtml" parameter.

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=672293

Shouldn't the above be in commit message?

Quoted 1 line

Subject: [PATCH] Pass "-O xhtml" parameter instead of "--xhtml" to hightlight in gitweb.

Why the mismatch between subject of email, and subject in attached patch?

Quoted 11 lines
---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +0 -0
index 1025c2f..88556f4 100755

gitweb/gitweb.perl sub run_highlighter { · line 3474

Quoted 8 lines
gitweb/gitweb.perl +1 -1
@@ -3468,7 +3468,7 @@ sub run_highlighter {
 	close $fd;
 	open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
 	          quote_command($highlight_bin).
-	          " --xhtml --fragment --syntax $syntax |"
+	          " -O xhtml --fragment --syntax $syntax |"
 		or die_error(500, "Couldn't open file or run syntax highlighter");
 	return $fd;
 }

In highlight 2.4.5 '-O' means "name of output directory", i.e. --outdir. There is no --out-format either.

WTF this backward incompatibile change in highlight... the only solution that would make it work both for old and for new versions is to rely on the fact that HTML is default output format, i.e.

open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
quote_command($highlight_bin).
- " --xhtml --fragment --syntax $syntax |"
+ " --fragment --syntax $syntax |"
or die_error(500, "Couldn't open file or run syntax highlighter");

Signature · 3 lines
Jakub Narebski
Poland
ShadeHawk on #git
#2 lore raw
Quoted 6 lines · Jakub Narebski
Quoted 4 lines

Current highlight utility doesn't recognize "--xhtml" parameter, it recognizes only "-O xhtml" parameter.

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=672293

Shouldn't the above be in commit message?

Actually, I prefer not having that "Reference" in the commit message myself, but I do want to have some relevant details missing from the proposed commit message but is in
that ticket (especially the comment #5) in the commit message.

Quoted 2 lines

In highlight 2.4.5 '-O' means "name of output directory", i.e. --outdir. There is no --out-format either.

Thanks for digging about 2.4.5; in that case, unlike the redhat ticket hinted, this change may not be backward compatible enough, as it seems that the compatibility goes only back to 3.0.something.

Quoted 10 lines

WTF this backward incompatibile change in highlight... the only solution that would make it work both for old and for new versions is to rely on the fact that HTML is default output format, i.e.

open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
quote_command($highlight_bin).
- " --xhtml --fragment --syntax $syntax |"
+ " --fragment --syntax $syntax |"
or die_error(500, "Couldn't open file or run syntax highlighter");

Adam, Jochen? How does the counterproposal look to you?

Without knowing much about highlight nor using gitweb in general myself, the above looks a bit more reasonable fix to the issue, if the default format has been and will stay to be HTML.

author
#3 lore raw
Quoted 14 lines · Junio C Hamano
Quoted 6 lines · Jakub Narebski
Quoted 4 lines

Current highlight utility doesn't recognize "--xhtml" parameter, it recognizes only "-O xhtml" parameter.

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=672293

Shouldn't the above be in commit message?

Actually, I prefer not having that "Reference" in the commit message myself, but I do want to have some relevant details missing from the proposed commit message but is in
that ticket (especially the comment #5) in the commit message.

Quoted 6 lines
Quoted 2 lines

In highlight 2.4.5 '-O' means "name of output directory", i.e. --outdir. There is no --out-format either.

Thanks for digging about 2.4.5; in that case, unlike the redhat ticket hinted, this change may not be backward compatible enough, as it seems that the compatibility goes only back to 3.0.something.

Right you are, I digged too shallowly, thanks for your inspection.

Quoted 12 lines
Quoted 11 lines

WTF this backward incompatibile change in highlight... the only solution that would make it work both for old and for new versions is to rely on the fact that HTML is default output format, i.e.

open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
quote_command($highlight_bin).
- " --xhtml --fragment --syntax $syntax |"
+ " --fragment --syntax $syntax |"
or die_error(500, "Couldn't open file or run syntax highlighter");

Quoted 5 lines

Adam, Jochen? How does the counterproposal look to you?

Without knowing much about highlight nor using gitweb in general myself, the above looks a bit more reasonable fix to the issue, if the default format has been and will stay to be HTML.

The proposal looks like the best (and the only one) correct solution. I will send updated patch.

Regards, Adam

Signature · 1 line
Adam Tkac, Red Hat, Inc.
author
#4 lore raw

PATCH 1/1 Don't pass "--xhtml" to hightlight in gitweb.perl script.

The "--xhtml" option is supported only in highlight < 3.0. There is no option to enforce (X)HTML output format compatible with both highlight < 3.0 and highlight >= 3.0. However default output format is HTML so we don't need to explicitly specify it.

---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +1 -1
index 1025c2f..0779f12 100755
@@ -3468,7 +3468,7 @@ sub run_highlighter {
 	close $fd;
 	open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
 	          quote_command($highlight_bin).
-	          " --xhtml --fragment --syntax $syntax |"
+	          " --fragment --syntax $syntax |"
 		or die_error(500, "Couldn't open file or run syntax highlighter");
 	return $fd;
 }
Signature · 1 line
1.7.3.5