On Wed, 22 Jun 2011 18:19:17 +0300, Ron Aaron wrote:
> Hi, Rene -
>
> I tried the instructions here:
>
> http://fossil-scm.org/index.html/wiki?name=Cookbook#HighlightDiff
>
> But have not got it to work; perhaps the instructions aren't quite
> correct, I haven't looked into it yet.
>
> On 06/22/2011 05:30 PM, Rene wrote:
>>
>>> in the fossil wiki does not work for me, not sure why.
>>
>> Which one(s) doesn't work for you? maybe I can be of help.
> _______________________________________________
> fossil-users mailing list
> [email protected]
>
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
I tested the solution and it works ON Ff 5.0, Chrome latest and IE 6.0
You might have forgotten the CSS. I added the following
<style type="text/css">
pre.diff {
color: #000;
}
pre .diff-position {
display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:block;
width: 100%;
font-style: italic;
padding: 0.5em 0;
margin: 0.5em 0;
border-top: 1px dotted #A2B5CD;
border-bottom: 1px dotted #A2B5CD;
color: #A2B5CD;
}
pre .diff-added {
background-color: #CEFBC3 !important;
}
pre .diff-removed {
background-color: #F5C2C1 !important;
}
</style>
to the header Just after the last <link ../>
and you have to add the javascript in the footer Before the </body>
After the div in the (standard) footer:
</div>
<script>
/* Simple diff highlighting */
var DiffHighlighter = {
isDiff : function(s){
return (s.match(/^@@.*@@/m) && s.match(/^[+-]/m));
},
highlightElement : function(el){
var s = el.innerHTML;
if (!this.isDiff(s)){
return;
}
s = s.replace("<", "<");
s = s.replace(/^\+.*$/mg, '<span class="diff-added">$&</span>');
s = s.replace(/^\-.*$/mg, '<span class="diff-removed">$&</span>');
s = s.replace(/^@@.*$/mg, '<span class="diff-position">$&</span>');
s = "<pre class='diff'>" + s + "</pre>"; // workaround for IE
el.innerHTML = s;
},
highlightElementsWithTagName : function(tagName){
var els = document.getElementsByTagName(tagName);
for (var i=0; i < els.length; i++){
this.highlightElement(els[i]);
}
}
};
DiffHighlighter.highlightElementsWithTagName('pre');
</script>
</body>
--
Rene
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users