Anyone who can write an APL function should be able to host it on the web.β’
Rendered webpage |
APL code |
items β vector of char vectors containing the menu item caption
levels β the level of the corresponding item
links β the HREF string to be used when the corresponding element is chosen (clicked)
Items β vector of char vectors containing the menu item caption
Levels β the level of the corresponding item
Links β the HREF string to be used when the corresponding element is chosen (clicked)
MakeIds β 1 makes ids in the format myid_1_2
:Class WidgetDoc : MiPageSample
:include #.MS3SiteUtils
β Compose;ns;widget;ref;wref;src;chunk;files;r;split;find
:Access public
Add _.style'#view {display: none}'
rβ'<div class="WidgetDoc">'
(ns widget)βGet'namespace widget'
:If 9.1=#.βNCβns
refβ#.βns
:If 9=ref.βNC widget
wrefβrefβwidget
r,β'<h3 id="WidgetDocTitle">'
:If 0=wref.βNCβ'DocBase'
:OrIf 0ββ΄wref.DocBase β without link
r,βns,'.',widget
:Else β with link
r,β(ns,'.',widget)External wref.DocBase
:EndIf
srcβ1ββSRC wref
srcββ¨β+/β§\''ββ‘Β¨src
srcβ#.Strings.dlbΒ¨src
srcβsrc/β¨β§\'β'=βΒ¨src
srcβ'ΒΆ +'βR' 'β’'ΒΆ',Β¨1βΒ¨src
srcβ{1βΒ¨β΅ββ¨'ΒΆ'=β΅}βsrc
srcβHtmlSafeTextΒ¨#.Strings.dlbΒ¨src
:If 0ββ΄src
r,β'<h3 class="red">No documentation found.</h3>'
:Else
:For chunk :In src
β Section::
β Section:: text
β text - text
β - text
β code β text
β code
:If β¨/'::'β·chunk β Section::
:If β¨/findβ' - 'β·chunk
splitβfindβ³1
r,β'<h3>',(chunkββ¨split-1),'</h3>'
chunkβchunkββ¨split+2
findβ'- 'β·chunk
splitβfindβ³1
r,β'<p'
:If '-'β βchunk~' '
r,β' class="hang"'
:EndIf
r,β'>',(chunkββ¨split-1),'–',(splitβchunk),'</p>'
:Else
r,β'<h3>',chunk,'</h3>'
:EndIf
:ElseIf β¨/findβ'- 'β·chunk
splitβfindβ³1
r,β'<p'
:If '-'β βchunk~' '
r,β' class="hang"'
:EndIf
r,β'>',(chunkββ¨split-1),'–',(splitβchunk),'</p>'
:Else β [APL code] [β comment]
findβ'⍝'β·chunk
splitβ6+findβ³1
r,β'<p class="hang"><code>',(splitβchunk),'</code>',(splitβchunk),'</p>'
:EndIf
:EndFor
:EndIf
filesβ'relevant'ForControl widget
:If 0ββ΄files
r,β'<h3 class="red">No relevant sample pages found.</h3>'
:Else
r,β'<h3>Relevant Sample Pages:</h3>'
(filesβ'#samples'New _.Tabs(βββ{DescrEmbed β΅}Β¨files)).Themeβ'FF8C00'
r,βfiles.Render
:EndIf
:Else
r,β'<h3 class="red">Widget "',widget,'" not found in namespace ',ns,'.</h3>'
:EndIf
:Else
r,β'<h3 class="red">Namespace "',ns,'" not found.</h3>'
:EndIf
r,β'</div>'
Add'<h3>Description::' '::'βR'' ':'β’r
β
:EndClass