Tags:
create new tag
view all tags

Implemented: display changes in TWikiFormsValues

TWiki Diff settings

To configure the default DiffRenderingStyle and Number of Context lines use the following variables in TWikiPreferences, WebPreferences or the UserTopic
  • choose between sequential, sidebyside, debug
    • Set DIFFRENDERSTYLE = sequential
  • number of lines
    • Set DIFFCONTEXTLINES = 6

I would recomend that the defaults be sequential and 9999, so that by default, diffs look like a normal topic view, but with annotation for changes (colour highlights etc)

The sequential render style is supposed to be the same as we had before i made the code changes, except that it is not harder to remove the META data from the diff (see DiffShouldSuppressTopicInfoMetaData).

so you now have the URL options

  • render = {sidebyside|sequential|debug}
    • sidebyside - 2 columns, before and after, with annotations to show changes
    • sequential - shows one document with changes annotated inline
    • a debug view of the post parse list of lines
  • type = {diff|history|last}
    • diff - will show only the differences between the 2 specified versions
    • history - will show each change made between the 2 specified versions
    • last - will show only the last change made
  • context = number of lines of context (if possible)

examples of usage as URL parameters:

another trick is used in the inline link on WebChangesForAllWebs


when you do a diff on a TWikiForms page, you get the raw METAFIELDS. this is going to be very confusing to my target audience - its supposed to be a bug tracking system - and then a support database, and then .... smile

I think I might need to implement some sort of word by word diff and render the Form with different colourd text...

Or does someone have a better idea ??

-- SvenDowideit - 24 Sep 2001

This should be fixed, diffs of forms and attachents should be rendered as nicely as with previous releases. E.g. diffed line by line and then diffs rendered line by line.

The 01 Sep 2001 had a long delay but was still kind of rushed out. I would have liked to see this fixed before the release.

-- PeterThoeny - 25 Sep 2001

The diff problems are really an inevitable consequence of the meta data format. I would be good to experiment with different filters to help on the diffs.

-- JohnTalintyre - 25 Sep 2001

Looking at the output of the diff, we might be able to just render the changed lines as table rows..

Changed:  
<
< %META:FIELD{name="TimeEstimated" title="Time Estimated" value=""}% 
 
>
> %META:FIELD{name="TimeEstimated" title="Time Estimated" value="1"}% 
thus getting

Changed

TimeEstimated  

TimeEstimated 1

-- SvenDowideit - 25 Sep 2001

Refactored topic and separated out the ChooseFormButtonIssues.

-- PeterThoeny - 25 Sep 2001

Rendering the diffs correctly is no issue if we change the rendering back to what it was before, e.g. $text contains visible text and meta data in raw format, and handleCommonTags() renders that content "as is", including meta data. Diffs will show changes to form meta data and file attachment meta data nicely because each meta data entry occupies one line. This brings up SimplifyInternalMetaDataHandling.

-- PeterThoeny - 25 Sep 2001

I'm going to have to try out a few things.... oviously starting with readTopicText smile

does anyone have any perferences for how the diffs should look ?

-- SvenDowideit - 12 Jan 2003

Of course! smile

If this was a question about how the diff of the TWiki text should appear, I would say I prefer what I call "Word style" diffs -- that is show a paragraph one time (only), but within that paragraph show added words in bold (or underlined) and deleted words hashed out.

Maybe that's not completely relevant to metadata (or maybe I'm answering your question at a "micro" level instead of a "macro" level), but I think the same approach is applicable to metadata.

I'd even like a similar approach for things like URLs -- or maybe a slight variation -- show the URL twice, but in the first instance show the original URL with anything that is deleted (in the revised URL hashed out, and anything new bolded, then show the new URL with new stuff in bold, but old stuff not appearing.

-- RandyKramer - 12 Jan 2003

This is also my preference - and so i would like to hear from more people smile as I tend not to trust my prefences for general user interface features... I am not sure if my changes will encompass all diffs, but assuming i find the time and the motivation I was dreaming of having several different looks - side-by-side, raw, word-by-word etc.

I also feel the need to provide more context - either by increasing the number of lines either side of changes, or as in MsWord, showing the whole file and higlighting the changes from the previous version.

for example http://twiki.org/cgi-bin/rdiff/Codev/CairoRelease?rev1=1.18&rev2=1.17 is about as unhelpful and example of the diff system that I came across recently

-- SvenDowideit - 13 Jan 2003

Here is a quick patch against AthensRelease for rendering form/meta data a bit more readable. It just turns it into a standard table with 3 columns, changes to form fields (e.g. for a TicketWiki) are display like so:

META TYPE Field name attribute/value list
META FIELD Label Field Label value
Index: rdiff
===================================================================
RCS file: /var/cvs/twiki/bin/rdiff,v
retrieving revision 1.1
retrieving revision 1.3
diff -c -r1.1 -r1.3
*** rdiff       2002/06/19 13:53:37     1.1
--- rdiff       2003/03/28 09:09:56     1.3
***************
*** 30,35 ****
--- 30,44 ----
  {
      my( $data, $topic ) = @_;
      if( $data ) {
+       if( $data =~ /%META/ )
+       {
+           $data =~ s(^%META:TOPICPARENT.*="([^"]+).*$)
+                     (|*META TOPICPARENT*|$1 ||)gm;
+           $data =~ s(^%META:FIELD.name="(.*?)".title="(.*?)".value="(.*?)".*$)
+                     (|*META FIELD $2*|$1 |$3 |)gm;
+           $data =~ s(^%META:([A-Z]+).\w+="([^"]+)"(.*).%$)
+                     (|*META $1*|$2 |$3 |)gm;
+       }
          $data = &TWiki::handleCommonTags( $data, $topic );
          $data = &TWiki::getRenderedVersion( $data );
          if( $data =~ m/<\/?(th|td|table)/i )
A (faked) diff section looks like such:
META FORM WebForm  
META FIELD TopicClassification TopicClassification FeatureToDo
META FIELD ProjectGroup ProjectGroup ChangesProject
META FIELD ImplementationDate ImplementationDate N/A
META FIELD CoreTeam Owner RichardDonkin
META FILEATTACHMENT gugus.doc attr="" comment="dada" date="1045157794" path="c:\temp\gugus.doc" size="346624" user="PeterKlausner" version="1.1"
META TOPICMOVED PeterKlausner date="1042642713" from="TWiki.Here" to="TWiki.There"

Of course, it would be nicer to split each attribue/value pair into a column of its own, but that would really bloat the expression...

Note, that the line with CoreTeam .. Owner .. RichardDonkin works only with the patch in DynamicFormOptionDefinitions.

-- PeterKlausner - 21 Feb 2003 ++ minor refinements - 21 May 2003

That patch is a very good start, short and much improved output. I think it would be good to have PluginCallForDiffs. The would allow for a user choice of diff output styles and Plugins implementing these. Perhaps TWiki core could lose all this capability, with a standard/default plugin providing the baseline capability.

-- JohnTalintyre - 10 Dec 2003

I am commiting the patch by PeterKlausner as a first step as it certainly improves the diff output. the rdiff script however does deserve to be taken behind the shed, and given a solid beating smile

-- SvenDowideit - 19 Mar 2004

its been progressing well - I have modularised the code a bit better, moved the diff parsing code into RcsWrapDotPm, and have added a few new parameters to RdiffCgiScript (that are not quite finished)

so you now have the options (use in the URL)

  • render = {sidebyside|sequential|debug}
    • sidebyside - 2 columns, before and after, with annotations to show changes
    • sequential - shows one document with changes annotated inline
    • a debug view of the post parse list of lines
  • type = {diff|history|last}
    • diff - will show only the differences between the 2 specified versions
    • history - will show each change made between the 2 specified versions
    • last - will show only the last change made
  • context = number of lines of context (if possible)

and we are thinking about more options for rev[12] = {last|first|[-+][0-9]+|prev|next} - this is almos definatly defered until Dakar

-- SvenDowideit - 09 Apr 2004

Sven, could you elaborate a bit more on the render options? I would like to know what to change to the More page eventually.

  • Arthur - can ou be more specific about what needs more info? I'm too close to this to realise it frown

-- ArthurClemens - 09 Apr 2004 snip - moved docco to top smile -- SvenDowideit - 02 May 2004

Should this go into TWikiPreferences, or into a separate topic? In either case I think it suffices to put a "Change render options" link on the More page, that links to either topic.

But the settings block above begs for images as what does what! So sidebyside/sequential/post parse list (?) could be a set of 3 radio buttons each with a small image. I am thinking aloud for DakarRelease, where we should enhance topic usability and attractability.

-- ArthurClemens - 09 May 2004

Yes Arthur, you've managed to voice a curio that I haven't been able to - I'm not sure how much of the above block belongs anywhere yet -

Where are we going to document the urlparams for the scripts? and how do we explain them (including on TWikiSystems that cannot currently do them (like diffs on non-versioned systems))?

My plan is to put to top bit of the box into TWikiPreferences, and then hope for more advice for the remainder - maybe a ScriptUrlParams page

-- SvenDowideit - 10 May 2004

Related Topics

RelatedTopics summary
DiffAttachments diffs on attached files
DiffsHardToRecognize one of the reasons for this FeatureToDo refactor
DiffsInNotifyEmail  
DiffsShouldShowEntireTableRow refactor
HardwiredRDiffColours a relatively simple and worthwhile enhancement
HumbleDiffs more duplication - has a list of related topics
UnifiedDiffOutput good patch to look at integrating
RdiffErrorNoSuchFileOrDirectory simple bug fix it!!
RdiffShouldShowContext two more patches
TWikiFormsDiffRendering  
WordDiff i like word diff the most with a perl diff! steal this code!!


Category: TWikiPatches
Edit | Attach | Watch | Print version | History: r27 < r26 < r25 < r24 < r23 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r27 - 2004-08-16 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.