Skip to content

Commit

Permalink
Add script to fix API reference links generated by sphix-markdown-tab…
Browse files Browse the repository at this point in the history
…les.

PiperOrigin-RevId: 469155387
Change-Id: Ic1e7dac509d5569758242ceefacc153527d688d6
  • Loading branch information
lanctot committed Aug 22, 2022
1 parent 9e4559b commit 1ea2044
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ help:
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
./fix_table_links.sh
25 changes: 25 additions & 0 deletions docs/fix_table_links.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
#
# Copyright 2022 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Links to sub documents within tables are not properly converted.
# E.g. a reference to a separate markdown table is not converted to the
# corresponding .html in Read the Docs.
#
# This is an open issue with sphinx-markdown-tables, see
# https://github.com/ryanfox/sphinx-markdown-tables/issues/18

# Currently the only file affected is the api_reference:
sed -i -E 's/a href="(.*)\.md"/a href="\1\.html"/g' _build/html/api_reference.html

0 comments on commit 1ea2044

Please sign in to comment.