Skip to content

Commit f768ffa

Browse files
committed
feat: update and clean
1 parent cd27512 commit f768ffa

File tree

7 files changed

+332
-334
lines changed

7 files changed

+332
-334
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
run:
2+
./bin/asciidoctorjs-pdf terraform-cheat-sheet.adoc --template-require ../examples/cheat-sheet/template/template.js

examples/cheat-sheet/template/template.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,31 @@ const getAuthors = function (node) {
66
const author = node.getAttribute(`author_${index}`)
77
const email = node.getAttribute(`email_${index}`)
88
const bio = node.getAttribute(`authorbio_${index}`)
9+
const img = node.getAttribute(`authorimg_${index}`)
910
let twitter;
1011
if (email && email.startsWith("https://twitter.com/")) {
1112
twitter = email.replace("https://twitter.com/", "");
1213
}
13-
result.push({ name: author, email: email, bio: bio, twitter: twitter })
14+
result.push({ name: author, email: email, bio: bio, img: img, twitter: twitter })
1415
}
1516
} else {
1617
const author = node.getAttribute('author')
1718
const email = node.getAttribute('email')
1819
const bio = node.getAttribute(`authorbio`)
20+
const img = node.getAttribute(`authorimg`)
1921
let twitter;
2022
if (email && email.startsWith("https://twitter.com/")) {
2123
twitter = email.replace("https://twitter.com/", "");
2224
}
23-
result.push({ name: author, email: email, bio: bio, twitter: twitter })
25+
result.push({ name: author, email: email, bio: bio, img: img, twitter: twitter })
2426
}
2527
return result;
2628
}
2729

2830
const renderAuthors = function (authors) {
2931
return authors.map(author => {
3032
return `<div class="author">
31-
<div class="author-avatar"><img src="https://pbs.twimg.com/profile_images/726148230224949249/g2T2qehD_400x400.jpg"/></div>
33+
<div class="author-avatar"><img src="${author.img}"/></div>
3234
<div class="author-name"><a href="${author.email}">@${author.twitter}</a></div>
3335
<div class="author-bio">${author.bio}</div>
3436
</div>
@@ -43,7 +45,7 @@ module.exports = [{
4345
<html lang="en">
4446
<head>
4547
<meta charset="UTF-8">
46-
<link href="./template/assets/style.css" rel="stylesheet">
48+
<link href="./examples/cheat-sheet/template/assets/style.css" rel="stylesheet">
4749
</head>
4850
<body>
4951
<header>

0 commit comments

Comments
 (0)