[noImplicitAny: true] src/text
This commit is contained in:
parent
871f886702
commit
8c40917cc2
16 changed files with 166 additions and 44 deletions
|
|
@ -1,4 +1,4 @@
|
|||
function escape(text) {
|
||||
function escape(text: string) {
|
||||
return text
|
||||
.replace(/>/g, '>')
|
||||
.replace(/</g, '<');
|
||||
|
|
@ -110,7 +110,14 @@ const symbols = [
|
|||
'?'
|
||||
];
|
||||
|
||||
const elements = [
|
||||
type Token = {
|
||||
html: string
|
||||
next: number
|
||||
};
|
||||
|
||||
type Element = (code: string, i: number, source: string) => (Token | null);
|
||||
|
||||
const elements: Element[] = [
|
||||
// comment
|
||||
code => {
|
||||
if (code.substr(0, 2) != '//') return null;
|
||||
|
|
@ -305,7 +312,7 @@ export default (source: string, lang?: string) => {
|
|||
|
||||
let i = 0;
|
||||
|
||||
function push(token) {
|
||||
function push(token: Token) {
|
||||
html += token.html;
|
||||
code = code.substr(token.next);
|
||||
i += token.next;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue