Christian Boos | 23 Nov 09:50

Re: Wiki links to code?

Christopher Petrilli wrote:

> On Mon, 15 Nov 2004 23:01:26 +0100, Katana <katana@...> wrote:
>  
>
>> Hello Rob,
>>
>>  
>>
>>> hmm, it might be kinda neat if you could put wiki markup in the
>>> comments in your src code... hmm...
>>>     
>>
>>
>> Hmm, now this is tasty :)
>>
>> I'm pretty sure it would not be very complex to implement, but I fear
>> that there might be side effects by doing this... unwanted links, and
>> so on...
>>   
>
>
>
> Given that CamelCase is often/always used for lots of OO programming
> languages, I'd say that auto-highlighting would be a bad thing,
> however, it seems that *IF* there is a match between a Wiki name and
> something in the program, it's likely to be related. In other words,
> perhaps code should be "link only" and not allow creation of new wiki
> pages?
>
> Chris
>
>  
>
(... if a Camel-cased class name would be linked to
a Wiki page, that page could be used for documenting
the class!)

About the idea of WikiFormatting the source code:

I think it could make sense for comments.
One could write things like: // this is the fix for #1234!
and while browsing see the #1234 as a link to ticket 1234.

To achieve that, one possibility would be to do a
post-processing of the syntax-highlighted code.

For example, {{{enscript}}} puts all the C/C++ comments in

   <span class="c_commentline">// ...</span>

elements, so it would be enough to WikiFormat the content
of these elements.

About the idea of creating links to the content of the source code itself,
I think that it is not very appropriate to refer to line numbers, unless to
revision is specified too.

It would be more useful to be able to reference strings that would be
searched for.  This can be related to a similar need of making links
to the content of wiki pages, especially to a particular section.

What about a syntax like this one:
  * refering to a string:
    * source:/trunk/trac/WikiFormatter.py:"class Formatter"
    * ThisWikiPage:"== That particular heading =="
  * refering to a line number:
    * source:/trunk/trac/WikiFormatter.py#922:378

-- CB

Gmane