Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lexer] Add code, hr lexer unittests.
- Loading branch information
1 parent
6f72512
commit e6cb716
Showing
7 changed files
with
71 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as marked from 'marked'; | ||
import Lexer from './index'; | ||
|
||
export default class InlineLexer { | ||
private lexer; | ||
private inlineLexer; | ||
|
||
constructor(links: object, options?: LexerOptions) { | ||
let $this = this; | ||
$this.lexer = new Lexer(); | ||
$this.inlineLexer = new marked.InlineLexer(links); | ||
} | ||
|
||
output(source: string): string { | ||
let $this = this; | ||
return $this.inlineLexer.output($this.lexer.lex(source)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
import * as marked from 'marked'; | ||
import {TokensList} from '../shared/token'; | ||
|
||
|
||
export default class Parser { | ||
constructor(src: TokensList, options?: ParserOptions) { | ||
private parser; | ||
|
||
constructor(src: TokensList, options?: ParserOptions) { | ||
let $this = this; | ||
$this.parser = new marked.Parser(); | ||
} | ||
|
||
parse(src: TokensList, options?: ParserOptions): string { | ||
return ''; | ||
parse(tokens: TokensList, options?: ParserOptions): string { | ||
let $this = this; | ||
return $this.parser.parse(tokens); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import _ from 'lodash'; | ||
|
||
import InlineLexer from '@/lexer/inline-lexer'; | ||
|
||
describe('inline-lexer:code', () => { | ||
let inlineLexer; | ||
|
||
before(() => { | ||
}); | ||
|
||
it('should compile inline code blocks', () => { | ||
const mdString = `[This link](http://example.net/) has no title attribute.`; | ||
|
||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters