Skip to content

Commit 2beffa7

Browse files
mckeeaactions-userStina-GremmeJakub SlotwinskiStina Gremme
authored
Develop (#25)
* Update LLM cache [skip ci] * Update non-browsable doc map [skip ci] * Conversion of HRL Croplands PUM + media * Update LLM cache [skip ci] * Media url fix in HRL_Croplands doc * Update LLM cache [skip ci] * Added category to yaml header * Update LLM cache [skip ci] * Moved HRL Cropland in its own project folder * Update LLM cache [skip ci] * converted CLC+ Backbone (in respecitve project folder) * Update LLM cache [skip ci] * moved HRL Grasslands to specific project folder + renamed existing project folders to avoid empty space * Update LLM cache [skip ci] * moved the converted documents into their respective project folders * changed date of document from 2025 to 2024 * Update LLM cache [skip ci] * Update non-browsable doc map [skip ci] * moved VLCC ATBD to respective product category (HRL Cropland) * Update LLM cache [skip ci] * specified file name of CLC+BB User Manual 2021 * Update LLM cache [skip ci] * embedded media correctly * Update LLM cache [skip ci] * DOCS dir reorganization * cleanup * Update LLM cache [skip ci] * config update * Config update * corrected media embedding * Update LLM cache [skip ci] * corrected media embedding * Update LLM cache [skip ci] * retrieved lost pictures in Riparian Zones Nomenclature Guideline * test commit * corrected file name Coastal Zones version 1 * Update LLM cache [skip ci] * embedded the media following the new named media path * Update LLM cache [skip ci] * added the major version digit to all document file names that were already converted and on the new technical library * Removed the duplicated contact line * Update LLM cache [skip ci] * Update non-browsable doc map [skip ci] * converted CLC+BB 2023 & fixed title of CLC+BB 2021 * Update LLM cache [skip ci] * Updated category "products" * Update LLM cache [skip ci] * correcting document name "+" to "plus" * Update LLM cache [skip ci] * Cleaned up folder structure + file naming following the newest decision (File name: product_document type_major version) * Update LLM cache [skip ci] * uploaded original PDF files to convert * Update LLM cache [skip ci] * Renamed folder name * converted pdf to qmd for QC * Update LLM cache [skip ci] * updated python script to include catgeory in Yaml header + converted CLCplus BB 2018 Validation report for QC * Quality checked CLCplus BB 2023 ATBD * moved original pdf file in converted folder * Update LLM cache [skip ci] * Cleaned up document names + file names * deleted Grassland PUM, to prepare for conversion of new version * Update LLM cache [skip ci] * Few files renamed * Update LLM cache [skip ci] * New and upgraded logic for version change detection and changelogs generation Various improvements * Update non-browsable doc map [skip ci] * Better naming for PR message/title & squash merge for PR added * converted pdf to qmd for quality check * Worked up until some point * improvement: smart batching for keywords generation improvement: prompts moved to separate files * fix: .gitattributes [skip ci] * Update LLM cache [skip ci] * fix: .gitignore [skip ci] * Test change whatever * changed folder name CORINE_Land_Cover * Fixed the gitignore file (to include Files_to_convert dir) + converted PDF to QMD files for quality check * added: 'restore' functionality added: tests suit updated: editor manual scripts opitmized * added: .version-history dir * fix: increased time for build phase * debug logging for build script * Test * Test * Worked up until line 162 * Added a PNG of a table * Copy-pasted from main * updated: Editor Manual * Worked up until line 466 * First draft done * Added HRL SLF 2021 Validation Report + edits to HRL VLCC ATBD v2 * Second draft done * deleted CLC PUM 2023 for new version * deleted CLC+BB 2021 PUM from "Files to convert" because it already exists in library * changed file names to comply with naming convention * Draft 3, up until line 472 * Third draft, until line 469 * Quality checked CLCplus BB 2023 PUM * Cleaned up after CLCplus BB 2023 PUM QC * Cleaned up after CLCplus BB 2023 QC 2 * HRL SLF 2021 PUM / worked up until line 480 * HRL SLF 2021 PUM / quality checked * HRL SLF 2021 PUM / cleaned up * UA 2021 / imported PUM and ATBD * UA 2021 / converted PUM and ATBD * UA 2021 PUM / first draft * debug: turn off 'quiet' mode for quarto * CLCplus BB 2023 PUM / deleted the "format" section * HRL SLF 2021 PUM / deleted the "format" section + cleaned up * UA 2021 PUM / quality checked * UA 2021 PUM / cleaned up * CLCplus BB 2023, HRL SLF 2021, UA 2021 / changed the titles of the PUMs to match the library blueprint * UA LULC 2021 + 2024 PUM / updated to v1.2 * UA LULC 2021 + 2024 ATBD / did prep work for v1.2 * UA LCLU 2021 + 2024 PUM / updated document history to v1.2 * UA LCLU 2021 ATBD / updated to v1.2 * UA LCLU 2021 ATBD / updated to v1.2 * UA LCLU 2021 ATBD / cleaned up * CLC PUM / converted to QMD * HRL SLF 2021 ATBD + VR / worked, noticed the wrong versions --------- Co-authored-by: GitHub Actions <actions@github.com> Co-authored-by: Stina Gremme <stina.gremme@eea.europa.eu> Co-authored-by: Jakub Slotwinski <slotwinski@discomap.eea.europa.eu> Co-authored-by: Stina Gremme <gremme@discomap.eea.europa.eu>
1 parent 551b28a commit 2beffa7

727 files changed

Lines changed: 23571 additions & 2532 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/build-docs.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fi
4040

4141
# Render all files together (changelog filter uses original-filename from YAML headers)
4242
echo "🔄 Rendering all documents to HTML..."
43-
QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render --to html --no-clean
43+
QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render --to html --no-clean
4444

4545
# Backup the correct sitemap as it may be overwritten by next operations
4646
sleep 5
@@ -57,17 +57,38 @@ node ../.github/scripts/generate_index_all.mjs
5757
echo "📄 Render only index.qmd files using 'index' profile"
5858
mv _quarto.yml _quarto_not_used.yml
5959
mv _quarto-index.yml _quarto.yml
60+
index_count=$(find ./ -type f -name index.qmd | wc -l)
61+
echo " Rendering $index_count index files..."
6062
find ./ -type f -name index.qmd -print0 | while IFS= read -r -d '' src; do
61-
echo "🔧 Rendering $src using profile=index..."
62-
QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render "$src" --profile index --to html --no-clean $QUARTO_FLAGS
63+
QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render "$src" --profile index --to html --no-clean --quiet $QUARTO_FLAGS
6364
done
6465
mv _quarto.yml _quarto-index.yml
6566
cp _quarto_not_used.yml _quarto.yml && rm _quarto_not_used.yml
6667

6768

6869
echo "📄 Converting .docx files to .pdf..."
69-
timeout 3s ../.github/scripts/convert_docx_to_pdf.sh || true
70-
timeout 10m ../.github/scripts/convert_docx_to_pdf.sh
70+
docx_count=$(find _site -name "*.docx" -type f | wc -l)
71+
echo " Found $docx_count DOCX files to convert"
72+
73+
# Quick 3-second test run
74+
echo " Running quick test conversion..."
75+
timeout 3s ../.github/scripts/convert_docx_to_pdf.sh 2>&1 | head -20 || true
76+
77+
# Full conversion with detailed error reporting
78+
echo " Starting full PDF conversion (timeout: 20m)..."
79+
if ! timeout 20m ../.github/scripts/convert_docx_to_pdf.sh 2>&1 | tee conversion.log; then
80+
exit_code=$?
81+
echo "❌ PDF conversion failed with exit code: $exit_code"
82+
echo " Last 30 lines of output:"
83+
tail -30 conversion.log
84+
echo " DOCX files present:"
85+
find _site -name "*.docx" -type f | head -10
86+
exit $exit_code
87+
fi
88+
89+
echo "✅ PDF conversion completed successfully"
90+
pdf_count=$(find _site -name "*.pdf" -type f | wc -l)
91+
echo " Generated $pdf_count PDF files"
7192

7293
# Clean up DOCX files if requested (they're only needed for PDF conversion)
7394
if [[ -n "$SKIP_DOCX" ]]; then

.github/scripts/external_publish_main.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ get_changed_files() {
1414
git ls-tree -r --name-only "$PUBLISH_COMMIT" > changed-files.txt
1515
# Remove specific files we want to ignore
1616
sed -i '/^\.gitignore$/d; /^\.github\/workflows\/trigger\.yml$/d' changed-files.txt
17-
cat changed-files.txt
17+
file_count=$(wc -l < changed-files.txt)
18+
echo "Found $file_count changed file(s)"
1819
}
1920

2021
check_files_within_project() {
@@ -73,10 +74,7 @@ check_for_changes() {
7374
return 1
7475
fi
7576

76-
echo "✅ Modified files:"
77-
printf '%s\n' "${MODIFIED_FILES[@]}"
78-
echo "🗑️ Deleted files:"
79-
printf '%s\n' "${DELETED_FILES[@]}"
77+
echo "✅ Changes detected: ${#MODIFIED_FILES[@]} modified, ${#DELETED_FILES[@]} deleted"
8078

8179
return 0
8280
}
@@ -95,10 +93,11 @@ apply_file_changes() {
9593
run_git "removing deleted files" rm "${DELETED_FILES[@]}"
9694
fi
9795

98-
# Stage modified files
99-
for file in "${MODIFIED_FILES[@]}"; do
100-
run_git "adding $file to staging" add "$file"
101-
done
96+
# Stage all modified files at once
97+
if [ "${#MODIFIED_FILES[@]}" -gt 0 ]; then
98+
git add "${MODIFIED_FILES[@]}" 2>&1 | head -1 || true
99+
echo "Staged ${#MODIFIED_FILES[@]} modified file(s)"
100+
fi
102101
}
103102

104103
generate_commit_message() {

.github/scripts/group_docs_by_category.py

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ def group_qmd_files_by_category(source_dir="origin_DOCS", target_dir="DOCS"):
146146
secret_mappings = load_secret_map()
147147
updated = False
148148

149+
# Counters for summary
150+
categorized_count = 0
151+
non_browsable_count = 0
152+
new_non_browsable_assignments = 0
153+
149154
# Find all .qmd files
150155
qmd_files = [
151156
f
@@ -179,15 +184,13 @@ def group_qmd_files_by_category(source_dir="origin_DOCS", target_dir="DOCS"):
179184
secret_mappings, rel_source, base, url
180185
)
181186
updated = True
187+
new_non_browsable_assignments += 1
182188
print(
183189
f"\t[non-browsable] Assigned new random base '{base}' for {rel_source}"
184190
)
185191
else:
186192
base = mapping["base"]
187193
url = mapping["url"]
188-
print(
189-
f"\t[non-browsable] Using existing base '{base}' for {rel_source}"
190-
)
191194

192195
target_file = nb_dir / f"{base}.qmd"
193196
shutil.copy2(qmd_file, target_file)
@@ -202,9 +205,6 @@ def group_qmd_files_by_category(source_dir="origin_DOCS", target_dir="DOCS"):
202205
if target_media_dir.exists():
203206
shutil.rmtree(target_media_dir)
204207
shutil.copytree(orig_media_dir, target_media_dir)
205-
print(
206-
f"\t\tCopied media directory: {base}-media (renamed for non-browsable)"
207-
)
208208
# Update references in the copied .qmd file
209209
try:
210210
with open(target_file, "r", encoding="utf-8") as f:
@@ -215,16 +215,11 @@ def group_qmd_files_by_category(source_dir="origin_DOCS", target_dir="DOCS"):
215215
content = content.replace(old_media, new_media)
216216
with open(target_file, "w", encoding="utf-8") as f:
217217
f.write(content)
218-
print(
219-
f"\t\tRewrote media references in {base}.qmd (non-browsable)"
220-
)
221218
except Exception as e:
222219
print(
223220
f"\t\t[ERROR] Failed to rewrite media references in {base}.qmd: {e}"
224221
)
225-
print(
226-
f"\t[non-browsable] Copied {qmd_file.name} → non-browsable/{base}.qmd (non-browsable)"
227-
)
222+
non_browsable_count += 1
228223
else:
229224
# Normal doc: group by category, prefix with project name to avoid collisions
230225
target_directory = get_directory_for_category(category)
@@ -245,7 +240,6 @@ def group_qmd_files_by_category(source_dir="origin_DOCS", target_dir="DOCS"):
245240
if target_media_dir.exists():
246241
shutil.rmtree(target_media_dir)
247242
shutil.copytree(orig_media_dir, target_media_dir)
248-
print(f"\t\tCopied media directory: {prefix}{qmd_file.stem}-media")
249243
# Rewrite media references in the copied QMD file
250244
if prefix:
251245
try:
@@ -258,41 +252,30 @@ def group_qmd_files_by_category(source_dir="origin_DOCS", target_dir="DOCS"):
258252
content = content.replace(old_media, new_media)
259253
with open(target_file, "w", encoding="utf-8") as f:
260254
f.write(content)
261-
print(
262-
f"\t\tRewrote media references in {prefix}{qmd_file.name}"
263-
)
264255
except Exception as e:
265256
print(
266257
f"\t\t[ERROR] Failed to rewrite media references in {prefix}{qmd_file.name}: {e}"
267258
)
268-
if category:
269-
if category in CATEGORY_TO_DIRECTORY_MAP:
270-
print(
271-
f"\tCopied {qmd_file.name}{target_directory}/ as {prefix}{qmd_file.name} (category: {category})"
272-
)
273-
else:
274-
print(
275-
f"\tCopied {qmd_file.name}{target_directory}/ as {prefix}{qmd_file.name}"
276-
)
277-
else:
278-
print(
279-
f"\tCopied {qmd_file.name}{target_directory}/ as {prefix}{qmd_file.name} (no category found)"
280-
)
259+
categorized_count += 1
281260

282261
# Save updated secret mapping if changed
283262
if updated:
284263
save_secret_map(secret_mappings)
285-
print(f"[non-browsable] Updated mapping file: {NON_BROWSABLE_MAP_PATH}")
286-
else:
287-
print(f"[non-browsable] No changes to mapping file: {NON_BROWSABLE_MAP_PATH}")
264+
if new_non_browsable_assignments > 0:
265+
print(
266+
f"[non-browsable] Created {new_non_browsable_assignments} new URL mappings"
267+
)
288268

289269
# Save path mappings for changelog system
290270
mapping_file = target_path / "_meta" / ".temp_path_mapping.json"
291271
import json
292272

293273
with open(mapping_file, "w", encoding="utf-8") as f:
294274
json.dump(path_mappings, f, indent=2)
295-
print(f"[path-mapping] Saved {len(path_mappings)} path mappings to {mapping_file}")
275+
276+
print(
277+
f"Processed {len(qmd_files)} files: {categorized_count} categorized, {non_browsable_count} non-browsable."
278+
)
296279

297280

298281
def copy_excluded_dirs(source_dir="origin_DOCS", target_dir="DOCS"):
@@ -317,6 +300,7 @@ def inject_original_filename_in_qmd_files(docs_dir="origin_DOCS"):
317300
print("Injecting original filename field into QMD files...")
318301

319302
processed_files = 0
303+
skipped_files = 0
320304

321305
# Find all .qmd files in the docs directory
322306
for qmd_file in docs_path.rglob("*.qmd"):
@@ -337,13 +321,15 @@ def inject_original_filename_in_qmd_files(docs_dir="origin_DOCS"):
337321
print(
338322
f" Warning: {qmd_file.name} doesn't have YAML header, skipping"
339323
)
324+
skipped_files += 1
340325
continue
341326

342327
parts = content.split("---", 2)
343328
if len(parts) < 3:
344329
print(
345330
f" Warning: {qmd_file.name} has malformed YAML header, skipping"
346331
)
332+
skipped_files += 1
347333
continue
348334

349335
yaml_header = parts[1]
@@ -370,15 +356,15 @@ def inject_original_filename_in_qmd_files(docs_dir="origin_DOCS"):
370356
with open(qmd_file, "w", encoding="utf-8") as file:
371357
file.write(new_content)
372358

373-
print(
374-
f" Added original-filename: {original_filename_field} to {qmd_file.name}"
375-
)
376359
processed_files += 1
377360

378361
except Exception as e:
379362
print(f" Error processing {qmd_file.name}: {e}")
363+
skipped_files += 1
380364

381-
print(f"Processed {processed_files} QMD files with original filename injection.")
365+
print(f"Processed {processed_files} QMD files successfully.")
366+
if skipped_files > 0:
367+
print(f"Skipped {skipped_files} files due to errors or missing headers.")
382368

383369

384370
def update_bibliography_paths_before_regroup(
@@ -394,6 +380,7 @@ def update_bibliography_paths_before_regroup(
394380

395381
processed_projects = 0
396382
processed_qmd_files = 0
383+
moved_bib_files = 0
397384

398385
for project_dir in docs_path.iterdir():
399386
if not project_dir.is_dir() or project_dir.name in EXCLUDED_DOCS_DIRS:
@@ -430,14 +417,18 @@ def update_bibliography_paths_before_regroup(
430417
for qmd_file in qmd_files:
431418
if update_qmd_bibliography_reference(qmd_file, new_bib_reference):
432419
processed_qmd_files += 1
433-
print(f" Updated {qmd_file.name}")
434420

435421
# Move .bib file to new location
436422
shutil.copy2(original_bib, new_bib_path)
437-
print(f" Moved {original_bib.name} -> {new_bib_path}")
423+
moved_bib_files += 1
438424

439425
processed_projects += 1
440426

427+
if processed_projects > 0:
428+
print(
429+
f"Processed {processed_projects} projects: updated {processed_qmd_files} files, moved {moved_bib_files} bibliography files."
430+
)
431+
441432

442433
def update_qmd_bibliography_reference(qmd_file_path, new_bib_reference):
443434
try:
@@ -480,10 +471,8 @@ def update_qmd_bibliography_reference(qmd_file_path, new_bib_reference):
480471
with open(qmd_file_path, "w", encoding="utf-8") as file:
481472
file.write(new_content)
482473

483-
print(f" {old_bib_ref} -> {new_bib_reference}")
484474
return True
485475
else:
486-
print(f" No bibliography field in YAML header, skipping")
487476
return False
488477

489478
except Exception as e:

0 commit comments

Comments
 (0)