Revert "Remove hack in Timestamp parser now that 'remark-breaks' has addressed the original problem."
This reverts commit 02792b8f0c
.
This commit is contained in:
parent
45a603c1d6
commit
d71f977a55
1 changed files with 9 additions and 2 deletions
|
@ -30,6 +30,13 @@ function findNextTimestamp(value, fromIndex, strictlyFromIndex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fromIndex > 0 && fromIndex >= match.index && fromIndex < match.index + match[0].length) {
|
||||||
|
// Skip previously-rejected word, preventing "62:01" from being tokenized as "2:01", for example.
|
||||||
|
// This assumes that a non-zero 'fromIndex' means that a previous lookup has failed.
|
||||||
|
begin = match.index + match[0].length;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Exclude trailing colons to allow "0:12: Start of section", for example.
|
// Exclude trailing colons to allow "0:12: Start of section", for example.
|
||||||
const str = match[0].replace(/:+$/, '');
|
const str = match[0].replace(/:+$/, '');
|
||||||
|
|
||||||
|
@ -77,7 +84,7 @@ function locateTimestamp(value, fromIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate 'timestamp' markdown node
|
// Generate 'timestamp' markdown node
|
||||||
const createTimestampNode = (text) => ({
|
const createTimestampNode = text => ({
|
||||||
type: TIMESTAMP_NODE_TYPE,
|
type: TIMESTAMP_NODE_TYPE,
|
||||||
value: text,
|
value: text,
|
||||||
children: [{ type: 'text', value: text }],
|
children: [{ type: 'text', value: text }],
|
||||||
|
@ -138,7 +145,7 @@ const transformer = (node, index, parent) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const transform = (tree) => {
|
const transform = tree => {
|
||||||
visit(tree, [TIMESTAMP_NODE_TYPE], transformer);
|
visit(tree, [TIMESTAMP_NODE_TYPE], transformer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue