mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-28 11:40:32 +02:00
Start of new epub reader
This commit is contained in:
parent
70ba2f7850
commit
44363f05ac
16 changed files with 1761 additions and 2 deletions
50
server/libs/css/stringify/compiler.js
Normal file
50
server/libs/css/stringify/compiler.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
|
||||
/**
|
||||
* Expose `Compiler`.
|
||||
*/
|
||||
|
||||
module.exports = Compiler;
|
||||
|
||||
/**
|
||||
* Initialize a compiler.
|
||||
*
|
||||
* @param {Type} name
|
||||
* @return {Type}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Compiler(opts) {
|
||||
this.options = opts || {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit `str`
|
||||
*/
|
||||
|
||||
Compiler.prototype.emit = function(str) {
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
* Visit `node`.
|
||||
*/
|
||||
|
||||
Compiler.prototype.visit = function(node){
|
||||
return this[node.type](node);
|
||||
};
|
||||
|
||||
/**
|
||||
* Map visit over array of `nodes`, optionally using a `delim`
|
||||
*/
|
||||
|
||||
Compiler.prototype.mapVisit = function(nodes, delim){
|
||||
var buf = '';
|
||||
delim = delim || '';
|
||||
|
||||
for (var i = 0, length = nodes.length; i < length; i++) {
|
||||
buf += this.visit(nodes[i]);
|
||||
if (delim && i < length - 1) buf += this.emit(delim);
|
||||
}
|
||||
|
||||
return buf;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue