mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 19:55:54 +00:00
Dactyl - solution for different image paths by target
This commit is contained in:
@@ -29,15 +29,20 @@ targets:
|
|||||||
- multicode_tabs
|
- multicode_tabs
|
||||||
- standardize_header_ids
|
- standardize_header_ids
|
||||||
- buttonize
|
- buttonize
|
||||||
|
|
||||||
- name: ripple.com
|
- name: ripple.com
|
||||||
filters:
|
filters:
|
||||||
- multicode_tabs
|
- multicode_tabs
|
||||||
- standardize_header_ids
|
- standardize_header_ids
|
||||||
- buttonize
|
- buttonize
|
||||||
|
image_subs:
|
||||||
- name: printable
|
"img/funds_flow_diagram.png": https://ripple.com/wp-content/uploads/2016/03/funds_flow_diagram.png
|
||||||
filters:
|
"img/e2g-01.png": https://ripple.com/wp-content/themes/ripple-beta/assets/img/e2g-01.png
|
||||||
- standardize_header_ids
|
"img/e2g-02.png": https://ripple.com/wp-content/themes/ripple-beta/assets/img/e2g-02.png
|
||||||
|
"img/e2g-03.png": https://ripple.com/wp-content/themes/ripple-beta/assets/img/e2g-03.png
|
||||||
|
"img/ledger-process.png": https://ripple.com/wp-content/themes/ripple-beta/assets/img/ledger-process.png
|
||||||
|
"img/ledger-components.png": https://ripple.com/wp-content/themes/ripple-beta/assets/img/ledger-components.png
|
||||||
|
"img/ledger-indexes.png": https://ripple.com/wp-content/themes/ripple-beta/assets/img/ledger-indexes.png
|
||||||
|
|
||||||
- name: rippled-setup
|
- name: rippled-setup
|
||||||
filters:
|
filters:
|
||||||
@@ -216,8 +221,7 @@ pages:
|
|||||||
category: Best Practices
|
category: Best Practices
|
||||||
html: concept-issuing-and-operational-addresses.html
|
html: concept-issuing-and-operational-addresses.html
|
||||||
md: concept-issuing-and-operational-addresses.md
|
md: concept-issuing-and-operational-addresses.md
|
||||||
# TODO publish this article separately on the website
|
ripple.com: https://ripple.com/knowledge_center/issuing-operational-addresses/
|
||||||
ripple.com: https://ripple.com/build/gateway-guide/#hot-and-cold-wallets
|
|
||||||
sidebar: true
|
sidebar: true
|
||||||
targets:
|
targets:
|
||||||
- local
|
- local
|
||||||
@@ -283,8 +287,6 @@ ignore_anchors_in:
|
|||||||
known_broken_links:
|
known_broken_links:
|
||||||
# Strangely, Python doesn't like the cert here. Firefox is OK with it.
|
# Strangely, Python doesn't like the cert here. Firefox is OK with it.
|
||||||
- https://validators.ripple.com
|
- https://validators.ripple.com
|
||||||
# Zendesk hasn't updated the cert. See ticket IN-1168
|
|
||||||
- https://support.ripplelabs.com/hc/en-us/categories/200194196-Set-Up-Activation
|
|
||||||
|
|
||||||
# Style Checker Config ------------------------------------------------------ #
|
# Style Checker Config ------------------------------------------------------ #
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ def load_config(config_file=DEFAULT_CONFIG_FILE):
|
|||||||
|
|
||||||
def substitute_links_for_target(soup, target):
|
def substitute_links_for_target(soup, target):
|
||||||
"""Replaces local-html-links with appropriate substitutions
|
"""Replaces local-html-links with appropriate substitutions
|
||||||
for the given target"""
|
for the given target, and images likewise"""
|
||||||
target = get_target(target)
|
target = get_target(target)
|
||||||
|
|
||||||
logger.info("... modifying links for target: %s" % target["name"])
|
logger.info("... modifying links for target: %s" % target["name"])
|
||||||
@@ -92,6 +92,25 @@ def substitute_links_for_target(soup, target):
|
|||||||
link["href"] = link["href"].replace(local_url,
|
link["href"] = link["href"].replace(local_url,
|
||||||
target_url)
|
target_url)
|
||||||
|
|
||||||
|
|
||||||
|
if "image_subs" in target:
|
||||||
|
images = soup.find_all("img")
|
||||||
|
for img in images:
|
||||||
|
local_path = img["src"]
|
||||||
|
if local_path in target["image_subs"]:
|
||||||
|
logger.info("... replacing image path '%s' with '%s'" %
|
||||||
|
(local_path, target["image_subs"][local_path]))
|
||||||
|
img["src"] = target["image_subs"][local_path]
|
||||||
|
|
||||||
|
image_links = soup.find_all("a",
|
||||||
|
href=re.compile(r"^[^.]+\.(png|jpg|jpeg|gif|svg)"))
|
||||||
|
for img_link in image_links:
|
||||||
|
local_path = img_link["href"]
|
||||||
|
if local_path in target["image_subs"]:
|
||||||
|
logger.info("... replacing image link '%s' with '%s'" %
|
||||||
|
(local_path, target["image_subs"][local_path]))
|
||||||
|
img_link["href"] = target["image_subs"][local_path]
|
||||||
|
|
||||||
def get_target(target):
|
def get_target(target):
|
||||||
"""Get a target by name, or return the default target object.
|
"""Get a target by name, or return the default target object.
|
||||||
We can't use default args in function defs because the default is
|
We can't use default args in function defs because the default is
|
||||||
|
|||||||
Reference in New Issue
Block a user