mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-19 11:15:49 +00:00
Add tool/migrate.sh as a one-stop conversion script for the whole repo. This script's duties include: - Changing all links from their old (.html) paths to new paths - Converting most Dactyl-specific syntax to Redocly equivalents - Generating Redocly sidebar and redirects YAML files This script is meant to be run from the repo top. It replaces syntax in-place. Unless this is the final migration phase, the results of running the migration script should be committed in a separate commit whose message starts with '[DROP]' so it can be re-run on the latest version of the master branch during rebasing. Many commits have been squashed into this one, including: - Add tool/migrate_links.sh as a one-stop conversion script for links. - Enable the update_links filter in dactyl config but make it inactive unless you pass the appropriate vars - Hack include_svg script to assume content/img instead of img [FOLD] Migration scripting improvements: - Roll scripting into all-in-one tool/migrate.sh - Script moving/renaming Japanese snippets into @i18n - Link replacment in snippets - Handle links with query params - Handle ref-links with anchors - Remove some macro syntax that breaks Redocly - Follow internal redirects in link replacement - Handle links to some non-md pages [FOLD] Migration script: handle more reflinks & imgs [FOLD] tweak link migration [FOLD] Fix substitution of reflinks Add sidebar script [FOLD] Fix link migration and whitespace noisiness [FOLD] Link migration: auto-generate better link replacements [FOLD] Convert badge syntax [FOLD] Migration script: handle :not_enabled: syntax [FOLD] Script generation of redirects [FOLD] Migration script: make reusable common links [FOLD] Fix common links code & conversion script comments [FOLD] Add more non-md links [FOLD] Fix filter_update_links syntax [FOLD] Fix script's common links include placement [FOLD] Migration script: update badge replacement to work w/ common-links [FOLD] Fix ordering of converting common-links vs partials [FOLD] Fix link substitution in common-links and fix trailing /index in redirects
39 lines
1.5 KiB
Bash
Executable File
39 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Migrate links script. Requires a "working"(ish) Dactyl build, so it should be run before md_dactyl_to_redocly.py or convert-code-blocks.cjs
|
|
|
|
# Update the autosubs_cheatsheet.yml file based on the typical link includes.
|
|
tool/make_autosubs.sh
|
|
|
|
# Make a new "common links" snippet to replace the old ones.
|
|
tool/make_common_links_snippet.sh
|
|
|
|
# Re-generate the Redocly sidebar and redirects.yaml based on Dactyl pagelist.
|
|
dactyl_build --vars '{"do_redocly_sidebar":true}'
|
|
|
|
# Blank the snippets that contain reusable links, so the md reference links will remain unparsed as [Link text][]
|
|
truncate -s 0 content/_snippets/rippled-api-links.md
|
|
truncate -s 0 content/_snippets/tx-type-links.md
|
|
truncate -s 0 content/_snippets/rippled_versions.md
|
|
|
|
# Link replacement (English)
|
|
dactyl_build --vars '{"do_link_replacement":true}' -q
|
|
|
|
# Link replacement (Japanese)
|
|
dactyl_build -t ja -o out/ja --vars '{"do_link_replacement":true}' -q
|
|
|
|
# Blank this snippet which contains a Jinja macro (not needed, throws errors)
|
|
truncate -s 0 content/_snippets/macros/page-children.md
|
|
|
|
# Move Japanese snippets from _snippets/*.ja.md to @i18n/ja/_snippets/*.md
|
|
cd content/_snippets
|
|
find . -type d -exec sh -c 'mkdir -p "../@i18n/ja/_snippets/$0"' {} \;
|
|
find . -name "*.ja.md" -exec sh -c 'mv "$0" "../@i18n/ja/_snippets/${0%.ja.md}.md"' {} \;
|
|
cd ../..
|
|
|
|
# Convert Dactyl syntax to Redocly syntax
|
|
tool/md_dactyl_to_redocly.py
|
|
|
|
# Convert indented code blocks to (possibly-indented) code fences
|
|
node tool/convert-code-blocks.cjs content/
|