Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 5x 5x 71x 71x 71x 71x 98x 99x 99x 99x 99x 98x 1x 1x 1x 1x 99x 71x 99x 99x 12x 12x 12x 12x 12x 12x 87x 87x 99x 99x 1x 99x 99x 99x 99x 99x 1x 98x | import { CommentParser } from 'src/comment'; import { Options } from 'src/options'; export class DropProcessor { private slideCommentRegex = /<!--\s*(?:\.)?slide.*-->/; private parser = new CommentParser(); process(markdown: string, options: Options) { let output = markdown; markdown .split(new RegExp(options.separator, 'gmi')) .map(slidegroup => { return slidegroup .split(new RegExp(options.verticalSeparator, 'gmi')) .map(slide => { if (slide.trim().length > 0) { const newSlide = this.transformSlide(slide, options); const split = output.split(slide); if (split.length == 2) { output = split.join(newSlide); } else { const right = split.splice(1).join(slide); const left = split[0]; const both = [left, right]; output = both.join(newSlide); } return newSlide; } else E{ return slide; } }) .join(options.verticalSeparator); }) .join(options.separator); return output; } transformSlide(slide: string, options: Options) { const [md, notes] = this.extractNotes(slide, options); let outMd, outSlideComment; if (this.slideCommentRegex.test(md)) { const [match] = this.slideCommentRegex.exec(md); const comment = this.parser.parseLine(match); comment.addClass('drop'); outMd = md.replace(this.slideCommentRegex, ''); outMd = outMd.trim(); outSlideComment = this.parser.commentToString(comment); } else { outMd = md.trim(); outSlideComment = '<!-- .slide: class="drop" -->'; } let out = `${outSlideComment}\n<grid absolute="true" drag="100 100" drop="0 0">\n${outMd}\n</grid>`; if (notes.length > 0) { out += '\n\n' + notes; } return out; } extractNotes(input: string, options: Options): [string, string] { let noteSeparator = 'note:'; Iif (options.notesSeparator && options.notesSeparator.length > 0) { noteSeparator = options.notesSeparator; } const spliceIdx = input.indexOf(noteSeparator); if (spliceIdx > 0) { return [input.substring(0, spliceIdx), input.substring(spliceIdx)]; } else { return [input, '']; } } } |