Ticket #66 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Filter "detailed comment" lines when cooking source files

Reported by: UdoBorkowski Owned by: GeorgVictorVoutsinos
Priority: minor Milestone: Tools 1.0
Component: tools Version:
Severity: low Keywords:
Cc:

Description

I'd like to "heavily comment" the source code that I contribute. On the other hand these extra comments blow up the TiddlyWiki file and most (end) users won't benefit from this. On the other hand other developer would probably prefer to get some details from time to time.

So I got the following idea:

in the source code file I write the "full comment", nice to read and with a lot details and background infos. Only some part of this comment should go into the generated source code (or maybe nothing at all). To achieve this I prefix all "detail comments" with the sequence "//#" (or something similar). During the cook process all lines that start with "//#" are removed, leaving just the "overview comments".

To give an example:

This may be code in the source file:

    // Sets the value of the given (meta) data field of the tiddler to value.
    //#
    //# Setting a (non-legacy) field's value to undefined removes the field.
    //# Setting a namespace to undefined removes all fields of that namespace.
    //#
    //# @param tiddler       Tiddler or tiddler name
    //# @param fieldName     the name of the field, optionally prefixed by a dot separated namespace path
    //# @param value         [may be undefined]
    //#
    TiddlyWiki.prototype.setValue = function(tiddler, fieldName, value) {
    ...

After running the cook the following text will be written to the TiddlyWiki.html file:

    // Sets the value of the given (meta) data field of the tiddler to value.
    TiddlyWiki.prototype.setValue = function(tiddler, fieldName, value) {
    ...

I am not familiar with ruby but I guess implementing this feature into the cook should not be a big deal ?!

Of cause this approach could also be used to document the "legacy core code". And maybe we can later provide some Reference manual generated from these comments, similar to the JavaDoc? approach.

Change History

Changed 4 years ago by JeremyRuston

  • status changed from new to assigned

Changed 4 years ago by JeremyRuston

  • milestone changed from 2.1 to Tools 1.0

Changed 4 years ago by GeorgVictorVoutsinos

  • owner changed from JeremyRuston to GeorgVictorVoutsinos
  • status changed from assigned to new

Changed 4 years ago by MartinBudden

  • status changed from new to closed
  • resolution set to fixed

Fixed in changeset:1075

Solution from GeorgVictorVoutsinos?

Note: See TracTickets for help on using tickets.