Some fixes in line anchors generation.
[GB.MARKDOWN] * BUG: Some fixes in line anchors generation.
This commit is contained in:
parent
ec328f8d95
commit
6364bd1376
@ -73,6 +73,9 @@ Private Sub ConvertMarkup(aLine As String[], Optional bNoLineAnchors As Boolean)
|
||||
Dim sList As String
|
||||
Dim bSaveComment As Boolean
|
||||
Dim aTemp As String[]
|
||||
Dim cLine As Collection
|
||||
Dim J As Integer
|
||||
Dim iNextLine As Integer
|
||||
|
||||
aResult = New String[]
|
||||
|
||||
@ -119,6 +122,8 @@ Private Sub ConvertMarkup(aLine As String[], Optional bNoLineAnchors As Boolean)
|
||||
aLine[iLine] = ""
|
||||
|
||||
Next
|
||||
|
||||
If $hMarkdown.LinkAnchors And If Not bNoLineAnchors Then cLine = New Collection
|
||||
|
||||
iLine = -1
|
||||
While iLine < aLine.Max
|
||||
@ -126,7 +131,7 @@ Private Sub ConvertMarkup(aLine As String[], Optional bNoLineAnchors As Boolean)
|
||||
Inc iLine
|
||||
sLine = aLine[iLine]
|
||||
|
||||
If $hMarkdown.LinkAnchors And If Not bNoLineAnchors Then aResult.Add("<a id=\"l" & CStr(iLine) & "\"></a>")
|
||||
If $hMarkdown.LinkAnchors And If Not bNoLineAnchors Then GoSub ADD_LINE
|
||||
|
||||
$hMarkdown.Line = iLine
|
||||
$hMarkdown.Current = sLine
|
||||
@ -551,7 +556,28 @@ Private Sub ConvertMarkup(aLine As String[], Optional bNoLineAnchors As Boolean)
|
||||
aResult[iIndexPos] = "<div class=\"index\">\n" & ConvertMarkup($aIndex, True) & "</div>\n"
|
||||
Endif
|
||||
|
||||
If $hMarkdown.LinkAnchors And If Not bNoLineAnchors Then aResult.Add("<a id=\"l" & CStr(iLine) & "\"></a>")
|
||||
If $hMarkdown.LinkAnchors And If Not bNoLineAnchors Then
|
||||
|
||||
iLine = 0
|
||||
For I = 0 To aResult.Max
|
||||
If cLine.Exist(I) Then
|
||||
aLine = New String[]
|
||||
'If iLine Then aLine.Add("<a id=\"l" & CStr(iLine - 1) & "e\"></a>")
|
||||
iNextLine = cLine[I]
|
||||
For J = iLine To iNextLine - 1
|
||||
aLine.Add("<a id=\"l" & CStr(J) & "\"></a>") ' & "<a id=\"l" & CStr(J) & "e\"></a>")
|
||||
Next
|
||||
J = Len(aResult[I]) - Len(LTrim(aResult[I]))
|
||||
aResult[I] = Left(aResult[I], J) & aLine.Join("") & "<a id=\"l" & CStr(iNextLine) & "\"></a>" & Mid$(aResult[I], J + 1)
|
||||
iLine = iNextLine + 1
|
||||
Endif
|
||||
Next
|
||||
|
||||
'aLine = New String[]
|
||||
'If iLine Then aLine.Add("<a id=\"l" & CStr(iLine - 1) & "e\"></a>")
|
||||
aResult.Add("<a id=\"l" & CStr(iLine) & "\"></a>") ' & "<a id=\"l" & CStr(iLine) & "e\"></a>")
|
||||
|
||||
Endif
|
||||
|
||||
$bComment = bSaveComment
|
||||
$aMarkup = aSaveMarkup
|
||||
@ -571,7 +597,7 @@ CLOSE_CODE:
|
||||
CLOSE_BLOCKQUOTE:
|
||||
|
||||
While iBlockQuote
|
||||
aResult.Add("</blockquote>")
|
||||
aResult[aResult.Max] &= "</blockquote>"
|
||||
Dec iBlockQuote
|
||||
Wend
|
||||
Return
|
||||
@ -581,7 +607,8 @@ CLOSE_LIST:
|
||||
While iIndent < iCurrentIndent
|
||||
GoSub CLOSE_PARA
|
||||
GoSub CLOSE_CODE
|
||||
aResult.Add(Space$(iCurrentIndent) & "</li>")
|
||||
'aResult.Add(Space$(iCurrentIndent) & "</li>")
|
||||
aResult[aResult.Max] &= "</li>"
|
||||
bJustList = False
|
||||
aResult.Add(Space$(aList[aList.Max].iIndent) & "</" & aList[aList.Max].sType & ">")
|
||||
aList.Remove(aList.Max)
|
||||
@ -605,10 +632,11 @@ CLOSE_PARA:
|
||||
Endif
|
||||
Return
|
||||
|
||||
'Catch
|
||||
|
||||
' Error.Raise("Line " & CStr(iLine + 1) & ": " & Error.Text)
|
||||
ADD_LINE:
|
||||
|
||||
cLine[aResult.Count] = iLine
|
||||
Return
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user