sg-text-forge 0.3.2__tar.gz → 0.3.4__tar.gz
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.
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/PKG-INFO +1 -1
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/pyproject.toml +1 -1
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/wtd_books.py +199 -41
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/wtd_books_build.py +18 -11
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/uv.lock +1 -1
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/.github/copilot-instructions.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/.github/skills/check-i18n/SKILL.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/.github/skills/check-i18n/references/example_translations.json +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/.github/skills/check-i18n/references/test_cases.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/.github/skills/check-i18n/scripts/check_i18n.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/.github/workflows/publish-pypi.yml +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/.gitignore +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/AGENTS.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/LICENSE +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/Makefile +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/README.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/action.yml +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/docs/hindsight-memory/SKILL.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/docs/hindsight-memory.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/epub/book_meta.yml +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/epub/epub.css +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/hooks/nobr_emoticons.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/assets/js/editor.js +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/assets/js/translations.json +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/assets/stylesheets/editor.css +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/assets/stylesheets/text-forge.css +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/main.html +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/partials/comments.html +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/partials/downloads.html +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/partials/editor.html +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/partials/header.html +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/partials/source-file.html +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/hindsight-ingest.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/hindsight-wipe-documents-by-tag.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/hindsight-wtd-ingest-wrapper.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/hindsight_common.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/mkdocs-combine.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/mkdocs_common.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/process-epub-meta.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/pymdown-pandoc.lua +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/wtd-inventory.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/scripts/wtd_sections_common.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/__init__.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/anchor_ids.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/build.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/cli.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/livelib.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/__init__.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/hotkeys.json +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/plugins/text-forge/main.js +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/plugins/text-forge/manifest.json +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/scripts/insert_block.js +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/scripts/insert_image.js +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/scripts/insert_link.js +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/templater.json +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/templates/insert_block.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/templates/insert_image.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/templates/insert_link.md +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/plugin.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/wtd_books_p3.py +0 -0
- {sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/wtd_links.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sg-text-forge
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: MkDocs plugin and build pipeline for Markdown text projects with EPUB generation
|
|
5
5
|
Project-URL: Homepage, https://github.com/shared-goals/text-forge
|
|
6
6
|
Project-URL: Repository, https://github.com/shared-goals/text-forge
|
|
@@ -11,6 +11,8 @@ import json
|
|
|
11
11
|
import pathlib
|
|
12
12
|
import re
|
|
13
13
|
|
|
14
|
+
import yaml
|
|
15
|
+
|
|
14
16
|
from .livelib import LivelibClient
|
|
15
17
|
|
|
16
18
|
TRANSLIT = {
|
|
@@ -100,47 +102,202 @@ def _edition_id(url: str) -> str:
|
|
|
100
102
|
return m.group(1) if m else ""
|
|
101
103
|
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
#: the curation keys an entry may carry, and how each value reads
|
|
106
|
+
CURATION_INT_KEYS = ("weight",)
|
|
107
|
+
CURATION_TEXT_KEYS = ("author", "status")
|
|
108
|
+
CURATION_ID_LIST_KEYS = ("merges",)
|
|
109
|
+
CURATION_KEYS = CURATION_INT_KEYS + CURATION_TEXT_KEYS + CURATION_ID_LIST_KEYS
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class CurationError(ValueError):
|
|
113
|
+
"""A curation file the build refuses to guess at.
|
|
114
|
+
|
|
115
|
+
Every message names the edition id it tripped on, or the key inside that
|
|
116
|
+
entry: a silently dropped entry would still build a plausible-looking
|
|
117
|
+
corpus, and that is the failure this format is not allowed to have.
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _curation_error(entry_id: str, why: str, field: str = "") -> CurationError:
|
|
122
|
+
"""A rejection naming the edition it concerns, and the field or key inside
|
|
123
|
+
it when one is known.
|
|
124
|
+
|
|
125
|
+
A YAML payload carries no line of its own once constructed, and the only
|
|
126
|
+
line the loader can offer — the START of the document — would point every
|
|
127
|
+
error at line 1 and mislead more than help. The edition id and the offending
|
|
128
|
+
key are the addressable facts, and those are what the message carries.
|
|
129
|
+
"""
|
|
130
|
+
who = f" (entry {entry_id})" if entry_id else ""
|
|
131
|
+
what = f" {field!r}" if field else ""
|
|
132
|
+
return CurationError(
|
|
133
|
+
f"curation:{who}: {why}{what}\n"
|
|
134
|
+
"A curation file is books_curation.yml: a map of quoted edition ids to "
|
|
135
|
+
"fields, keys: " + ", ".join(CURATION_KEYS) + "."
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class _CurationLoader(yaml.SafeLoader):
|
|
140
|
+
"""SafeLoader with one hook, on mapping construction.
|
|
105
141
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
142
|
+
The hook refuses a repeated key: stock YAML lets the last one win, so a
|
|
143
|
+
second entry for one edition id would erase the first, or a second `weight`
|
|
144
|
+
erase the first, with nothing said. This is the standard no-duplicates
|
|
145
|
+
recipe, done on the node's own key text (`key_node.value` is the raw text of
|
|
146
|
+
a plain or quoted scalar, so it needs no construction and cannot re-enter the
|
|
147
|
+
hook — which is why the check reads nodes rather than the built dict, whose
|
|
148
|
+
duplicate key is already gone by the time the hook returns).
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
def construct_mapping(self, node, deep=False):
|
|
152
|
+
mapping = super().construct_mapping(node, deep=deep)
|
|
153
|
+
seen: set = set()
|
|
154
|
+
for key_node, _ in node.value:
|
|
155
|
+
if not isinstance(key_node, yaml.ScalarNode):
|
|
156
|
+
continue # a map/list key is no id; validation
|
|
157
|
+
key = str(key_node.value) # rejects it anyway
|
|
158
|
+
if key in seen:
|
|
159
|
+
raise CurationError(
|
|
160
|
+
f"curation: line {key_node.start_mark.line + 1}: duplicate key "
|
|
161
|
+
f"{key!r} in one mapping — one key gets one value, merge them; "
|
|
162
|
+
f"keys of a curation entry: {', '.join(CURATION_KEYS)}")
|
|
163
|
+
seen.add(key)
|
|
164
|
+
return mapping
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _curation_entry_id(key) -> str:
|
|
168
|
+
"""The mapping key as an edition id: quoted or bare both read the same, and
|
|
169
|
+
anything that is not digits is a hard error."""
|
|
170
|
+
entry_id = str(key)
|
|
171
|
+
if not entry_id.isdigit():
|
|
172
|
+
raise CurationError(
|
|
173
|
+
f"curation: entry id must be digits, got {entry_id!r}\n"
|
|
174
|
+
"Keys of books_curation.yml are quoted livelib edition ids."
|
|
175
|
+
)
|
|
176
|
+
return entry_id
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def _curation_int(entry_id: str, key: str, value) -> int:
|
|
180
|
+
# bool is an int subclass, so `weight: true` passes a bare int check and
|
|
181
|
+
# would land in the frontmatter as a weight of 1
|
|
182
|
+
if isinstance(value, bool) or not isinstance(value, int):
|
|
183
|
+
raise _curation_error(entry_id, f"{key} must be a whole number, got", key)
|
|
184
|
+
if value < 0:
|
|
185
|
+
raise _curation_error(entry_id, f"{key} must not be negative, got", key)
|
|
186
|
+
return value
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def _curation_ids(entry_id: str, key: str, value) -> list[int]:
|
|
190
|
+
if not isinstance(value, list):
|
|
191
|
+
raise _curation_error(
|
|
192
|
+
entry_id, f"{key} must be a list of edition ids, got", key)
|
|
193
|
+
ids = []
|
|
194
|
+
for member in value:
|
|
195
|
+
# a quoted id arrives as str, a bare one as int; both are ids
|
|
196
|
+
if isinstance(member, bool) or not isinstance(member, (int, str)):
|
|
197
|
+
raise _curation_error(
|
|
198
|
+
entry_id, f"{key} must hold edition ids, got", key)
|
|
199
|
+
part = str(member).strip()
|
|
200
|
+
if not part.isdigit():
|
|
201
|
+
raise _curation_error(
|
|
202
|
+
entry_id, f"{key} must hold edition ids, got", key)
|
|
203
|
+
ids.append(int(part))
|
|
204
|
+
if not ids:
|
|
205
|
+
raise _curation_error(entry_id, f"{key} names no id", key)
|
|
206
|
+
return ids
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def load_curation(path) -> dict:
|
|
210
|
+
"""Parse books_curation.yml: one map entry per livelib edition.
|
|
211
|
+
|
|
212
|
+
The file is a flat map with no top-level wrapper, `"<edition id>":` with the
|
|
213
|
+
title as a `#` comment beside the key and the entry's fields indented under
|
|
214
|
+
it::
|
|
215
|
+
|
|
216
|
+
"1003047920": # Моменты счастья — Алекс Дубас
|
|
217
|
+
weight: 10
|
|
218
|
+
|
|
219
|
+
The key's digits ARE the entry key; the comment is for the eye only, the
|
|
220
|
+
same property the jsonc `//` comments had. Keys arrive str (quoted) or int
|
|
221
|
+
(bare) and are str()d, so both spellings are one id. The map is returned
|
|
222
|
+
WRAPPED the way build_books has always consumed it:
|
|
223
|
+
{"books": {id: {weight: int, merges: [int], ...}}}.
|
|
224
|
+
|
|
225
|
+
Malformed input raises CurationError naming the entry id. A payload that is
|
|
226
|
+
not a mapping at all — None (which is what the old markdown-sections file
|
|
227
|
+
reads as, every line a comment), a string (which is what a JSONC file reads
|
|
228
|
+
as), or a list — raises too and names books_curation.yml as the expected
|
|
229
|
+
format: the previous formats are gone, and neither may be read by accident
|
|
230
|
+
into a silently uncurated build.
|
|
110
231
|
"""
|
|
111
232
|
text = pathlib.Path(path).read_text(encoding="utf-8")
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
233
|
+
# SafeLoader takes the text directly (it accepts a str as well as a stream);
|
|
234
|
+
# the subclass adds the duplicate-key refusal
|
|
235
|
+
payload = _CurationLoader(text).get_single_data()
|
|
236
|
+
|
|
237
|
+
# tombstone for the two dead formats. The markdown file is ALL COMMENTS to
|
|
238
|
+
# YAML (None) and the jsonc file is one scalar string: both would otherwise
|
|
239
|
+
# read as zero entries or garbage, dropping every curation decision while
|
|
240
|
+
# still building a plausible corpus.
|
|
241
|
+
if payload is None:
|
|
242
|
+
# a corpus may curate nothing at all, and that is written as a file with
|
|
243
|
+
# nothing in it (or only comments). A file that DOES hold lines and still
|
|
244
|
+
# yields no entries is the dead markdown format, every line of which YAML
|
|
245
|
+
# reads as a comment — so the two are told apart by content
|
|
246
|
+
if text.strip():
|
|
247
|
+
raise CurationError(
|
|
248
|
+
f"curation: {path} holds no entries — it looks like the old markdown "
|
|
249
|
+
"sections format (Curation.md), which is gone\n"
|
|
250
|
+
"Expected books_curation.yml: a map of quoted edition ids to fields."
|
|
251
|
+
)
|
|
252
|
+
return {"books": {}}
|
|
253
|
+
if not isinstance(payload, dict):
|
|
254
|
+
raise CurationError(
|
|
255
|
+
f"curation: {path} holds no entries — it is a "
|
|
256
|
+
f"{type(payload).__name__}, not a map of edition ids\n"
|
|
257
|
+
"Expected books_curation.yml: a map of quoted edition ids to fields."
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
entries: dict = {}
|
|
261
|
+
for key, fields in payload.items():
|
|
262
|
+
if str(key) == "books":
|
|
263
|
+
# the shape the old curation.jsonc had — `{"books": {...}}` — parses
|
|
264
|
+
# as valid YAML (braces are flow syntax), so it has to be refused by
|
|
265
|
+
# name rather than left to the digit check below
|
|
266
|
+
raise CurationError(
|
|
267
|
+
"curation: `books` is not an edition id — this is the old JSONC "
|
|
268
|
+
"format (curation.jsonc), whose entries sat under a `books` key\n"
|
|
269
|
+
"Expected books_curation.yml: a flat map of quoted edition ids."
|
|
270
|
+
)
|
|
271
|
+
entry_id = _curation_entry_id(key)
|
|
272
|
+
if entry_id in entries:
|
|
273
|
+
# unreachable in practice: the loader refuses a repeated key before
|
|
274
|
+
# a dict can hold one. Kept as the guard the format's contract asks
|
|
275
|
+
# for, so no future loader change silently drops an entry
|
|
276
|
+
raise _curation_error(entry_id, "duplicate entry for this edition id")
|
|
277
|
+
if fields is None:
|
|
278
|
+
# an id with nothing under it: a curated entry carrying no fields,
|
|
279
|
+
# which is legitimate — the id itself says it is curated
|
|
280
|
+
entries[entry_id] = {}
|
|
131
281
|
continue
|
|
132
|
-
if
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
282
|
+
if not isinstance(fields, dict):
|
|
283
|
+
raise _curation_error(entry_id, "entry must be a map of fields, got")
|
|
284
|
+
entry: dict = {}
|
|
285
|
+
for field, value in fields.items():
|
|
286
|
+
field = str(field)
|
|
287
|
+
if field not in CURATION_KEYS:
|
|
288
|
+
raise _curation_error(entry_id, "unknown key", field)
|
|
289
|
+
if field in CURATION_INT_KEYS:
|
|
290
|
+
entry[field] = _curation_int(entry_id, field, value)
|
|
291
|
+
elif field in CURATION_ID_LIST_KEYS:
|
|
292
|
+
entry[field] = _curation_ids(entry_id, field, value)
|
|
293
|
+
else:
|
|
294
|
+
if not isinstance(value, str) or not value.strip():
|
|
295
|
+
raise _curation_error(
|
|
296
|
+
entry_id, f"{field} must be non-empty text", field)
|
|
297
|
+
entry[field] = value
|
|
298
|
+
entries[entry_id] = entry
|
|
143
299
|
|
|
300
|
+
return {"books": entries}
|
|
144
301
|
|
|
145
302
|
|
|
146
303
|
def _work_key(title: str, author: str) -> str:
|
|
@@ -845,9 +1002,10 @@ def build_books(books_path, quotes_path, reviews_path, out_dir, *, curation_path
|
|
|
845
1002
|
work_id_by_edition=None, fetch=None) -> dict:
|
|
846
1003
|
"""Build books/<slug>.md notes from LiveLib export JSON files.
|
|
847
1004
|
|
|
848
|
-
curation_path — ONE curation
|
|
849
|
-
edition id
|
|
850
|
-
|
|
1005
|
+
curation_path — the ONE curation file (books_curation.yml by default, or a
|
|
1006
|
+
mapping already built): a flat map keyed by livelib edition id, read back as
|
|
1007
|
+
{"books": {id: ...}}, each entry carrying weight?/status?/author?/merges?.
|
|
1008
|
+
Anything livelib can tell us is not stored.
|
|
851
1009
|
|
|
852
1010
|
Reference books need no section of their own: pass `text_dir` and the build
|
|
853
1011
|
scans the texts for livelib edition ids no note would declare, resolving
|
|
@@ -1159,8 +1317,8 @@ def _note_index(books_dir) -> dict:
|
|
|
1159
1317
|
|
|
1160
1318
|
def _curation_section(path_or_map, section):
|
|
1161
1319
|
"""Read one section from a curation source given as a path to a consolidated
|
|
1162
|
-
.
|
|
1163
|
-
`link_map`)."""
|
|
1320
|
+
file (books_curation.yml, or the json side-car the build writes) or as the
|
|
1321
|
+
mapping itself (the form build_books emits, e.g. its `link_map`)."""
|
|
1164
1322
|
if path_or_map is None:
|
|
1165
1323
|
return None
|
|
1166
1324
|
if isinstance(path_or_map, (dict, list)):
|
|
@@ -7,11 +7,14 @@ Single entry point for the `make books` target (whattodo/Makefile):
|
|
|
7
7
|
Steps:
|
|
8
8
|
1. Export fresh data (shelves incl. statuses, quotes, reviews) into
|
|
9
9
|
<root>/livelib-export/ — anonymous API + SSR, no credentials needed.
|
|
10
|
-
2. build_books() with the ONE curation file
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
2. build_books() with the ONE curation file <root>/books_curation.yml — a flat
|
|
11
|
+
map of livelib edition ids to fields — and the texts themselves passed as
|
|
12
|
+
`text_dir` so a work a chapter cites but no shelf holds still gets its note
|
|
13
|
+
(title/author from the edition card JSON).
|
|
14
14
|
3. Replace <root>/text/books/*.md with the generated set (_curation/ untouched).
|
|
15
|
+
The id -> note map the run produces lands in <root>/.cache/link-map.json: a
|
|
16
|
+
same-run temp artifact, consumed by step 4, so it sits in the gitignored
|
|
17
|
+
cache dir rather than beside the notes it describes.
|
|
15
18
|
4. Validate: frontmatter contract + text links; print the status distribution.
|
|
16
19
|
|
|
17
20
|
Titles/authors of cited-but-unshelved editions come from the LiveLib edition
|
|
@@ -115,14 +118,17 @@ def main(root_str: str, user_id: int = 345497) -> int:
|
|
|
115
118
|
root = Path(root_str).resolve()
|
|
116
119
|
export_dir = root / "livelib-export"
|
|
117
120
|
books_dir = root / "text" / "books"
|
|
118
|
-
|
|
121
|
+
cache = root / ".cache"
|
|
119
122
|
|
|
120
123
|
counts = export(user_id, export_dir)
|
|
121
124
|
print("export:", counts)
|
|
122
125
|
|
|
123
126
|
tmp = Path(tempfile.mkdtemp(prefix="wtd-books-"))
|
|
124
|
-
#
|
|
125
|
-
|
|
127
|
+
# ONE curation file, at the corpus root: a flat YAML map, one entry per
|
|
128
|
+
# livelib edition id. (It used to sit beside the notes as
|
|
129
|
+
# text/books/_curation/curation.jsonc, then at the root as Curation.md; both
|
|
130
|
+
# are gone, and load_curation refuses either if one is left in place.)
|
|
131
|
+
curation = root / "books_curation.yml"
|
|
126
132
|
if not curation.exists():
|
|
127
133
|
print(f"FAIL: curation file not found: {curation}")
|
|
128
134
|
return 1
|
|
@@ -166,11 +172,12 @@ def main(root_str: str, user_id: int = 345497) -> int:
|
|
|
166
172
|
f"https://www.livelib.ru/book/{bid}"
|
|
167
173
|
)
|
|
168
174
|
|
|
169
|
-
# the mapping the notes declare, written
|
|
170
|
-
# validator
|
|
171
|
-
#
|
|
175
|
+
# the mapping the notes declare, written to the cache dir: the link
|
|
176
|
+
# validator consumes it a few lines below, and keeping it makes a rebuild's
|
|
177
|
+
# id->note decisions auditable. The dir is the build's own to create.
|
|
172
178
|
link_map = report["link_map"]
|
|
173
|
-
(
|
|
179
|
+
cache.mkdir(parents=True, exist_ok=True)
|
|
180
|
+
(cache / "link-map.json").write_text(
|
|
174
181
|
json.dumps(link_map, ensure_ascii=False, indent=1, sort_keys=True) + "\n",
|
|
175
182
|
encoding="utf-8",
|
|
176
183
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/.github/skills/check-i18n/references/test_cases.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/mkdocs/overrides/assets/stylesheets/text-forge.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sg_text_forge-0.3.2 → sg_text_forge-0.3.4}/text_forge/obsidian/plugins/text-forge/manifest.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|