From 737a11676929034f36c88234284f0ba828fc7158 Mon Sep 17 00:00:00 2001 From: Brett Logan Date: Wed, 2 Sep 2020 13:00:36 -0400 Subject: [PATCH] Update RTD Placeholder Dynamically pull the RTD version from the environment variable delivered by RTD Signed-off-by: Brett Logan --- docs/source/chaincode_lifecycle.md | 2 +- docs/source/conf.py | 11 ++++++++--- docs/source/docs_guide.md | 6 +++--- docs/source/style_guide.md | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/docs/source/chaincode_lifecycle.md b/docs/source/chaincode_lifecycle.md index b9ed4e60896..8a27f7886f7 100644 --- a/docs/source/chaincode_lifecycle.md +++ b/docs/source/chaincode_lifecycle.md @@ -148,7 +148,7 @@ consistent across organizations: endorse a transaction. - **Collection Configuration:** The path to a private data collection definition file associated with your chaincode. For more information about private data - collections, see the [Private Data architecture reference](https://hyperledger-fabric.readthedocs.io/en/{BRANCH}/private-data-arch.html). + collections, see the [Private Data architecture reference](https://hyperledger-fabric.readthedocs.io/en/{RTD_TAG}/private-data-arch.html). - **ESCC/VSCC Plugins:** The name of a custom endorsement or validation plugin to be used by this chaincode. - **Initialization:** If you use the low level APIs provided by the Fabric Chaincode diff --git a/docs/source/conf.py b/docs/source/conf.py index fc761185c21..3a9082c756f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,14 +20,19 @@ # import os import sys -sys.path.insert(0, os.path.abspath('.')) +import sphinx_rtd_theme +from os import environ +sys.path.insert(0, os.path.abspath('.')) -import sphinx_rtd_theme +rtd_tag = 'latest' +if environ.get('READTHEDOCS_VERSION') is not None: + rtd_tag = os.environ['READTHEDOCS_VERSION'] placeholder_replacements = { "{BRANCH}" : "master", - "{BRANCH_DOC}" : "latest" # Used to target the correct ReadTheDocs distribution version + "{BRANCH_DOC}" : "latest", # Used to target the correct ReadTheDocs distribution version + "{RTD_TAG}": rtd_tag } # -- General configuration ------------------------------------------------ diff --git a/docs/source/docs_guide.md b/docs/source/docs_guide.md index 98afbd028d7..3f824fcc2b4 100644 --- a/docs/source/docs_guide.md +++ b/docs/source/docs_guide.md @@ -100,15 +100,15 @@ folder](https://github.com/hyperledger/fabric/tree/master/docs) in the Hyperledger Fabric repository. Click on the following links to see how different source files map to their corresponding published topics. -* [`/docs/source/index.rst`](https://raw.githubusercontent.com/hyperledger/fabric/master/docs/source/index.rst) maps to [Hyperledger Fabric title page](https://hyperledger-fabric.readthedocs.io/en/{BRANCH}/) +* [`/docs/source/index.rst`](https://raw.githubusercontent.com/hyperledger/fabric/master/docs/source/index.rst) maps to [Hyperledger Fabric title page](https://hyperledger-fabric.readthedocs.io/en/{RTD_TAG}/) * [`/docs/source/developapps/developing-applications.rst`](https://raw.githubusercontent.com/hyperledger/fabric/master/docs/source/developapps/developing_applications.rst) maps to [Developing - applications](https://hyperledger-fabric.readthedocs.io/en/{BRANCH}/developapps/developing_applications.html) + applications](https://hyperledger-fabric.readthedocs.io/en/{RTD_TAG}/developapps/developing_applications.html) * [`/docs/source/peers/peers.md`](https://raw.githubusercontent.com/hyperledger/fabric/master/docs/source/peers/peers.md) maps to - [Peers](https://hyperledger-fabric.readthedocs.io/en/{BRANCH}/peers/peers.html) + [Peers](https://hyperledger-fabric.readthedocs.io/en/{RTD_TAG}/peers/peers.html) We'll see how to make changes to these files a little later. diff --git a/docs/source/style_guide.md b/docs/source/style_guide.md index 936cc07b43d..f65a2088688 100644 --- a/docs/source/style_guide.md +++ b/docs/source/style_guide.md @@ -6,9 +6,9 @@ While this style guide will also refer to best practices using ReStructured Text **When in doubt, use the docs themselves for guidance on how to format things.** -* [For RST formatting](http://hyperledger-fabric.readthedocs.io/en/{BRANCH}/channel_update_tutorial.html). +* [For RST formatting](http://hyperledger-fabric.readthedocs.io/en/{RTD_TAG}/channel_update_tutorial.html). -* [For Markdown formatting](http://hyperledger-fabric.readthedocs.io/en/{BRANCH}/peers/peers.html). +* [For Markdown formatting](http://hyperledger-fabric.readthedocs.io/en/{RTD_TAG}/peers/peers.html). If you just want to look at how things are formatted, you can navigate to the Fabric repo to look at the raw file by clicking on `Edit on Github` link in the upper right hand corner of the page. Then click the `Raw` tab. This will show you the formatting of the doc. **Do not attempt to edit the file on Github.** If you want to make a change, clone the repo and follow the instructions in [Contributing](./CONTRIBUTING.html) for creating pull requests.