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