stuff
This commit is contained in:
parent
bc92231240
commit
b8225c639e
11904 changed files with 1472749 additions and 133 deletions
29
node_modules/speech-rule-engine/mjs/highlighter/mml_highlighter.js
generated
vendored
Normal file
29
node_modules/speech-rule-engine/mjs/highlighter/mml_highlighter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { AbstractHighlighter } from './abstract_highlighter.js';
|
||||
export class MmlHighlighter extends AbstractHighlighter {
|
||||
constructor() {
|
||||
super();
|
||||
this.mactionName = 'maction';
|
||||
}
|
||||
highlightNode(node) {
|
||||
let style = node.getAttribute('style');
|
||||
style += ';background-color: ' + this.colorString().background;
|
||||
style += ';color: ' + this.colorString().foreground;
|
||||
node.setAttribute('style', style);
|
||||
return { node: node };
|
||||
}
|
||||
unhighlightNode(info) {
|
||||
let style = info.node.getAttribute('style');
|
||||
style = style.replace(';background-color: ' + this.colorString().background, '');
|
||||
style = style.replace(';color: ' + this.colorString().foreground, '');
|
||||
info.node.setAttribute('style', style);
|
||||
}
|
||||
colorString() {
|
||||
return this.color.rgba();
|
||||
}
|
||||
getMactionNodes(node) {
|
||||
return Array.from(node.getElementsByTagName(this.mactionName));
|
||||
}
|
||||
isMactionNode(node) {
|
||||
return node.tagName === this.mactionName;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue