wwHelpEvents::OnCSharpCommentBlockPaste

This method fires before the Paste operation occurs on the 'Copy C# Comment Block' menu option as well as the hotkey operation that automatically updates a code snippet from a help topic in Help Builder.

This method allows customizing the output generated for embedding into a code snippet.

o.OnCSharpCommentBlockPaste(loTopic)

Parameters

loTopic
The topic object

Example

*** Default implementation
PARAMETER loTopic
LOCAL lcOutput, lnAt, __x, lnBreak

lnBreak = 75

lcBody = loTopic.Body
DO WHILE .T.
   lcExpression = STREXTRACT(lcBody,",")
   IF EMPTY(lcExpression)
      EXIT
   ENDIF
   *** Replace topic links with <see></see> tags
   IF lcExpression = "TopicLink"
      lcExtract = STREXTRACT(lcExpression,"],[","]")
      lcReplace = "<see>" + lcExtract + "</see>"
      lcRaw = " + lcExpression +"
      lcBody = STRTRAN(lcBody,lcRaw,lcReplace)
   ELSE
      lcBody = STRTRAN(lcBody," + lcExpression +","#" + lcExtract +"#")
   ENDIF
ENDDO

lcOutput =  "/// <summary>"+CRLF +;
   BreakString(lcBOdy,lnBreak,"/// ") + CRLF
   
IF !EMPTY(loTopic.SeeAlso)
   lcOutput = lcOutput + "/// <seealso>" +;
      loTopic.SeeAlso + "</seealso>" + CRLF
ENDIF

lcOutput = lcOutput + ;   
   "/// </summary>" + CRLF
   
IF !EMPTY(loTopic.PARAMETERS)
   lnLines = ALINES(laText,loTopic.Parameters,"")
   FOR __x = 1 TO lnLines
      lnAt = ATC("",laText[__x])
      IF lnAt > 0
        lcParm = LEFT(laText[__x],lnAt-1)
        lcBody = SUBSTR(laText[__x],lnAt + 6)
        IF EMPTY(lcBody)
           lcOutput = lcOutput +  [/// <param name="] + lcParm + ["></param>] + CRLF
        ELSE
           lcOutput = lcOutput +  [/// <param name="] + lcParm + [">] + CRLF +;
                       BreakString(lcBody,lnBreak,"/// ")+ CRLF + ;
                       "/// </param>" + CRLF
        ENDIF
      ENDIF
   ENDFOR
ENDIF

IF !EMPTY(loTopic.Returns)
   lcOutput = lcOutput + "/// <returns>" + ;
      CHRTRAN(loTopic.Returns,CHR(13)+CHR(10)," ") + ;
      "</returns>" + CRLF
ENDIF

IF !EMPTY(loTopic.Example)
   lcOutput = lcOutput + "/// <example>"+CRLF +;
      BreakString(loTopic.Example,lnBreak,"/// ")+CRLF +;
      "/// </example>" + CRLF
ENDIF

IF !EMPTY(loTopic.Remarks)
   lcOutput = lcOutput + "/// <remarks>"+CRLF +;
      BreakString(loTopic.Remarks,lnBreak,"/// ")+CRLF +;
      "/// </remarks>"
ENDIF

IF RIGHT(lcOutput,2) = CRLF
   lcOutput = SUBSTR(lcOutput,1,LEN(lcOutput)-2)
ENDIF

RETURN lcOutput

See also:

Class wwHelpEvents

© West Wind Techologies, 1996-2023 • Updated: 09/12/03
Comment or report problem with topic