@farberg/reveal-template 1.0.63 → 1.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/generate_pdfs.js +11 -3
- package/scripts/generate_toc.js +3 -0
package/package.json
CHANGED
package/scripts/generate_pdfs.js
CHANGED
|
@@ -113,7 +113,13 @@ async function convert_to_pdf_single(todo) {
|
|
|
113
113
|
const page = await browser.newPage();
|
|
114
114
|
|
|
115
115
|
await page.goto(todo.presentation_url, { timeout: 5000, waitUntil: ['load', 'domcontentloaded'] });
|
|
116
|
-
|
|
116
|
+
|
|
117
|
+
const selector = 'div.lecturetitle > h1'
|
|
118
|
+
try {
|
|
119
|
+
await page.waitForSelector(selector, { timeout: 5000 })
|
|
120
|
+
} catch (e) {
|
|
121
|
+
console.error(`Unable to find selector ${selector} on ${todo.presentation_url}`)
|
|
122
|
+
}
|
|
117
123
|
|
|
118
124
|
if (verbose)
|
|
119
125
|
console.log(`Converting ${todo.md_file} to ${todo.pdf_file} using ${todo.presentation_url}`)
|
|
@@ -138,6 +144,7 @@ async function convert_to_pdf_single(todo) {
|
|
|
138
144
|
|
|
139
145
|
|
|
140
146
|
async function merge_pdfs(todos, out_file) {
|
|
147
|
+
const out_file_path = path.join(pdf_dir, path.basename(out_file))
|
|
141
148
|
const merger = new PDFMerger()
|
|
142
149
|
|
|
143
150
|
let pdfs = todos
|
|
@@ -150,8 +157,9 @@ async function merge_pdfs(todos, out_file) {
|
|
|
150
157
|
await merger.add(pdf)
|
|
151
158
|
}
|
|
152
159
|
if (verbose)
|
|
153
|
-
console.log(`Saving merged file to ${
|
|
154
|
-
|
|
160
|
+
console.log(`Saving merged file to ${out_file_path}`)
|
|
161
|
+
|
|
162
|
+
await merger.save(out_file_path);
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
|
package/scripts/generate_toc.js
CHANGED
|
@@ -20,6 +20,8 @@ let md_files = fs.readdirSync(".")
|
|
|
20
20
|
|
|
21
21
|
let generateTable = md_files.map(file => file.match(structuredNameRegexp)).reduce((a, b) => a && b, true)
|
|
22
22
|
|
|
23
|
+
console.error(`Generating ${generateTable ? 'table' : 'list'} of contents for ${md_files.length} files.`)
|
|
24
|
+
|
|
23
25
|
if (generateTable)
|
|
24
26
|
console.log("<table class='toc_table'>")
|
|
25
27
|
else
|
|
@@ -70,6 +72,7 @@ if (generateTable) {
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
let exists = fs.existsSync(path.join(pdf_folder, combined_pdf_name))
|
|
75
|
+
console.error(`Combined PDF ${exists ? "does" : "does not"} exist. Looking for '${combined_pdf_name}'`)
|
|
73
76
|
if (exists) {
|
|
74
77
|
console.log(`
|
|
75
78
|
<credits>
|