HTMLDocGeneratorForJavaScript.st
author Claus Gittinger <cg@exept.de>
Fri, 21 Feb 2020 20:48:14 +0100
changeset 1231 b7d945ef967a
parent 1197 90b1e7756b21
permissions -rw-r--r--
#REFACTORING by exept class: JavaScriptParser changed: #forStatement class: JavaScriptParser class added: #forOfAllowed comment/format in: #forInAllowed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1197
90b1e7756b21 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
     1
"{ Encoding: utf8 }"
90b1e7756b21 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
     2
365
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
     3
"
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
     4
 COPYRIGHT (c) 2007 by eXept Software AG
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
     5
              All Rights Reserved
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
     6
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
     7
 This software is furnished under a license and may be used
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
     8
 only in accordance with the terms of that license and with the
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    10
 be provided or otherwise made available to, or used by, any
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    11
 other person.  No title to or ownership of the software is
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    12
 hereby transferred.
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    13
"
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libjavascript' }"
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
1197
90b1e7756b21 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
    16
"{ NameSpace: Smalltalk }"
90b1e7756b21 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
    17
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
HTMLDocGenerator subclass:#HTMLDocGeneratorForJavaScript
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	instanceVariableNames:''
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'System-Documentation'
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!HTMLDocGeneratorForJavaScript class methodsFor:'documentation'!
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
365
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    27
copyright
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    28
"
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    29
 COPYRIGHT (c) 2007 by eXept Software AG
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    30
              All Rights Reserved
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    31
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    32
 This software is furnished under a license and may be used
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    33
 only in accordance with the terms of that license and with the
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    35
 be provided or otherwise made available to, or used by, any
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    36
 other person.  No title to or ownership of the software is
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    37
 hereby transferred.
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    38
"
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    39
!
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    40
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
examples
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    "
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
     HTMLDocGeneratorForJavaScript htmlDocOf:Array
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
     HTMLDocumentView openFullOnText:(HTMLDocGeneratorForJavaScript htmlDocOf:Array)
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    "
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
! !
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
834
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    48
!HTMLDocGeneratorForJavaScript class methodsFor:'document generation-helpers'!
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
htmlForMethod:aMethod
834
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    51
    "redefined to generate a javascript method spec"
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    52
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    53
    |who sel jsSel argStr firstArg|
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    who := aMethod who.
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    sel := who methodSelector.
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    jsSel := ''.
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    argStr := ''.
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
1197
90b1e7756b21 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
    60
    sel argumentCount > 0 ifTrue:[
834
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    61
        firstArg := true.
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
        (sel keywords) with:(aMethod methodArgNames) do:[:part :argName |
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
            |partWithoutColon xLatedArgName|
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
            (argName = 'aBlock') ifTrue:[
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
                xLatedArgName := 'aFunction'.
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
            ] ifFalse:[
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
                xLatedArgName := argName.
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
            ].
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
            (part endsWith:$:) ifTrue:[
589
3d9a8a8f282a Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 365
diff changeset
    72
                partWithoutColon := part copyButLast:1
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
            ] ifFalse:[
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
                partWithoutColon := part
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
            ].
834
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    76
            firstArg ifTrue:[
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    77
                "/ jsSel := partWithoutColon.
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
                argStr := '<I>' , xLatedArgName , '</I>'.
834
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    79
                firstArg := false.
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
            ] ifFalse:[
834
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    81
                "/ jsSel := jsSel , '_' , partWithoutColon.
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
                argStr := argStr , ', <I>' , xLatedArgName , '</I>'.
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
            ].
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
        ].
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    ] ifFalse:[
834
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    86
        "/ jsSel := sel.
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    ].
834
a503b02dc845 class: HTMLDocGeneratorForJavaScript
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    88
    jsSel := JavaScriptParser reverseTranslatedJavaScriptSelectorFor:sel.
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    ^ '<B>' , jsSel , '</B>' , '( ' , argStr , ' )'.
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    "Created: / 05-11-2007 / 16:14:46 / cg"
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
! !
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
!HTMLDocGeneratorForJavaScript class methodsFor:'documentation'!
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
version
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    ^ '$Header$'
365
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    98
!
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    99
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   100
version_CVS
d8b2d59dc4fd added: #copyright
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   101
    ^ '$Header$'
252
2219563f7719 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
! !
589
3d9a8a8f282a Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 365
diff changeset
   103