@riebeckite/plugin-series 0.0.31 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/README_ja.md +11 -7
- package/dist/components/series-navigation.js +10 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +12 -4
- package/dist/src/series.d.ts +0 -2
- package/dist/src/types.d.ts +2 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -8,6 +8,10 @@ order, with the current part marked and previous/next links.
|
|
|
8
8
|
|
|
9
9
|
[日本語](./README_ja.md)
|
|
10
10
|
|
|
11
|
+
## Live example
|
|
12
|
+
|
|
13
|
+
The [Plugins in depth](/series/plugins-in-depth-en) series page lists its articles in order and shows previous/next navigation on each one.
|
|
14
|
+
|
|
11
15
|
## Overview
|
|
12
16
|
|
|
13
17
|
`series()` reads series metadata from frontmatter, groups every matching
|
|
@@ -91,7 +95,7 @@ to percent-encoding. Set `basePath` to match a custom routing scheme, or pass
|
|
|
91
95
|
|
|
92
96
|
## Exports
|
|
93
97
|
|
|
94
|
-
- `series(options?)` / `
|
|
98
|
+
- `series(options?)` / `series(options?)` — plugin factory
|
|
95
99
|
- `buildSeriesIndex(manifest, name, options?)` — ordered members for one series
|
|
96
100
|
(`SeriesIndex | null`); useful for landing pages
|
|
97
101
|
- `renderSeriesIndex(manifest, name, options?)` — standalone `<section>` block
|
package/README_ja.md
CHANGED
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
[English](./README.md)
|
|
8
8
|
|
|
9
|
+
## 実行例
|
|
10
|
+
|
|
11
|
+
[Plugins in depth](/series/plugins-in-depth-en) のシリーズページでは、記事が順番に並び、各記事に前後のナビゲーションが表示されます。
|
|
12
|
+
|
|
9
13
|
## 概要
|
|
10
14
|
|
|
11
15
|
`series()` は frontmatter からシリーズ情報を読み取り、該当するノートをグループ化して並べ替えたうえで、各ノートの HTML に `<nav class="rb-series">` ブロックを追加します。リンクには Core が解決したパーマリンクを使うため、`permalink` プラグインなどとも併用できます。1 件だけのシリーズにはナビゲーションを出力しません。
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
またページ種別を登録し、一覧ページを `/series`、シリーズごとのランディングページを `/series/<name>` に生成します。どちらも公開対象(discoverable)のマニフェストから組み立てるため、非公開・下書き・予約投稿のノートは現れません。
|
|
14
18
|
|
|
15
19
|
このプラグインはビルド時のみ動作し、クライアント用のランタイムは持ちません(スタイルシートのみを登録します)。
|
|
16
20
|
|
|
@@ -56,17 +60,17 @@ series_order: 2
|
|
|
56
60
|
| `positionLabel` | `boolean` | `false` | 現在の記事に「Part N of M」を付ける。 |
|
|
57
61
|
| `basePath` | `string` | `"/series"` | 生成するページの基準パス。空文字にすると生成しない。 |
|
|
58
62
|
|
|
59
|
-
##
|
|
63
|
+
## 記事に差し込まれるシリーズナビゲーション
|
|
60
64
|
|
|
61
65
|
2 件以上あるシリーズの各ノートには、記事の下にシリーズナビゲーションが実際に描画されます。リンクと現在位置は、上の frontmatter から計算します。
|
|
62
66
|
|
|
63
|
-
テキストと属性はすべてエスケープします。生成した HTML
|
|
67
|
+
テキストと属性はすべてエスケープします。生成した HTML はマニフェストのエントリと処理済みコンテンツの両方へ書き戻すため、ページのルート表示・フィード・検索でも同じマークアップになります。
|
|
64
68
|
|
|
65
|
-
##
|
|
69
|
+
## ページ種別
|
|
66
70
|
|
|
67
|
-
プラグインは 2
|
|
71
|
+
プラグインは 2 つのページ種別を登録します。どちらも `manifest.discoverableEntries` から組み立てるため、非公開のノートは含まれません。
|
|
68
72
|
|
|
69
|
-
|
|
|
73
|
+
| ページ種別 | パス | 出力 |
|
|
70
74
|
| --------- | ---- | ---- |
|
|
71
75
|
| `series-list` | `<basePath>`(`/series`) | 各シリーズをランディングページへのリンク付きで並べた `<section class="rb-series rb-series--list">`。シリーズが 1 つ以上あるときだけ生成。 |
|
|
72
76
|
| `series-index` | `<basePath>/<name>`(`/series/<name>`) | 1 つのシリーズの `renderSeriesIndex()` セクション。既存の並び順をそのまま使う。 |
|
|
@@ -75,7 +79,7 @@ series_order: 2
|
|
|
75
79
|
|
|
76
80
|
## 公開 API
|
|
77
81
|
|
|
78
|
-
- `series(options?)` / `
|
|
82
|
+
- `series(options?)` / `series(options?)`:プラグインファクトリ
|
|
79
83
|
- `buildSeriesIndex(manifest, name, options?)`:1 つのシリーズの並び順付きメンバー(`SeriesIndex | null`)。ランディングページ向け
|
|
80
84
|
- `renderSeriesIndex(manifest, name, options?)`:シリーズ全体の `<section>` ブロック
|
|
81
85
|
- `renderSeriesList(manifest, options?, label?)`:全シリーズを並べた `<section>` ブロック。無ければ `""`
|
|
@@ -38,7 +38,16 @@ function collectSeriesIndexes(manifest, options = {}) {
|
|
|
38
38
|
const indexes = [];
|
|
39
39
|
for (const [name, entries] of groups) {
|
|
40
40
|
const members = [...entries].sort((a, b) => compareEntries(a, b, resolved)).map((entry) => toMember(manifest, entry, resolved, name));
|
|
41
|
-
|
|
41
|
+
const languages = new Set(
|
|
42
|
+
entries.map((entry) => entry.publicLocation.language).filter((language2) => Boolean(language2))
|
|
43
|
+
);
|
|
44
|
+
const language = languages.size === 1 ? [...languages][0] : void 0;
|
|
45
|
+
indexes.push({
|
|
46
|
+
name,
|
|
47
|
+
title: titles.get(name) ?? name,
|
|
48
|
+
members,
|
|
49
|
+
...language ? { language } : {}
|
|
50
|
+
});
|
|
42
51
|
}
|
|
43
52
|
return indexes;
|
|
44
53
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export type { ResolvedSeriesOptions, SeriesIndex, SeriesMember, SeriesOptions, }
|
|
|
14
14
|
* fall back to `date`, then `title`, then `slug` for deterministic results.
|
|
15
15
|
*/
|
|
16
16
|
export declare function series(options?: SeriesOptions): import("@riebeckite/core").RiebeckitePlugin<SeriesOptions>;
|
|
17
|
-
export declare const seriesPlugin: typeof series;
|
|
18
17
|
/** Convenience re-export so tooling can resolve options without the factory. */
|
|
19
18
|
export { resolveSeriesOptions };
|
|
20
19
|
/** The default class name used by the plugin stylesheet. */
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,16 @@ function collectSeriesIndexes(manifest, options = {}) {
|
|
|
40
40
|
const indexes = [];
|
|
41
41
|
for (const [name, entries] of groups) {
|
|
42
42
|
const members = [...entries].sort((a, b) => compareEntries(a, b, resolved)).map((entry) => toMember(manifest, entry, resolved, name));
|
|
43
|
-
|
|
43
|
+
const languages = new Set(
|
|
44
|
+
entries.map((entry) => entry.publicLocation.language).filter((language2) => Boolean(language2))
|
|
45
|
+
);
|
|
46
|
+
const language = languages.size === 1 ? [...languages][0] : void 0;
|
|
47
|
+
indexes.push({
|
|
48
|
+
name,
|
|
49
|
+
title: titles.get(name) ?? name,
|
|
50
|
+
members,
|
|
51
|
+
...language ? { language } : {}
|
|
52
|
+
});
|
|
44
53
|
}
|
|
45
54
|
return indexes;
|
|
46
55
|
}
|
|
@@ -441,7 +450,8 @@ function series(options = {}) {
|
|
|
441
450
|
type: "series-index",
|
|
442
451
|
pathname,
|
|
443
452
|
title: index.title,
|
|
444
|
-
body
|
|
453
|
+
body,
|
|
454
|
+
...index.language ? { language: index.language } : {}
|
|
445
455
|
};
|
|
446
456
|
}
|
|
447
457
|
}
|
|
@@ -449,7 +459,6 @@ function series(options = {}) {
|
|
|
449
459
|
assets: [createStyleAsset("series", "@riebeckite/plugin-series/style.css")]
|
|
450
460
|
});
|
|
451
461
|
}
|
|
452
|
-
var seriesPlugin = series;
|
|
453
462
|
function validateSeriesOptions(options) {
|
|
454
463
|
if (!options) return [];
|
|
455
464
|
const issues = [];
|
|
@@ -486,6 +495,5 @@ export {
|
|
|
486
495
|
resolveSeriesOptions,
|
|
487
496
|
series,
|
|
488
497
|
seriesLandingPath,
|
|
489
|
-
seriesPlugin,
|
|
490
498
|
seriesSlug
|
|
491
499
|
};
|
package/dist/src/series.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { type ContentManifest, type Diagnostic, type PluginDataHelper, type PublicContentEntry, type PublicContentView } from "@riebeckite/core";
|
|
2
2
|
import type { ResolvedSeriesOptions, SeriesIndex, SeriesOptions } from "./types.js";
|
|
3
|
-
/** Base class applied when `options.className` is not set. */
|
|
4
|
-
export declare const DEFAULT_SERIES_CLASS_NAME = "rb-series";
|
|
5
3
|
export declare const DEFAULT_SERIES_BASE_PATH = "/series";
|
|
6
4
|
/** Applies defaults to the user-supplied options. */
|
|
7
5
|
export declare function resolveSeriesOptions(options?: SeriesOptions): ResolvedSeriesOptions;
|
package/dist/src/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-series",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"./style.css": "./style.css"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"
|
|
25
|
-
"@riebeckite/
|
|
26
|
-
"
|
|
24
|
+
"@riebeckite/core": "0.0.33",
|
|
25
|
+
"@riebeckite/ui": "0.0.33",
|
|
26
|
+
"hono": "^4.12.25"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"@riebeckite/test": "0.0.33",
|
|
30
|
+
"tsx": "^4.22.4"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|