-
-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathtemplate.js
More file actions
21 lines (21 loc) · 628 Bytes
/
template.js
File metadata and controls
21 lines (21 loc) · 628 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module.exports = {
paragraph: (node) => `<p class="${node.getRoles().join(' ')}">${node.getContent()}</p>`,
section: (node) => `<section class="chapter">
<h2>${node.getTitle()}</h2>
${node.getContent()}
</section>`,
document: (node) => `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="./book.css" rel="stylesheet">
</head>
<body>
<div id="cover">
<h1>${node.getDocumentTitle()}</h1>
<h2>by ${node.getDocument().getAuthor()}</h2>
</div>
${node.getContent()}
</body>`,
image: (node) => `<img class="image ${node.getRoles().join(' ')}" src="${node.getImageUri(node.getAttribute('target'))}"/>`
}