lib/commands/embedding.rb
changed.
Other files ignored by Codecov
test/resources/docs/blank-line.md
has changed.
214 | 214 | end |
|
215 | 215 | end |
|
216 | 216 | ||
217 | + | # A blank line dividing the embedding instruction and the code fence. |
|
218 | + | # |
|
219 | + | # The line may be used for formatting purposes. It is harmless and has no effect of the overall |
|
220 | + | # tool behaviour. |
|
221 | + | # |
|
222 | + | class BlankLine |
|
223 | + | def recognize(context) |
|
224 | + | return false unless context.current_line.strip.empty? |
|
225 | + | ||
226 | + | !context.reached_eof && !context.code_fence_started && context.embedding |
|
227 | + | end |
|
228 | + | ||
229 | + | def accept(context, _) |
|
230 | + | context.result.push(context.current_line) |
|
231 | + | context.to_next_line |
|
232 | + | end |
|
233 | + | end |
|
234 | + | ||
217 | 235 | # An opening "bracket" of the code fence. |
|
218 | 236 | class CodeFenceStart |
|
219 | 237 | def recognize(context) |
293 | 311 | STATE_TO_TRANSITION = { |
|
294 | 312 | REGULAR_LINE: RegularLine.new, |
|
295 | 313 | EMBEDDING_INSTRUCTION: EmbedInstructionToken.new, |
|
314 | + | BLANK_LINE: BlankLine.new, |
|
296 | 315 | CODE_FENCE_START: CodeFenceStart.new, |
|
297 | 316 | CODE_FENCE_END: CodeFenceEnd.new, |
|
298 | 317 | CODE_SAMPLE_LINE: CodeSampleLine.new, |
304 | 323 | TRANSITIONS = { |
|
305 | 324 | START: [:FINISH, :EMBEDDING_INSTRUCTION, :REGULAR_LINE], |
|
306 | 325 | REGULAR_LINE: [:FINISH, :EMBEDDING_INSTRUCTION, :REGULAR_LINE], |
|
307 | - | EMBEDDING_INSTRUCTION: [:CODE_FENCE_START], |
|
326 | + | EMBEDDING_INSTRUCTION: [:CODE_FENCE_START, :BLANK_LINE], |
|
327 | + | BLANK_LINE: [:CODE_FENCE_START, :BLANK_LINE], |
|
308 | 328 | CODE_FENCE_START: [:CODE_FENCE_END, :CODE_SAMPLE_LINE], |
|
309 | 329 | CODE_SAMPLE_LINE: [:CODE_FENCE_END, :CODE_SAMPLE_LINE], |
|
310 | 330 | CODE_FENCE_END: [:FINISH, :EMBEDDING_INSTRUCTION, :REGULAR_LINE] |
Files | Coverage |
---|---|
lib/commands | 94.98% |
Project Totals (8 files) | 94.98% |