Skip to content

Commit

Permalink
Add support for a base_url flag in nblint
Browse files Browse the repository at this point in the history
This will allow the tool to be used for non-TF.org sites.

Written to support Py3.8, which IIUC is all we support right now.

PiperOrigin-RevId: 534855223
  • Loading branch information
markmcd authored and copybara-github committed May 24, 2023
1 parent 13e9340 commit 47be943
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/tensorflow_docs/tools/nblint/style/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,10 @@ def button_website(args):
if "r1" in rel_path.parts:
return True # No website button for TF 1.x docs.

if str(docs_dir) == "site/zh-cn" or str(docs_dir) == "site/zh-tw":
user_url = args["user"].get("base_url")
if user_url:
base_url = user_url
elif str(docs_dir) == "site/zh-cn" or str(docs_dir) == "site/zh-tw":
base_url = "https://tensorflow.google.cn/"
else:
base_url = "https://www.tensorflow.org/"
Expand Down

0 comments on commit 47be943

Please sign in to comment.