@@ -27,81 +27,16 @@ def blockquote(state: StateBlock, startLine: int, endLine: int, silent: bool) ->
2727 return False
2828 except IndexError :
2929 return False
30- pos += 1
3130
3231 # we know that it's going to be a valid blockquote,
3332 # so no point trying to find the end of it in silent mode
3433 if silent :
3534 return True
3635
37- # set offset past spaces and ">"
38- initial = offset = state .sCount [startLine ] + 1
39-
40- try :
41- second_char : str | None = state .src [pos ]
42- except IndexError :
43- second_char = None
44-
45- # skip one optional space after '>'
46- if second_char == " " :
47- # ' > test '
48- # ^ -- position start of line here:
49- pos += 1
50- initial += 1
51- offset += 1
52- adjustTab = False
53- spaceAfterMarker = True
54- elif second_char == "\t " :
55- spaceAfterMarker = True
56-
57- if (state .bsCount [startLine ] + offset ) % 4 == 3 :
58- # ' >\t test '
59- # ^ -- position start of line here (tab has width==1)
60- pos += 1
61- initial += 1
62- offset += 1
63- adjustTab = False
64- else :
65- # ' >\t test '
66- # ^ -- position start of line here + shift bsCount slightly
67- # to make extra space appear
68- adjustTab = True
69-
70- else :
71- spaceAfterMarker = False
72-
73- oldBMarks = [state .bMarks [startLine ]]
74- state .bMarks [startLine ] = pos
75-
76- while pos < max :
77- ch = state .src [pos ]
78-
79- if isStrSpace (ch ):
80- if ch == "\t " :
81- offset += (
82- 4
83- - (offset + state .bsCount [startLine ] + (1 if adjustTab else 0 )) % 4
84- )
85- else :
86- offset += 1
87-
88- else :
89- break
90-
91- pos += 1
92-
93- oldBSCount = [state .bsCount [startLine ]]
94- state .bsCount [startLine ] = (
95- state .sCount [startLine ] + 1 + (1 if spaceAfterMarker else 0 )
96- )
97-
98- lastLineEmpty = pos >= max
99-
100- oldSCount = [state .sCount [startLine ]]
101- state .sCount [startLine ] = offset - initial
102-
103- oldTShift = [state .tShift [startLine ]]
104- state .tShift [startLine ] = pos - state .bMarks [startLine ]
36+ oldBMarks = []
37+ oldBSCount = []
38+ oldSCount = []
39+ oldTShift = []
10540
10641 terminatorRules = state .md .block .ruler .getRules ("blockquote" )
10742
@@ -127,8 +62,8 @@ def blockquote(state: StateBlock, startLine: int, endLine: int, silent: bool) ->
12762 # - - -
12863 # ```
12964
130- # for (nextLine = startLine + 1 ; nextLine < endLine; nextLine++) {
131- nextLine = startLine + 1
65+ # for (nextLine = startLine; nextLine < endLine; nextLine++) {
66+ nextLine = startLine
13267 while nextLine < endLine :
13368 # check if it's outdented, i.e. it's inside list item and indented
13469 # less than said list item:
@@ -153,7 +88,7 @@ def blockquote(state: StateBlock, startLine: int, endLine: int, silent: bool) ->
15388 # This line is inside the blockquote.
15489
15590 # set offset past spaces and ">"
156- initial = offset = state .sCount [nextLine ] + 1
91+ initial = state .sCount [nextLine ] + 1
15792
15893 try :
15994 next_char : str | None = state .src [pos ]
@@ -166,18 +101,16 @@ def blockquote(state: StateBlock, startLine: int, endLine: int, silent: bool) ->
166101 # ^ -- position start of line here:
167102 pos += 1
168103 initial += 1
169- offset += 1
170104 adjustTab = False
171105 spaceAfterMarker = True
172106 elif next_char == "\t " :
173107 spaceAfterMarker = True
174108
175- if (state .bsCount [nextLine ] + offset ) % 4 == 3 :
109+ if (state .bsCount [nextLine ] + initial ) % 4 == 3 :
176110 # ' >\t test '
177111 # ^ -- position start of line here (tab has width==1)
178112 pos += 1
179113 initial += 1
180- offset += 1
181114 adjustTab = False
182115 else :
183116 # ' >\t test '
@@ -188,6 +121,7 @@ def blockquote(state: StateBlock, startLine: int, endLine: int, silent: bool) ->
188121 else :
189122 spaceAfterMarker = False
190123
124+ offset = initial
191125 oldBMarks .append (state .bMarks [nextLine ])
192126 state .bMarks [nextLine ] = pos
193127
0 commit comments