Menu

#15 Added support for HelpInsight style comments

closed
None
5
2012-11-05
2012-02-07
Vasek Cejka
No

Support for Delphi /MS VS style somments in form /// <tag> comment </tag> added. Internally they are translated to pasdoc tags. Tags supported in this version (see TParser.ExpandHelpInsightDescriptions):
summary ->@abstract
param -> @param
returns -> returns
exception -> @raises
permission -> @permission
c -> @code
code -> @preformatted
b -> @bold
i -> @italic
u -> @underline
br -> @br
ul -> @unorderedList
ol -> @orderedList
li -> @item
remark -> plain text
remarks -> plain text
comment -> plain text

New token type TOK_COMMENT_HELPINSIGHT added to PasDoc_Tokeniker.TTokenType, and also corresponding TOKEN_TYPE_NAMES string and TokenCommentTypes set member. Detection of new comment style is added to TTokenizer.ReadCommentType3, translation is launched from TParser.GetLastComment.

Discussion

  • Vasek Cejka

    Vasek Cejka - 2012-02-07

    Patch for support of HelpInsight style comments

     
  • Michalis Kamburelis

    Thank you. I quickly looked at the patch, looks very clean and should apply without any problems. The only small thing that will have to be fixed is to replace RegularExpressions unit and class with FPC equivalent under {$ifdef FPC}, I can take care of it.

    I understand the official docs about this feature are here: http://delphi.wikia.com/wiki/Help_insight .

    I'm not sure do I like implementing this using regular expressions, but it's certainly much shorter and simpler than anything I can otherwise propose now :)

     
  • Michalis Kamburelis

    I forgot to add: I will actually test it and adjust to FPC and apply tomorrow.

     
  • Vasek Cejka

    Vasek Cejka - 2012-02-07

    Thank you very much for such fast answer. You are right with regular expressions. I'm not using FPC, so I'm not used thinking about that.

     
  • Michalis Kamburelis

    Applied, thank you for the patch!

    See the latest SVN source code (trunk). Your patch was applied in revision 1308. I added note to ChangeLog. (Say your full name, or fill it in SourceForge account, if you want me to change the "(by VCejka)" to use your full name :)

    I adjusted regexp code to use FPC's RegExpr unit (in FPC >= 2.6.0). Delphi code (under $ifndef FPC) should work the same (but please check, as I do not own Delphi).

    A little problem was found by testsuite: you replace always, even when author didn't use /// comment. Consider code like this:

    { Returns HTML line break,
    . }
    function LibeBreak: string;

    { My docs. @html(Some text using HTML tags
    blah blah
    ) }
    procedure Foo;

    In both these cases,
    must not be replaced with @br. The general rule in pasdoc comments is that < and > do not have any special meaning (only @ is special), this must not be broken in comments not using ///. I fixed it already (in SVN revision 1310) by LastCommentHelpInsight variable, and ExpandHelpInsightDescriptions is only run when LastCommentHelpInsight = true.

     

Log in to post a comment.