Edgewall Software

Changes between Version 4 and Version 5 of TracCrossReferences


Ignore:
Timestamp:
Sep 1, 2005, 2:48:03 PM (19 years ago)
Author:
Christian Boos
Comment:

Much more details about the relations and some current status info

Legend:

Unmodified
Added
Removed
Modified
  • TracCrossReferences

    v4 v5  
    44its backlinks are a little bit more powerful than traditional
    55backlinks...
    6 Therefore we should rather talk about ''cross-references''.
     6
     7Therefore we will rather talk about ''cross-references''.
    78
    89A cross-reference is a link from a Trac object (the ''source'')
     
    1415Here's the current list of Trac objects that can reference
    1516each other, along with their facets:
    16  * Wiki page
    17    * content facet
     17 * Wiki page ''(has the Cross-references navigation link)''
     18   * content facet                 ''(done)''
    1819   * attachment comment facets
    19  * Ticket
    20    * summary facet
    21    * description facet
    22    * comments facets
     20 * Ticket    ''(has the Cross-references navigation link)''
     21   * ~~summary facet~~ (seems that it was never
     22     intended to support wiki formatting, see #1888)
     23   * description facet             ''(done)''
     24   * comments facets               ''(done)''
    2325   * attachment comment facets
    2426   * (more to come...)
     
    3234   * description facet
    3335 * Source
    34    * (no facet, only as a target)
     36   * (no facet, only available as a target)
    3537
    36 A cross-reference is also called a ''relation'' if an explicit semantic is
    37 attached to the link from the source object to the destination object.
     38== Relations ==
     39
     40A cross-reference is also called a ''relation'' when
     41an explicit semantic is attached to the link
     42from the source object to the destination object.
     43
    3844If there's no relation defined, one simply knows that the two objects
    39 are somehow related, like for traditional backlinks
    40 (however, for a backlink, Trac will also show the text that surrounds
    41 the link in the source Wiki text, so that the implicit semantic
    42 can be easily guessed).
     45are somehow related, like with traditional backlinks.
     46
     47However, in the cross-references listing, for each backlink,
     48Trac will also show an excerpt of the source Wiki text
     49containing the link, so that the implicit semantic can be
     50easily guessed.
    4351
    4452Those relations can be used to fulfill many needs.
    45 The ticket dependencies feature is one example.
    46 The `tag` feature (see the [http://dev.muness.textdriven.com/trac.cgi/wiki/tags TagIt macro]) could be reimplemented on top of relations.
    4753
    48 For that, we need a convenient syntax in the wiki for introducing
    49 explicit relations. I would propose using `<<...>>`, which would
    50 nicely translate in HTML to [[html(&laquo;...&raquo;)]].
     54The ticket dependencies and other ticket relationships
     55are one example (see #886).
    5156
    52 Example:
     57The `tag` feature (see the
     58[http://dev.muness.textdriven.com/trac.cgi/wiki/tags TagIt macro]),
     59which could be reimplemented on top of relations, is another.
     60
     61=== Creating Explicit Relations with the UI ===
     62
     63This should be the normal way to create explicit relations.
     64For example, the ticket form could be extended to include
     65a '''duplicate of''' field, activated when the resolution
     66type is set to ''duplicate''.
     67The content of that field would be a facet for the ticket
     68and any reference found in the facet will create a specific
     69''duplicate-of'' relation, with the ticket as a source and
     70the reference as a target.
     71
     72=== Wiki Syntax for Explicit Relations ===
     73
     74If one wants maximum flexibility, it can be convenient to
     75use a specific wiki syntax for creating an explicit relation
     76from the current object to any other Trac object.
     77
     78I would propose using `<<...>>`, which can be nicely rendered
     79in HTML by [[html(&laquo;...&raquo;)]].
     80
     81Example, with the `tag` relation:
     82Writing
    5383{{{
    5484<<tag xref>>
    5585}}}
    56 would tag that page with the `xref` tag.
     86would relate the Trac object to which this wiki text belongs
     87to the Wiki page named "xref", using the explicit relation `tag`
     88(i.e. this would `tag` the current page with the `xref` tag).
     89
     90Multiple targets should be supported too:
     91{{{
     92<<tag xref, idea, #1242>>
     93}}}
     94Would tag this page with the all those 3 objects
     95
     96''Undecided issue:'' [[BR]]
     97In the above, I assume that unrecognized words
     98should be taken as wiki page names, so that one can write
     99`idea` instead of `IdeaTag` or `wiki:idea`.
     100However, in a facet (like in the '''duplicate of''' example above),
     101it might be convenient to add a description to the reference,
     102like `this is quite similar to #123, and just a rewording of #431`.
     103In that case, only recognized links should be taken as targets,
     104of course.
     105
     106=== Displaying Relations in the Wiki ===
    57107
    58108Also, a few macros could be created to make a powerful usage
     
    69119   * `<<tag xref>>` all the objects having the `xref` tag
    70120   * `<<depends-on #123>>` all the objects that depend on the ticket !#123
     121   * Special object patterns: `.` and `%`
     122     * `<<depends-on .>>`  all the objects that depend on the current object
     123     * `<<depends-on>>` same as above, `.` is the target if none given
     124     * `<<tag CS103/%>>` all the objects having a tag which name
     125       starts with `CS103`
    71126 * `<<... *rel*>>` would refer to the target objects
    72127   related to the specified source by relation `*rel*`
     
    74129   * `<<% tag>>` would list all tags of any object
    75130   * `<<. depends-on>>` would list all the objects (usually tickets)
    76      on which the current object (usually a ticket) depends on.
    77 
    78 
    79 
     131     on which the current object (usually a ticket) depends.
    80132
    81133----
     
    84136
    85137The [source:branches/cboos-dev/xref-branch xref] branch
    86 currently contains an implementation for it, and work
    87 is in progress to adapt it for trunk integration
    88 (any comments welcomed, of course).
     138currently contains an implementation for it.
     139It's kept in sync with all my other branches
     140(TracDiff and InterTrac) and, as such,
     141is also kept in sync with the trunk on a regular basis.
    89142
    90143See also:
     
    93146 * Relationship and ticket dependencies support: #31, #226 and #886
    94147 * Wiki Page renames: #1106
     148
     149=== Refactoring Ideas ===
     150
     151It should be noted that this general mechanism could be used
     152to reimplement a few things in Trac so that they become more general:
     153 * the ticket keywords could be reimplemented by using the `tag` relation
     154   described above. Unifying keywords and tags would enable to attach
     155   them to any Trac Object (see #695).
     156   In addition, one could fill the keyword list by picking in a list of
     157   already existing keywords.
     158 * the ticket components could be be reimplemented using a
     159   ''has-component'' relation, with the components being
     160   wiki pages (1). The advantage would be that a ticket could have multiple
     161   components, and that the component could be documented and used in a
     162   meaningful way in other relationships (e.g. #548, #1678 and
     163   TracMultipleProjects/SingleEnvironment#UsingComponentobjects)
     164 * idem for the versions, using a ''has-version'' relation
     165
     166----
     167 (1)::
     168   ... Wiki pages created from a !ComponentTemplate page, therefore
     169   having an ''is-a'' relationship to the above !ComponentTemplate page.
     170   This makes it simple to retrieve all components:
     171   those are the `[[Relation(<<is-a ComponentTemplate>>)]]` objects,
     172   or, in Python code,
     173   {{{
     174#!python
     175  components = WikiPage(self.env, 'ComponentTemplate').sources('is-a')
     176   }}}
     177   Of course, the !ComponentTemplate ''is-a'' !TemplateTemplate...