diff --git a/comp/src/gb.markdown/.src/Markup.module b/comp/src/gb.markdown/.src/Markup.module index 78f8a5e35..aee0210d8 100644 --- a/comp/src/gb.markdown/.src/Markup.module +++ b/comp/src/gb.markdown/.src/Markup.module @@ -60,7 +60,7 @@ Private Sub ConvertMarkup(aLine As String[], Optional bDoNotSetLine As Boolean) Dim hMarkupList As MarkupList Dim bJustList As Boolean Dim sLink As String - Dim iPos, iPos2 As Integer + Dim iPos As Integer Dim aList As New MarkupList[] Dim sTable As String Dim iIndexPos As Integer = -1 @@ -73,7 +73,6 @@ Private Sub ConvertMarkup(aLine As String[], Optional bDoNotSetLine As Boolean) Dim sList As String Dim bSaveComment As Boolean Dim aTemp As String[] - Dim sCommand As String aResult = New String[] @@ -155,27 +154,14 @@ Private Sub ConvertMarkup(aLine As String[], Optional bDoNotSetLine As Boolean) sLine = Mid$(sLine, iPos + 4) Endif - ' Special command + ' Special command alone on its line - If sLine = "@{index}" Then - iIndexPos = aResult.Count - aResult.Add(sLine) - Continue - Endif - - iPos = 0 - Do - iPos = InStr(sLine, "@{", iPos + 1) - If iPos = 0 Then Break - iPos2 = InStr(sLine, "}", iPos + 2) - If iPos2 = 0 Then Break - sCommand = Mid$(sLine, iPos + 2, iPos2 - iPos - 2) - If Not sCommand Then Break - - aCommand = $hMarkdown.Command(sCommand) - - If iPos = 1 And If iPos2 = Len(sLine) Then - + If Left(sLine, 2) = "@{" And If Right(sLine) = "}" Then + If sLine = "@{index}" Then + iIndexPos = aResult.Count + aResult.Add(sLine) + Else + aCommand = $hMarkdown.Command(Mid$(sLine, 3, -1)) If aCommand And If aCommand.Count Then If $hMarkdown.Reinterpret Then aLine.Insert(aCommand, iLine + 1) @@ -184,41 +170,9 @@ Private Sub ConvertMarkup(aLine As String[], Optional bDoNotSetLine As Boolean) Endif $hMarkdown.Reinterpret = True Endif - - Break - - Else - - If aCommand And If aCommand.Count Then - sLine = Left(sLine, iPos - 1) & aCommand[0] & Mid(sLine, iPos2 + 1) - iPos += Len(aCommand[0]) - Endif - - $hMarkdown.Reinterpret = True - Endif - - Loop - - If iPos Then Continue - - ' If Left(sLine, 2) = "@{" And If Right(sLine) = "}" Then - ' If sLine = "@{index}" Then - ' iIndexPos = aResult.Count - ' aResult.Add(sLine) - ' Else - ' aCommand = $hMarkdown.Command(Mid$(sLine, 3, -1)) - ' If aCommand And If aCommand.Count Then - ' If $hMarkdown.Reinterpret Then - ' aLine.Insert(aCommand, iLine + 1) - ' Else - ' aResult.Insert(aCommand) - ' Endif - ' $hMarkdown.Reinterpret = True - ' Endif - ' Endif - ' Continue - ' Endif + Continue + Endif ' Blockquote @@ -671,6 +625,8 @@ Private Sub ConvertLine(sLine As String) As String Dim bUnderline As Boolean Dim bLimitBefore, bLimitAfter As Boolean Dim iLen As Integer + Dim sCommand As String + Dim aCommand As String[] iLen = String.Len(sLine) @@ -700,13 +656,11 @@ MAIN_LOOP: If sCar = "<" Then Goto ENTER_MARKUP - 'If $aMarkup.Count = 0 Then + If sCar = "&" Then Goto ENTER_AMPERSAND + + If sCar = "[" And If String.Mid$(sLine, I + 1, 1) <> " " Then Goto ENTER_LINK - If sCar = "&" Then Goto ENTER_AMPERSAND - - If sCar = "[" And If String.Mid$(sLine, I + 1, 1) <> " " Then Goto ENTER_LINK - - 'Endif + If sCar = "@" And If String.Mid$(sLine, I + 1, 1) = "{" Then Goto ENTER_COMMAND If I = 1 Or If IsWordLimit(String.Mid$(sLine, I - 1, 1)) Then bLimitBefore = True @@ -1027,6 +981,7 @@ ENTER_LINK: sLink = $hLink.Link sText = $hLink.Text + If sText Then sText = ConvertLine(sText) sTitle = $hLink.Title If Not sText Then sText = sLink @@ -1047,6 +1002,35 @@ ENTER_LINK: Goto MAIN_LOOP +ENTER_COMMAND: + + GoSub NEXT_CAR + + sCommand = "" + Do + GoSub NEXT_CAR + If Not sCar Then + sResult &= "