* viewvc.py

(view_diff): Pass anchor locations to the diff template.

* diff_display.ezt
  (top-level): Generate anchors.

* revision.ezt
  (path links): Use anchors to point to content and property parts of the diff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2625 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/property-diff
stilor 2011-10-16 18:50:08 +00:00
parent 90a1d6cae2
commit 44a6fe7465
3 changed files with 11 additions and 2 deletions

View File

@ -3354,6 +3354,9 @@ class DiffDescription:
self.display_as = 'raw'
self.fp_differ = self._fp_vclib_raw
def anchor(self, anchor_name):
self.changes.append(_item(display_as='anchor', anchor=anchor_name))
def get_content_diff(self, left, right):
options = {}
if self.context != -1:
@ -3497,9 +3500,11 @@ def view_diff(request):
try:
if request.pathtype == vclib.FILE:
# Get file content diff
desc.anchor("content")
desc.get_content_diff(left_side_content, right_side_content)
# Get property list and diff each property
desc.anchor("properties")
desc.get_prop_diff(left_side_prop, right_side_prop)
except vclib.InvalidRevision:

View File

@ -1,3 +1,6 @@
[is diff.display_as "anchor"]
<a name="[diff.anchor]"></a>
[else]
[define msg_no_changes]<br/><strong>- No changes -</strong><br/>&nbsp;[end]
[define msg_binary]<br/><strong>- Binary content differs -</strong><br/>&nbsp;[end]
[define msg_error]<br/><strong>- ViewVC depends on rcsdiff and GNU diff to create this page. ViewVC cannot find GNU diff.
@ -18,6 +21,7 @@
Revision [if-any right_view_href]<a href="[right_view_href]">[end][diff.right.rev][if-any right_view_href]</a>[end][if-any diff.right.author] by <em>[diff.right.author]</em>[end],
[diff.right.date]
[if-any diff.right.tag]<br/>Tag: [diff.right.tag][end][end]
[end]
[is diff.display_as "raw"]
<table cellspacing="0" cellpadding="0" style="margin-top: 1em;">

View File

@ -60,8 +60,8 @@
[if-any changes.is_copy]<br /><em>(Copied from [changes.copy_path], r[changes.copy_rev])</em>[end]
</td>
<td>[if-any changes.log_href]<a href="[changes.log_href]" title="View Log">[end][changes.action][if-any changes.log_href]</a>[end]
[if-any changes.text_mods], [if-any changes.diff_href]<a href="[changes.diff_href]" title="View Diff">[end]text changed[if-any changes.diff_href]</a>[end][end]
[if-any changes.prop_mods], props changed[end]
[if-any changes.text_mods], [if-any changes.diff_href]<a href="[changes.diff_href]#content" title="View Diff">[end]text changed[if-any changes.diff_href]</a>[end][end]
[if-any changes.prop_mods], [if-any changes.diff_href]<a href="[changes.diff_href]#properties" title="View Property Diff">[end]props changed[if-any changes.diff_href]</a>[end][end]
</td>
</tr>
[end]