mirror of
https://github.com/r-ca/md2pdf-meow.git
synced 2025-12-03 12:40:47 +00:00
chore: log meta info lines
This commit is contained in:
parent
8a65b03780
commit
6706af5f8e
@ -33,6 +33,7 @@ TypeScript ベースの Markdown → HTML → PDF 変換パイプラインです
|
||||
copyright: rca
|
||||
```
|
||||
- `frontCover` / `backCover` の各値は任意で、未指定時には `title` や `published` などの共通値が利用されます。
|
||||
- `description` は `<meta name="description">` と表紙/奥付の本文に表示されます。長すぎる場合は YAML 側で適宜整形してください。
|
||||
|
||||
## 移植元
|
||||
- https://github.com/2SC1815J/md2pdf
|
||||
|
||||
@ -1,13 +1,5 @@
|
||||
title: Template
|
||||
author: ろむねこ
|
||||
published: 0000/000/00
|
||||
description: ""
|
||||
copyright: template
|
||||
frontCover:
|
||||
title: Template
|
||||
author: ろむねこ
|
||||
published: 0000/000/00
|
||||
backCover:
|
||||
title: Template
|
||||
pubDate: 0000/000/00
|
||||
copyright: template
|
||||
title: 寿がきやモバイルオーダーシステム 設計書
|
||||
author: さkすあsかづさdkす
|
||||
published: 2025/12/01
|
||||
description: DESCRIPTIONあるよ〜
|
||||
copyright: COPYRIGHT
|
||||
|
||||
@ -100,9 +100,23 @@ export async function loadMeta(): Promise<DocumentMeta> {
|
||||
const fullPath = path.join(DOCUMENTS_DIR, filename);
|
||||
if (await pathExists(fullPath)) {
|
||||
logger.info(`メタ情報ファイル ${filename} を読み込みます`);
|
||||
return loadYamlMeta(fullPath);
|
||||
const meta = await loadYamlMeta(fullPath);
|
||||
logMetaInfo(meta, filename);
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
logger.info('メタ情報ファイルが見つからなかったため、テンプレートのデフォルト値を使用します');
|
||||
logMetaInfo(DEFAULT_META, 'default');
|
||||
return DEFAULT_META;
|
||||
}
|
||||
|
||||
function logMetaInfo(meta: DocumentMeta, source: string) {
|
||||
logger.info(`\tsource: ${source}`);
|
||||
logger.info(`\ttitle: ${meta.title}`);
|
||||
logger.info(`\tauthor: ${meta.author}`);
|
||||
logger.info(`\tpublished: ${meta.published}`);
|
||||
if (meta.description) {
|
||||
logger.info(`\tdescription: ${meta.description}`);
|
||||
}
|
||||
logger.info(`\tcopyright: ${meta.copyright}`);
|
||||
}
|
||||
|
||||
@ -16,6 +16,9 @@
|
||||
<h1><%= (meta.frontCover && meta.frontCover.title) || meta.title %></h1>
|
||||
<div class="Published"><%= (meta.frontCover && (meta.frontCover.published || meta.frontCover.pubDate)) || meta.published %></div>
|
||||
<div class="Author"><%= (meta.frontCover && meta.frontCover.author) || meta.author %></div>
|
||||
<% if (meta.description && meta.description.length > 0) { %>
|
||||
<p class="Description"><%= meta.description %></p>
|
||||
<% } %>
|
||||
</div>
|
||||
<article class="markdown-body">
|
||||
<%- include('../work/all_md.html') %>
|
||||
@ -25,6 +28,10 @@
|
||||
<span class="Title"><%= (meta.backCover && meta.backCover.title) || meta.title %></span><br>
|
||||
<span class="PubDate"><%= (meta.backCover && (meta.backCover.pubDate || meta.backCover.published)) || meta.published %></span><br>
|
||||
<span class="Copyright"><%= (meta.backCover && meta.backCover.copyright) || meta.copyright %></span>
|
||||
<% if (meta.description && meta.description.length > 0) { %>
|
||||
<br>
|
||||
<span class="Description"><%= meta.description %></span>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user