@@ -43,7 +43,10 @@ def announce_templating(var_name):
4343
4444# The following are provided via runpy.run_path's init_globals keyword
4545# in conf.py. Uncomment for easy debugger run without IDE config.
46+ _ = RTD_EVIL # noqa # explode ASAP or the links will all be broken
47+ log .info (f" RTD EVIL: { RTD_EVIL !r} " ) # noqa
4648try :
49+
4750 _ = GIT_REF # noqa
4851except Exception as _ :
4952 GIT_REF = "development"
@@ -61,6 +64,10 @@ def announce_templating(var_name):
6164 announce_templating ("FMT_URL_REF_EMBED" )
6265
6366
67+ def src_kludge (strpath ): # pending: post-3.0 cleanup: # evil evil evil evil
68+ """We inject what RTD says the canonical domain is up top + the version"""
69+ return f"{ RTD_EVIL } { strpath } "
70+
6471MODULE_DIR = Path (__file__ ).parent .resolve ()
6572ARCADE_ROOT = MODULE_DIR .parent
6673RESOURCE_DIR = ARCADE_ROOT / "arcade" / "resources"
@@ -477,7 +484,7 @@ def indent( # pending: post-3.0 refactor # why would indent come after the tex
477484 return new .getvalue ()
478485
479486# pending: post-3.0 cleanup, I don't have time to make this CSS nice right now.
480- COPY_BUTTON_PATH = "_static/icons/tabler/copy.svg"
487+ COPY_BUTTON_PATH = "https://raw.githubusercontent.com/pythonarcade/arcade/refs/heads/development/doc/ _static/icons/tabler/copy.svg"
481488#COPY_BUTTON_RAW = (DOC_ROOT / "_static/icons/tabler/copy.svg").read_text().strip() + "\n"
482489
483490
@@ -489,13 +496,15 @@ def html_copyable(
489496 if string_quote_char :
490497 value = f"{ string_quote_char } { value } { string_quote_char } "
491498 escaped = html .escape (value )
499+ # src = src_kludge(COPY_BUTTON_PATH)
500+ src = FMT_URL_REF_EMBED .format (COPY_BUTTON_PATH )
492501 raw = (
493502 f"<span class=\" resource-handle\" >\n "
494503 f" <code class=\" docutils literal notranslate\" >\n "
495504 f" <span class=\" pre\" >{ escaped } </span>\n "
496505 f" </code>\n "
497506 f" <button class=\" arcade-ezcopy\" data-clipboard-text=\" { resource_handle } \" >\n "
498- f" <img src=\" / { COPY_BUTTON_PATH } \" />\n "
507+ f" <img src=\" { COPY_BUTTON_PATH } \" />\n "
499508 # + indent(" " * 2, COPY_BUTTON_RAW) + # pending: post-3.0 cleanup
500509 f" </button>\n "
501510 f"</span>\n "
@@ -621,17 +630,16 @@ def do_filetile(out, suffix: str | None = None, state: str = None):
621630 p = FILETILE_DIR / f"type-{ suffix .strip ('.' )} .png"
622631 log .info (f" FILETILE: { p } " )
623632 if p .exists ():
624- print (" KNOWN!" )
633+ print (f " KNOWN! { p . name !r } " )
625634 name = p .name
626635 else :
627636 name = f"type-unknown.png"
628637 print (" ... unknown :(" )
629638 else :
630639 name = "state-error.png"
631-
632640 out .write (indent (f" " ,
633641 f".. raw:: html\n \n "
634- f" <img class=\" resource-thumb\" src=\" /_static/filetiles/{ name } \" />\n \n " ))
642+ f" <img class=\" resource-thumb\" src=\" { src_kludge ( ' /_static/filetiles/' + name ) } \" />\n \n " ))
635643
636644
637645def process_resource_files (
@@ -712,9 +720,9 @@ def start():
712720 config = MEDIA_EMBED [suffix ]
713721 kind = config .get ('media_kind' )
714722 mime_suffix = config .get ('mime_suffix' )
715- # file_path = FMT_URL_REF_EMBED.format(resource_path)
716- rel = path .relative_to (RESOURCE_DIR )
717- file_path = f"/_static/{ str (rel )} "
723+ file_path = FMT_URL_REF_EMBED .format (resource_path )
724+ # rel = path.relative_to(RESOURCE_DIR)
725+ # file_path = src_kludge( f"/_static/{str(rel)}")
718726 out .write (f" { start ()} - .. raw:: html\n \n " )
719727 out .write (indent (
720728 " " , resource_copyable ))
@@ -723,7 +731,8 @@ def start():
723731 out .write (indent (" " ,
724732 # Using preload="none" is gentler on GitHub and readthedocs
725733 f"<{ kind } class=\" resource-thumb\" controls preload=\" none\" >\n "
726- f" <source src='{ file_path } ' type='{ kind } /{ mime_suffix } '>\n "
734+ f" <source src=\" { file_path } \" type=\" { kind } /{ mime_suffix } \" >\n "
735+ f" <source src=\" { src_kludge (file_path )} \" type=\" { kind } /{ mime_suffix } \" >\n "
727736 f"</{ kind } >\n \n " ))
728737
729738 # Fonts
@@ -743,7 +752,7 @@ def start():
743752
744753 # File tiles we don't have previews for
745754 else :# suffix == ".json":
746- file_path = FMT_URL_REF_PAGE .format (resource_path )
755+ # file_path = FMT_URL_REF_PAGE.format(resource_path)
747756 out .write (f" { start ()} - .. raw:: html\n \n " )
748757 out .write (indent (" " ,
749758 resource_copyable ))
@@ -802,7 +811,7 @@ def resources():
802811 f" <ol>\n "
803812 f" <li>A <strong>file name</strong> as a single-quoted string (<code class=\" docutils literal notranslate\" ><span class=\" pre\" >{ logo } </span></code>)</li>\n "
804813 f" <li>A <strong>copy button</strong> to the right of the string (<div class=\" arcade-ezcopy doc-ui-example-dummy\" style=\" display: inline-block;\" >"
805- f"<img src=\" /_static/icons/tabler/copy.svg\" ></div>)</li>\n "
814+ f"<img src=\" { src_kludge ( ' /_static/icons/tabler/copy.svg' ) } \" ></div>)</li>\n "
806815 f" </ol>\n \n "
807816 +
808817 "Click the button above a preview to copy the **resource handle** string for loading the asset.\n "
0 commit comments