Start to fix and enhance automatic project documentation.

[DEVELOPMENT ENVIRONMENT]
* BUG: Start to fix and enhance automatic project documentation.
This commit is contained in:
Benoît Minisini 2022-10-26 17:58:28 +02:00
parent 7a0841fd21
commit 9dbebf8d33
6 changed files with 72 additions and 26 deletions

View File

@ -20,13 +20,13 @@ Component=gb.form.editor
Component=gb.form.htmlview
Component=gb.settings
Component=gb.form.mdi
Component=gb.net
Component=gb.net.curl
Component=gb.form.print
Component=gb.form.stock
Component=gb.term
Component=gb.form.terminal
Component=gb.gui.webview
Component=gb.net
Component=gb.net.curl
Component=gb.markdown
Component=gb.pcre
Component=gb.signal

View File

@ -509,11 +509,14 @@ End
Private Sub GetSymbolLink(hSymbol As CSymbolInfo, sName As String) As String
Return Subst("<a class=\"none\" href=\"&1\">&2</a>", Html(hSymbol.GetHelpURL()), sName)
If hSymbol.HasHelp() Then
Return Subst("<!--&2--><a class=\"none\" href=\"&1\">&2</a>", Html(hSymbol.GetHelpURL()), Html(sName))
Else
Return Subst("<!--&1-->&1", Html(sName))
Endif
End
Public Sub GetHelpHTML() As String
Dim sClass As String = Name
@ -532,13 +535,9 @@ Public Sub GetHelpHTML() As String
Dim sParent As String
Dim hParentClass As CClassInfo
Dim sStr As String
Dim sSpace As String
' sHelp = GetHelpMarkup()
' sHelp &= "\n" & WikiGetSymbols().Join("\n")
' Return WikiMarkdown.ToHTML(sHelp)
'sHelp = Markup.Convert(GetHelpMarkup())
sHelp = Markdown.ToHTML(GetHelpMarkup())
sHelp = WikiMarkdown.ToHTML(GetHelpMarkup())
hClassInfo = Documentation.GetClassDescription(sClass)
cClassSymbols = hClassInfo.Symbols 'CComponent.GetClassSymbols(sClass)
@ -610,6 +609,7 @@ Public Sub GetHelpHTML() As String
' Endif
sSymbols = ""
sSpace = " &nbsp; "
If aStaticMethod.Count + aStaticProperty.Count + aStaticVar.Count + aConst.Count Then
@ -622,10 +622,10 @@ Public Sub GetHelpHTML() As String
sSymbols &= "</tr><tr valign=\"top\">"
If aStaticProperty.Count Then sSymbols &= "<td>" & aStaticProperty.Join(" ") & "</td><td width=\"32\">&nbsp;</td>"
If aStaticVar.Count Then sSymbols &= "<td>" & aStaticVar.Join(" ") & "</td><td width=\"32\">&nbsp;</td>"
If aStaticMethod.Count Then sSymbols &= "<td>" & aStaticMethod.Join(" ") & "</td><td width=\"32\">&nbsp;</td>"
If aConst.Count Then sSymbols &= "<td>" & aConst.Join(" ") & "</td><td width=\"32\">&nbsp;</td>"
If aStaticProperty.Count Then sSymbols &= "<td>" & aStaticProperty.Join(sSpace) & "</td><td width=\"32\">&nbsp;</td>"
If aStaticVar.Count Then sSymbols &= "<td>" & aStaticVar.Join(sSpace) & "</td><td width=\"32\">&nbsp;</td>"
If aStaticMethod.Count Then sSymbols &= "<td>" & aStaticMethod.Join(sSpace) & "</td><td width=\"32\">&nbsp;</td>"
If aConst.Count Then sSymbols &= "<td>" & aConst.Join(sSpace) & "</td><td width=\"32\">&nbsp;</td>"
sSymbols &= "</tr></table>"
@ -642,10 +642,10 @@ Public Sub GetHelpHTML() As String
sSymbols &= "</tr><tr valign=\"top\">"
If aProperty.Count Then sSymbols &= "<td>" & aProperty.Join(" ") & "</td><td width=\"32\">&nbsp;</td>"
If aVar.Count Then sSymbols &= "<td>" & aVar.Join(" ") & "</td><td width=\"32\">&nbsp;</td>"
If aMethod.Count Then sSymbols &= "<td>" & aMethod.Join(" ") & "</td><td width=\"32\">&nbsp;</td>"
If aEvent.Count Then sSymbols &= "<td>" & aEvent.Join(" ") & "</td><td width=\"32\">&nbsp;</td>"
If aProperty.Count Then sSymbols &= "<td>" & aProperty.Join(sSpace) & "</td><td width=\"32\">&nbsp;</td>"
If aVar.Count Then sSymbols &= "<td>" & aVar.Join(sSpace) & "</td><td width=\"32\">&nbsp;</td>"
If aMethod.Count Then sSymbols &= "<td>" & aMethod.Join(sSpace) & "</td><td width=\"32\">&nbsp;</td>"
If aEvent.Count Then sSymbols &= "<td>" & aEvent.Join(sSpace) & "</td><td width=\"32\">&nbsp;</td>"
sSymbols &= "</tr></table>"

View File

@ -872,6 +872,17 @@ Public Function GetHelpURL(Optional bShowFile As Boolean) As String
End
Public Sub HasHelp() As Boolean
If Component = CComponent.PROJECT_NAME Or If Not Component Then
Return GetHelpMarkup()
Else
Return True
Endif
End
'' Transform one line of help into HTML by decoding some sort of light wiki syntax.
''
'' - #sLine# is the line of help text.
@ -1054,7 +1065,7 @@ Public Function GetHelpHTML() As String
sMarkup = GetHelpMarkup()
If sMarkup Then
Try sHelp = Markdown.ToHTML(sMarkup)
Try sHelp = WikiMarkdown.ToHTML(sMarkup)
If Error Then sHelp = "<b>" & Error.Text & "</b>"
Endif

View File

@ -22,8 +22,6 @@ Private $hTimerNotExist As Timer
Public Sub _new()
Project.InitWebView
$hObs = New Observer(Me) As "WebView"
$hWatcher = New Watcher(Me) As "Watcher"

View File

@ -23,6 +23,11 @@ Public Sub ReadConfig() As Boolean
Dim bOffline As Boolean
Dim bRet As Boolean
Dim hDefaultFont As Font
Dim hFixedFont As Font
hDefaultFont = Font[Settings["/Help/Font"]]
hFixedFont = Font[Settings["/Help/FixedFont", Project.DEFAULT_FONT]]
bOffline = Settings["/UseOfflineHelp"]
If Not $hView Or If bOffline Xor $hView Is HtmlView Then
@ -41,8 +46,19 @@ Public Sub ReadConfig() As Boolean
Endif
If bOffLine Then
$hView.Font = Font[Settings["/Help/Font"]]
$hView.MonospaceFont = Font[Settings["/Help/FixedFont"]]
$hView.Font = hDefaultFont
$hView.MonospaceFont = hFixedFont
Else
$hView.Settings.Fonts.Serif = hDefaultFont.Name
$hView.Settings.Fonts.SansSerif = hDefaultFont.Name
$hView.Settings.Fonts.DefaultSize = hDefaultFont.Size
$hView.Settings.Fonts.Fixed = hFixedFont.Name
$hView.Settings.Fonts.DefaultFixedSize = hFixedFont.Size
Endif
Return bRet

View File

@ -7,6 +7,9 @@ Public Sub Link(hLink As MarkdownLink)
Dim sPath As String
Dim sLink As String = hLink.Link
Dim iPos As Integer
Dim sClass As String
Dim sSymbol As String
Dim hClass As CClassInfo
If sLink Begins "/" Then
sPath = sLink
@ -18,10 +21,28 @@ Public Sub Link(hLink As MarkdownLink)
sLink = hLink.Text
iPos = InStr(sLink, ".")
If iPos Then
hLink.Text = ""
sPath = "/comp/gb" &/ Trim(Left$(sLink, iPos - 1)) &/ Trim(Mid$(sLink, iPos + 1))
If iPos Then
sClass = Left$(sLink, iPos - 1)
sSymbol = Mid$(sLink, iPos + 1)
Else
sClass = sLink
Endif
Try hClass = Project.Documentation.Classes[sClass]
If hClass And If hClass.Component = CComponent.PROJECT_NAME Then
hLink.Link = "gambas://project/" & sClass &/ sSymbol
hLink.Text = sLink
hLink.Blank = True
Return
Endif
hLink.Text = ""
sPath = "/comp/gb" &/ sClass &/ sSymbol
Else