释出修订版
This commit is contained in:
1 parent
6ec5e1404f
commit
42ae1cc108
5 files changed
+29
-15
No files matched your search
@@ -47,7 +47,7 @@
|
|||||||
font-display: swap;
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .zcool-qingke-huangyou-regular {
|
.zcool-qingke-huangyou-regular {
|
||||||
font-family: "ZCOOL QingKe HuangYou", sans-serif;
|
font-family: "ZCOOL QingKe HuangYou", sans-serif;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
@@ -92,5 +92,5 @@
|
|||||||
font-family: "FangZhengFangSong", regular;
|
font-family: "FangZhengFangSong", regular;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
} */
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
font-display: swap;
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .zcool-qingke-huangyou-regular {
|
.zcool-qingke-huangyou-regular {
|
||||||
font-family: "ZCOOL QingKe HuangYou", sans-serif;
|
font-family: "ZCOOL QingKe HuangYou", sans-serif;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
@@ -92,5 +92,5 @@
|
|||||||
font-family: "FangZhengFangSong", regular;
|
font-family: "FangZhengFangSong", regular;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
} */
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -3,9 +3,8 @@ import { OpenPGPSigner } from "../pdf_builder/utils.ts";
|
|||||||
import { DocuBuilder } from "../pdf_builder/docu_builder.ts";
|
import { DocuBuilder } from "../pdf_builder/docu_builder.ts";
|
||||||
import { IndexBuilder } from "../pdf_builder/index_builder.ts";
|
import { IndexBuilder } from "../pdf_builder/index_builder.ts";
|
||||||
//import TurndownService from "turndown";
|
//import TurndownService from "turndown";
|
||||||
|
import { cfg } from "../main.ts";
|
||||||
export async function generate_pdf() {
|
export async function generate_pdf() {
|
||||||
const cfg = JSON.parse(await Deno.readTextFile("config.json"));
|
|
||||||
for (const config of cfg.settings) {
|
for (const config of cfg.settings) {
|
||||||
const builder = new DocuBuilder(config);
|
const builder = new DocuBuilder(config);
|
||||||
|
|
||||||
@@ -22,7 +21,6 @@ export async function generate_pdf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function generate_md() {
|
export async function generate_md() {
|
||||||
const cfg = JSON.parse(await Deno.readTextFile("config.json"));
|
|
||||||
try {
|
try {
|
||||||
for (const config of cfg.settings) {
|
for (const config of cfg.settings) {
|
||||||
const builder = new DocuBuilder(config);
|
const builder = new DocuBuilder(config);
|
||||||
@@ -42,8 +40,6 @@ export async function generate_md() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function generate_txt() {
|
export async function generate_txt() {
|
||||||
const cfg = JSON.parse(await Deno.readTextFile("config.json"));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (const config of cfg.settings) {
|
for (const config of cfg.settings) {
|
||||||
const builder = new DocuBuilder(config);
|
const builder = new DocuBuilder(config);
|
||||||
@@ -65,7 +61,7 @@ export async function generate_txt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function add_index_to_pdf(insert_index_after_page: number = 1) {
|
export async function add_index_to_pdf(insert_index_after_page: number = 1) {
|
||||||
const config = JSON.parse(await Deno.readTextFile("config.json"));
|
const config = cfg;
|
||||||
for (const cfg of config.settings) {
|
for (const cfg of config.settings) {
|
||||||
console.log(`Adding index to PDF ${cfg.playwright.path}...`);
|
console.log(`Adding index to PDF ${cfg.playwright.path}...`);
|
||||||
|
|
||||||
@@ -104,7 +100,7 @@ export async function add_index_to_pdf(insert_index_after_page: number = 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function use_qpdf() {
|
export async function use_qpdf() {
|
||||||
const config = JSON.parse(await Deno.readTextFile("config.json"));
|
const config = cfg;
|
||||||
for (const cfg of config.settings) {
|
for (const cfg of config.settings) {
|
||||||
if (cfg.pdf.use_qpdf?.enabled) {
|
if (cfg.pdf.use_qpdf?.enabled) {
|
||||||
console.log(`Using qpdf to linearize PDF ${cfg.playwright.path}...`);
|
console.log(`Using qpdf to linearize PDF ${cfg.playwright.path}...`);
|
||||||
@@ -148,7 +144,7 @@ export async function use_qpdf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function sign_pdf(passphrase?: string) {
|
export async function sign_pdf(passphrase?: string) {
|
||||||
const config = JSON.parse(await Deno.readTextFile("config.json"));
|
const config = cfg;
|
||||||
for (const cfg of config.settings) {
|
for (const cfg of config.settings) {
|
||||||
if (cfg.pdf.signing?.enabled) {
|
if (cfg.pdf.signing?.enabled) {
|
||||||
console.log(`Signing PDF ${cfg.playwright.path}...`);
|
console.log(`Signing PDF ${cfg.playwright.path}...`);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"signing": {
|
"signing": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"key_path": "./private_key.asc",
|
"key_path": "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc",
|
||||||
"output_path": "./outputs/工农解放报RSF续刊第一期-适合手机阅读.pdf.sig"
|
"output_path": "./outputs/工农解放报RSF续刊第一期-适合手机阅读.pdf.sig"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
},
|
},
|
||||||
"signing": {
|
"signing": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"key_path": "./private_key.asc",
|
"key_path": "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc",
|
||||||
"output_path": "./outputs/工农解放报RSF续刊第一期-适合电脑阅读.pdf.sig"
|
"output_path": "./outputs/工农解放报RSF续刊第一期-适合电脑阅读.pdf.sig"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
},
|
},
|
||||||
"signing": {
|
"signing": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"key_path": "./private_key.asc",
|
"key_path": "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc",
|
||||||
"output_path": "./outputs/工农解放报RSF续刊第一期-适合纸质打印.pdf.sig"
|
"output_path": "./outputs/工农解放报RSF续刊第一期-适合纸质打印.pdf.sig"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,24 @@ export const cfg = await Deno.readTextFile("./config.json").then((text) =>
|
|||||||
JSON.parse(text)
|
JSON.parse(text)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const homeDir = Deno.env.get("HOME") || Deno.env.get("USERPROFILE");
|
||||||
|
for (const config of cfg.settings) {
|
||||||
|
if (config.journal.from_directory.startsWith("~/")) {
|
||||||
|
config.journal.from_directory = config.journal.from_directory.replace(
|
||||||
|
"~",
|
||||||
|
homeDir || "",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (config.pdf.signing.enabled) {
|
||||||
|
if (config.pdf.signing.key_path.startsWith("~/")) {
|
||||||
|
config.pdf.signing.key_path = config.pdf.signing.key_path.replace(
|
||||||
|
"~",
|
||||||
|
homeDir || "",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (import.meta.main) {
|
if (import.meta.main) {
|
||||||
await match_sub_command_to_function(
|
await match_sub_command_to_function(
|
||||||
args._ as Array<string>,
|
args._ as Array<string>,
|
||||||
|
|||||||
Reference in new issue
Block a user