Fix documentation of embedded arrays, structures and embedded arrays of structures.

[DEVELOPMENT ENVIRONMENT]
* BUG: Fix documentation of embedded arrays, structures and embedded arrays of structures.
This commit is contained in:
gambas 2021-06-15 16:45:35 +02:00
parent eb941620bf
commit 4f6107e443
7 changed files with 103 additions and 15 deletions

View file

@ -31,7 +31,7 @@ Component=gb.signal
Description="Integrated Development Environment for Gambas"
Authors="Benoît Minisini\nFabien Bodard\nCharlie Reinl\nJosé Luis Redrejo\nRobert Rowe\nTobias Boege"
Arguments=[["-L"],["-t","/home/benoit/gambas/git/master/app/src/gambas3"],["--help"]]
Environment="GB_GUI=gb.gtk3\n GTK_DEBUG=interactive"
Environment="GB_GUI=gb.qt5\n GTK_DEBUG=interactive"
TabSize=2
Translate=1
Language=en

View file

@ -1065,7 +1065,11 @@ Public Function GetClassSymbols(sClass As String, Optional sComponent As String)
If Right(sClass, 2) = "[]" Then
'GetClassSymbols(Left(sClass, -2))
hClass = CreateClass(sClass, "", "*")
hClass.CopyFrom(Classes[If(sClass Begins "$", "$*[]", "*[]")], "*", Left(sClass, -2))
If sClass Begins "$" Then
hClass.CopyFrom(Classes["$*[]"], "*", Mid$(sClass, 2, -2))
Else
hClass.CopyFrom(Classes["*[]"], "*", Left(sClass, -2))
Endif
$hClass = hClass
Return hClass.Symbols
Endif

View file

@ -689,6 +689,8 @@ Static Public Function GetType(sType As String, Optional bBalise As Boolean) As
'ELSE
sType = "Object"
'ENDIF
Else If sType Begins "$" Then
sType = Mid$(sType, 2)
Endif
If bBalise Then
@ -839,7 +841,11 @@ Public Function GetHelpURL(Optional bShowFile As Boolean) As String
sPath &/= LCase(sComp)
' We keep the class case for custom object arrays
If Class Ends "[]" And If Not hComp[Class] Then
sPath &/= Class
If Class Begins "$" Then
sPath &/= Mid$(Class, 2)
Else
sPath &/= Class
Endif
Else
sPath &/= LCase(Class) 'Left(Class) & Replace(Mid(Class, 2), "_", "."))
Endif
@ -1122,6 +1128,14 @@ Private Function GetClassVariableName(sClass As String) As String
Dim sRes As String
If sClass Begins "*" And If Wiki.SubstClass Then
If sClass = "*" Then
sClass = Left(Wiki.SubstClass, -2)
Else If sClass = "*[]" Then
sClass = Wiki.SubstClass
Endif
Endif
If Len(sClass) = 1 Then
sClass = $cTypeName[sClass]
If InStr("aeiou", LCase(Left$(sClass))) Then
@ -1164,10 +1178,19 @@ End
Private Function GetSyntaxType(sType As String) As String
If Wiki.SubstClass And If sType Begins "*" Then
If sType = "*" Then
sType = Left(Wiki.SubstClass, -2)
Else If sType = "*[]"
sType = Wiki.SubstClass
Endif
Endif
If Len(sType) = 1 Then
sType = $cTypeName[sType]
Else
If Right$(sType) = ";" Then sType = Left$(sType, -1)
If sType Begins "$" Then sType = Mid$(sType, 2)
sType = Wiki.GetClassLinkFromName(sType)
'sType = "<a href=\"" & Application.Root &/ "comp" & "\">" & sType & "</a>"
Endif

View file

@ -1475,6 +1475,9 @@ Static Public Function ReadSymbolType(aSym As String[], iIndex As Integer, Optio
Endif
If bArray Then
If bEmbed Then
If sType = UCase(sType) Then sType = Left(sType) & LCase(Mid$(sType, 2))
Endif
If bEmbed And If bStruct Then
Return "$" & sType & "[]"
Else

View file

@ -122,7 +122,7 @@ Public Sub Open(hForm As FEditor, iCol As Integer, hSymbol As CSymbolInfo, iArg
btnHelp.Visible = $bUseHelp
sName = hSymbol.Name
If Left$(sName) = "_" Then sName = hSymbol.Class
If Left$(sName) = "_" Then sName = CSymbolInfo.GetType(hSymbol.Class)
sSign = "<b>" & sName & "</b>" & sSign
lblNewSignature.W = Max(64, $hEditor.W - 64)

View file

@ -925,6 +925,7 @@ Public Sub MakeOffline(hWebView As WebView, sUrl As String, Optional bNoHeader A
Dim iPos2 As Integer
Dim sQuery As String
Dim sPath As String
Dim sDir As String
Wiki.Root = GetOfflineDir()
Wiki.InfoDir = CComponent.GetInfoDir()
@ -957,7 +958,8 @@ Public Sub MakeOffline(hWebView As WebView, sUrl As String, Optional bNoHeader A
Wiki.Path = "/" &/ Mid$(sUrl, 8)
Wiki.AnalyzePath()
sPath = GetOfflineDir() &/ "data" &/ Wiki.Lang &/ Wiki.Path &/ "page.html"
sDir = GetOfflineDir() &/ "data" &/ Wiki.Lang &/ Wiki.Path
sPath = sDir &/ "page.html"
If Not IsDir(File.Dir(sPath)) Then
If Wiki.Class And If Wiki.HasDefaultHelp() Then
@ -965,6 +967,10 @@ Public Sub MakeOffline(hWebView As WebView, sUrl As String, Optional bNoHeader A
Endif
Endif
If Not IsDir(sDir) Then
sPath = File.SetExt(Temp$("help"), "html")
Endif
hFile = Open sPath For Create
Output To #hFile

View file

@ -24,6 +24,7 @@ Public UserName As String
Public (Component) As String
Public (Class) As String
Public Symbol As String
Public SubstClass As String
Public Documentation As New CDocumentation("wiki")
@ -549,7 +550,7 @@ Public Sub GetClassTitle(Optional sPath As String) As String
If hClass Then
If sPath Then Return hClass.Name
Return hClass.Name & " (" & sComponent & ")"
Return Replace(hClass.Name, "*", "\\*") & " (" & sComponent & ")"
Else
If sPath Then Return sClass
Return sClass & " (" & sComponent & ")"
@ -566,6 +567,7 @@ Public Sub GetSymbolTitle(Optional sPath As String) As String
Dim sClass As String
Dim sSymbol As String
Dim aPath As String[]
Dim sName As String
If Not sPath Then
sComponent = Wiki.Component
@ -580,8 +582,11 @@ Public Sub GetSymbolTitle(Optional sPath As String) As String
Endif
Try hSym = Documentation.Get(sComponent)[sClass].Symbols[sSymbol]
If sPath Then
If Not hSym And If sClass Ends "[]" Then
Try hSym = Documentation.Get(sComponent)["*[]"].Symbols[sSymbol]
Endif
If Not hSym Then Return sSymbol & " ?"
If InStr("e:", hSym.Kind) Then
Return Mid$(hSym.Name, 2)
@ -592,26 +597,28 @@ Public Sub GetSymbolTitle(Optional sPath As String) As String
If Not hSym Then Return sClass & "." & sSymbol & " (" & sComponent & ")?"
sName = CSymbolInfo.GetType(hSym.Class)
Select Case Wiki.Symbol
Case "_new"
sTitle = "New " & hSym.Class
sTitle = "New " & sName
Case "_put"
sTitle = hSym.Class & "[] = ..."
sTitle = sName & "[] = ..."
Case "_get"
sTitle = hSym.Class & "[]"
sTitle = sName & "[]"
Case "_call"
sTitle = hSym.Class & "()"
sTitle = sName & "()"
Case "_next"
sTitle = "For Each " & hSym.Class
sTitle = "For Each " & sName
Default
If InStr(":e", hSym.Kind) Then
sTitle = "Event " & hSym.Class & "." & Mid$(hSym.Name, 2)
sTitle = "Event " & sName & "." & Mid$(hSym.Name, 2)
Else
sTitle = hSym.Class & "." & hSym.Name
sTitle = sName & "." & hSym.Name
Endif
End Select
Return sTitle & " (" & hSym.Component & ")"
Return Replace(sTitle, "*", "\\*") & " (" & hSym.Component & ")"
End
@ -786,6 +793,7 @@ Public Sub PrintPage()
Dim sPath As String
Dim sData As String
Dim iPos As Integer
Dim hClass As CClassInfo
If Wiki.Image Then
Print "<img src=\"" & WikiRoot &/ Wiki.Path & "?v\" />";
@ -794,6 +802,41 @@ Public Sub PrintPage()
sPath = Wiki.SolvePath(Wiki.Path)
If Not Wiki.ExistPage(sPath) Then
If Wiki.Class Then
If Wiki.Class Ends "[]" And If Not Documentation.Get(Wiki.Component)[Wiki.Class] Then
Wiki.SubstClass = Wiki.Class
Wiki.Class = "*[]"
sPath = Wiki.SolvePath("/comp/" & LCase(Wiki.Component &/ Wiki.Class &/ Wiki.Symbol))
Endif
Endif
Endif
If Not Wiki.ExistPage(sPath) And If Not Wiki.HasDefaultHelp() Then
If Wiki.Symbol Then
Do
hClass = Documentation.Get(Wiki.Component)[Wiki.Class]
If Not hClass Or If Not hClass.Parent Then Break
Wiki.Component = hClass.ParentComponent
Wiki.Class = hClass.Parent
sPath = SolvePath("/comp/" & LCase(Wiki.Component &/ Wiki.Class &/ Wiki.Symbol))
If Wiki.ExistPage(sPath) Or If Wiki.HasDefaultHelp() Then Break
Loop
Endif
Endif
If Not Wiki.ExistPage(sPath) Then
If Wiki.Lang <> Wiki.DEFAULT_LANG Then
@ -848,12 +891,21 @@ Public Sub PrintPage()
Else
sData = "# " & Wiki.GetClassTitle() & "\n" & sData
Endif
If Wiki.SubstClass Then
sData = Replace(sData, "\\*", Left(Wiki.SubstClass, -2))
Endif
Endif
PRINT_MARKDOWN:
Print WikiMarkdown.ToHTML(sData)
Finally
Wiki.SubstClass = ""
Catch
Print "<pre>"; Html(Error.Text); " at line #"; WikiMarkdown.Line + 1; ":\n\n"; Html(WikiMarkdown.Current); "\n\nStack backtrace:\n\n"; Error.Backtrace.Join("\n"); "</pre>";