|
|
|
@ -12,7 +12,7 @@ const log = logging.create(import.meta.url); |
|
|
|
|
const title_box = { x: 17, y: 415, width: 405, align: "center" }; |
|
|
|
|
const summary_box = { width: 405, height: 540 }; |
|
|
|
|
const main_title = { align: "center", width: 1196, height: 883, x: 586, y: 99}; |
|
|
|
|
const main_box = { width: 928, height: 535, x: 720, y: 273}; |
|
|
|
|
const main_box = { width: 928, height: 535, x: 720, y: 323}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const description = "Generates a PDF presentation from an input .md file and a background template." |
|
|
|
@ -77,17 +77,17 @@ const write_page = (doc, template, content) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(content.type == "title-bullets") { |
|
|
|
|
doc.fontSize(80); |
|
|
|
|
doc.fontSize(120); |
|
|
|
|
// add the title/body text
|
|
|
|
|
doc.font("heading").text(content.slide_title, main_title.x, main_title.y, main_title); |
|
|
|
|
|
|
|
|
|
doc.fontSize(40); |
|
|
|
|
doc.fontSize(80); |
|
|
|
|
|
|
|
|
|
doc.list(content.slide_body, main_box.x, main_box.y, main_box); |
|
|
|
|
|
|
|
|
|
} else if(content.type == "title-image") { |
|
|
|
|
// it's a title only slide
|
|
|
|
|
doc.fontSize(80); |
|
|
|
|
doc.fontSize(120); |
|
|
|
|
// add the title/body text
|
|
|
|
|
doc.font("heading").text(content.slide_title, main_title.x, main_title.y, main_title); |
|
|
|
|
|
|
|
|
@ -98,17 +98,25 @@ const write_page = (doc, template, content) => { |
|
|
|
|
}); |
|
|
|
|
} else if(content.type == "title-only") { |
|
|
|
|
// it's a title only slide
|
|
|
|
|
doc.fontSize(80); |
|
|
|
|
doc.font("heading").text(content.slide_title, main_title.x, main_title.y + (main_title.height / 3), main_title); |
|
|
|
|
doc.fontSize(160); |
|
|
|
|
doc.font("heading").text(content.slide_title, main_title.x, main_title.y + (main_title.height / 3.5), main_title); |
|
|
|
|
} else { |
|
|
|
|
// this handles title-text slides, and anything else
|
|
|
|
|
doc.fontSize(80); |
|
|
|
|
doc.fontSize(120); |
|
|
|
|
// add the title/body text
|
|
|
|
|
doc.font("heading").text(content.slide_title, main_title.x, main_title.y, main_title); |
|
|
|
|
|
|
|
|
|
doc.fontSize(40); |
|
|
|
|
// if I put a # I want this to be a subtitle
|
|
|
|
|
if(content.slide_body.startsWith("#")) { |
|
|
|
|
doc.fontSize(100); |
|
|
|
|
const trim_body = content.slide_body.slice(1).trim(); |
|
|
|
|
doc.font("body").text(trim_body, main_box.x, main_box.y, {align: "center", ...main_box}); |
|
|
|
|
} else { |
|
|
|
|
doc.fontSize(60); |
|
|
|
|
doc.font("body").text(content.slide_body, main_box.x, main_box.y, main_box); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const next_page = (doc) => { |
|
|
|
@ -165,19 +173,17 @@ export const main = async (opts) => { |
|
|
|
|
|
|
|
|
|
const pages = parse_input(opts.input); |
|
|
|
|
|
|
|
|
|
for(let page of pages) { |
|
|
|
|
for(let i = 0; i < pages.length; i++) { |
|
|
|
|
const page = pages[i]; |
|
|
|
|
|
|
|
|
|
console.log("PAGE", page); |
|
|
|
|
write_page(doc, opts.template, page); |
|
|
|
|
|
|
|
|
|
// don't add a page when at the end
|
|
|
|
|
if(i !== pages.length - 1) { |
|
|
|
|
next_page(doc); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
write_page(doc, opts.template, { |
|
|
|
|
"title": pages[0].title, |
|
|
|
|
"summary": pages[0].summary, |
|
|
|
|
"slide_title": "The End", |
|
|
|
|
"slide_body": "See you soon.", |
|
|
|
|
"type": "title-text" |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
end_pdf(doc); |
|
|
|
|
} catch(error) { |
|
|
|
|