From 4342383d9595914786475aa55c001864333ddcc1 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 4 Jul 2019 01:19:56 -0500 Subject: add jinja extension; update shared-bindings/index.rst to use jinja --- conf.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'conf.py') diff --git a/conf.py b/conf.py index 858657388..3bc7d2764 100644 --- a/conf.py +++ b/conf.py @@ -13,6 +13,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import json import sys import os @@ -26,6 +27,19 @@ sys.path.insert(0, os.path.abspath('.')) master_doc = 'docs/index' +# Grab the JSON values to use while building the module support matrix +# in 'shared-bindings/index.rst' +shared_bindings_json = 'support_matrix.json' +if 'TRAVIS' in os.environ: + shared_bindings_json = os.path.join('$HOME', shared_bindings_json) +else: + shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) +with open(shared_bindings_json) as json_file: + modules_support_matrix = json.load(json_file) +html_context = { + 'support_matrix': modules_support_matrix +} + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -40,7 +54,8 @@ extensions = [ 'sphinxcontrib.rsvgconverter', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', - 'sphinx.ext.coverage' + 'sphinx.ext.coverage', + 'rstjinja' ] # Add any paths that contain templates here, relative to this directory. -- cgit v1.2.3 From 42ed84141ebdf821131bd477700e399f4fa76c98 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 4 Jul 2019 01:49:40 -0500 Subject: fix late-night directory snafu --- conf.py | 2 +- docs/shared_bindings_matrix.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'conf.py') diff --git a/conf.py b/conf.py index 3bc7d2764..152c718b5 100644 --- a/conf.py +++ b/conf.py @@ -31,7 +31,7 @@ master_doc = 'docs/index' # in 'shared-bindings/index.rst' shared_bindings_json = 'support_matrix.json' if 'TRAVIS' in os.environ: - shared_bindings_json = os.path.join('$HOME', shared_bindings_json) + shared_bindings_json = os.path.join(os.environ['HOME'], shared_bindings_json) else: shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) with open(shared_bindings_json) as json_file: diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index ebcadb7ad..5d7ada701 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -122,7 +122,7 @@ if __name__ == "__main__": shared_bindings_json = 'support_matrix.json' if 'TRAVIS' in os.environ: - shared_bindings_json = os.path.join('$HOME', shared_bindings_json) + shared_bindings_json = os.path.join(os.environ['HOME'], shared_bindings_json) else: print(final_json) shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) -- cgit v1.2.3 From 9c1487cff6cf28364ddd212e0af0076a2b663d6f Mon Sep 17 00:00:00 2001 From: Hierophect Date: Tue, 23 Jul 2019 13:48:59 -0400 Subject: Python doc generator fixes --- conf.py | 4 ++++ ports/stm32f4/README.md | 4 +++- ports/stm32f4/stm32cube/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h | 4 ++-- ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c | 4 ++-- .../stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c | 4 ++-- ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c | 4 ++-- .../Src/stm32f4xx_hal_timebase_rtc_alarm_template.c | 2 +- .../Src/stm32f4xx_hal_timebase_rtc_wakeup_template.c | 2 +- ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c | 2 +- 9 files changed, 18 insertions(+), 12 deletions(-) (limited to 'conf.py') diff --git a/conf.py b/conf.py index 858657388..1ad6ed005 100644 --- a/conf.py +++ b/conf.py @@ -121,6 +121,10 @@ exclude_patterns = ["**/build*", "ports/nrf/nrfx", "ports/nrf/peripherals", "ports/nrf/usb", + "ports/stm32f4/stm32cube", + "ports/stm32f4/peripherals", + "ports/stm32f4/ref", + "ports/stm32f4/README.md", "ports/pic16bit", "ports/qemu-arm", "ports/stm32", diff --git a/ports/stm32f4/README.md b/ports/stm32f4/README.md index 61d5bab54..a860c01ce 100644 --- a/ports/stm32f4/README.md +++ b/ports/stm32f4/README.md @@ -1 +1,3 @@ -##Not Done +# CircuitPython Port To The ST Microelectronics STM32F4 Series + +This is a port of CircuitPython to the STM32F4 series of chips. diff --git a/ports/stm32f4/stm32cube/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h b/ports/stm32f4/stm32cube/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h index d244b97af..2730fc112 100644 --- a/ports/stm32f4/stm32cube/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h +++ b/ports/stm32f4/stm32cube/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h @@ -8,8 +8,8 @@ * is using in the C source code, usually in main.c. This file contains: * - Configuration section that allows to select: * - The STM32F4xx device used in the target application - * - To use or not the peripheral’s drivers in application code(i.e. - * code will be based on direct access to peripheral’s registers + * - To use or not the peripheral's drivers in application code(i.e. + * code will be based on direct access to peripheral's registers * rather than drivers API), this option is controlled by * "#define USE_HAL_DRIVER" * diff --git a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c index cbcaa1ce3..69d988a80 100644 --- a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c +++ b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c @@ -463,7 +463,7 @@ HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp) } #endif /* (USE_HAL_CRYP_REGISTER_CALLBACKS) */ - /* Set the key size(This bit field is don’t care in the DES or TDES modes) data type and Algorithm */ + /* Set the key size(This bit field is don't care in the DES or TDES modes) data type and Algorithm */ #if defined (CRYP) MODIFY_REG(hcryp->Instance->CR, CRYP_CR_DATATYPE|CRYP_CR_KEYSIZE|CRYP_CR_ALGOMODE, hcryp->Init.DataType | hcryp->Init.KeySize | hcryp->Init.Algorithm); @@ -578,7 +578,7 @@ HAL_StatusTypeDef HAL_CRYP_SetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeD hcryp->Init.B0 = pConf->B0; hcryp->Init.DataWidthUnit = pConf->DataWidthUnit; - /* Set the key size(This bit field is don’t care in the DES or TDES modes) data type, AlgoMode and operating mode*/ + /* Set the key size(This bit field is don't care in the DES or TDES modes) data type, AlgoMode and operating mode*/ #if defined (CRYP) MODIFY_REG(hcryp->Instance->CR, CRYP_CR_DATATYPE|CRYP_CR_KEYSIZE|CRYP_CR_ALGOMODE, hcryp->Init.DataType | hcryp->Init.KeySize | hcryp->Init.Algorithm); diff --git a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c index c84f690d4..7ae7abf5e 100644 --- a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c +++ b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c @@ -170,7 +170,7 @@ HAL_StatusTypeDef HAL_CRYPEx_AESGCM_GenerateAuthTAG(CRYP_HandleTypeDef *hcryp, u /* Select final phase */ MODIFY_REG(hcryp->Instance->CR, CRYP_CR_GCM_CCMPH, CRYP_PHASE_FINAL); - /*ALGODIR bit must be set to ‘0’.*/ + /*ALGODIR bit must be set to '0'.*/ hcryp->Instance->CR &= ~CRYP_CR_ALGODIR; /* Enable the CRYP peripheral */ @@ -388,7 +388,7 @@ HAL_StatusTypeDef HAL_CRYPEx_AESCCM_GenerateAuthTAG(CRYP_HandleTypeDef *hcryp, u /* Disable CRYP to start the final phase */ __HAL_CRYP_DISABLE(hcryp); - /* Select final phase & ALGODIR bit must be set to ‘0’. */ + /* Select final phase & ALGODIR bit must be set to '0'. */ MODIFY_REG(hcryp->Instance->CR, CRYP_CR_GCM_CCMPH|CRYP_CR_ALGODIR, CRYP_PHASE_FINAL|CRYP_OPERATINGMODE_ENCRYPT); /* Enable the CRYP peripheral */ diff --git a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c index fbe57f4ae..5136feea6 100644 --- a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c +++ b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c @@ -214,7 +214,7 @@ * @{ */ #define SPI_DEFAULT_TIMEOUT 100U -#define SPI_BSY_FLAG_WORKAROUND_TIMEOUT 1000U /*!< Timeout 1000 µs */ +#define SPI_BSY_FLAG_WORKAROUND_TIMEOUT 1000U /*!< Timeout 1000 us */ /** * @} */ @@ -3488,7 +3488,7 @@ static HAL_StatusTypeDef SPI_EndRxTransaction(SPI_HandleTypeDef *hspi, uint32_t */ static HAL_StatusTypeDef SPI_EndRxTxTransaction(SPI_HandleTypeDef *hspi, uint32_t Timeout, uint32_t Tickstart) { - /* Timeout in µs */ + /* Timeout in us */ __IO uint32_t count = SPI_BSY_FLAG_WORKAROUND_TIMEOUT * (SystemCoreClock / 24U / 1000000U); /* Erratasheet: BSY bit may stay high at the end of a data transfer in Slave mode */ if (hspi->Init.Mode == SPI_MODE_MASTER) diff --git a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_alarm_template.c b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_alarm_template.c index 8e197a19b..4e0daeaae 100644 --- a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_alarm_template.c +++ b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_alarm_template.c @@ -21,7 +21,7 @@ HAL_RTC_MODULE_ENABLED define in stm32f4xx_hal_conf.h [..] - (@) HAL RTC alarm and HAL RTC wakeup drivers can’t be used with low power modes: + (@) HAL RTC alarm and HAL RTC wakeup drivers can't be used with low power modes: The wake up capability of the RTC may be intrusive in case of prior low power mode configuration requiring different wake up sources. Application/Example behavior is no more guaranteed diff --git a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_wakeup_template.c b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_wakeup_template.c index a047def22..fedd99915 100644 --- a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_wakeup_template.c +++ b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_wakeup_template.c @@ -22,7 +22,7 @@ HAL_RTC_MODULE_ENABLED define in stm32f4xx_hal_conf.h [..] - (@) HAL RTC alarm and HAL RTC wakeup drivers can’t be used with low power modes: + (@) HAL RTC alarm and HAL RTC wakeup drivers can't be used with low power modes: The wake up capability of the RTC may be intrusive in case of prior low power mode configuration requiring different wake up sources. Application/Example behavior is no more guaranteed diff --git a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c index 0c43ba766..6b5018c80 100644 --- a/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c +++ b/ports/stm32f4/stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c @@ -33,7 +33,7 @@ (++) max time (mS) = 1000 * (Counter - 0x40) / WWDG clock (+) Typical values: (++) Counter min (T[5;0] = 0x00) @56MHz (PCLK1) with zero prescaler: - max timeout before reset: ~73.14µs + max timeout before reset: ~73.14us (++) Counter max (T[5;0] = 0x3F) @56MHz (PCLK1) with prescaler dividing by 128: max timeout before reset: ~599.18ms -- cgit v1.2.3 From 5ee5c35833c23828db99c8d7f4ed7035c3e418c7 Mon Sep 17 00:00:00 2001 From: Hierophect Date: Tue, 23 Jul 2019 15:28:48 -0400 Subject: Doc error caused by submodule, misc cleanup --- .gitmodules | 1 + conf.py | 2 +- lib/tinyusb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'conf.py') diff --git a/.gitmodules b/.gitmodules index e2845395a..639e8dc79 100644 --- a/.gitmodules +++ b/.gitmodules @@ -77,6 +77,7 @@ path = lib/tinyusb url = https://github.com/hathach/tinyusb.git branch = develop + ignore = dirty [submodule "tools/huffman"] path = tools/huffman url = https://github.com/tannewt/huffman.git diff --git a/conf.py b/conf.py index 1ad6ed005..087bea097 100644 --- a/conf.py +++ b/conf.py @@ -121,7 +121,7 @@ exclude_patterns = ["**/build*", "ports/nrf/nrfx", "ports/nrf/peripherals", "ports/nrf/usb", - "ports/stm32f4/stm32cube", + "ports/stm32f4/stm32f4", "ports/stm32f4/peripherals", "ports/stm32f4/ref", "ports/stm32f4/README.md", diff --git a/lib/tinyusb b/lib/tinyusb index 0848c462b..97e2629d6 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 0848c462b3e431a9da42e96537d2b597a4579636 +Subproject commit 97e2629d647584681b2883f2081fa2cddb3d61cc -- cgit v1.2.3 From b90b63bb2bb27597f87173f10451980c4412757f Mon Sep 17 00:00:00 2001 From: sommersoft Date: Tue, 23 Jul 2019 20:49:37 -0500 Subject: don't use files to pass data; call and return directly in conf.py --- conf.py | 12 +++++------- docs/shared_bindings_matrix.py | 44 +++++++++++++++++------------------------- 2 files changed, 23 insertions(+), 33 deletions(-) (limited to 'conf.py') diff --git a/conf.py b/conf.py index 152c718b5..0c23028ec 100644 --- a/conf.py +++ b/conf.py @@ -25,17 +25,15 @@ from recommonmark.parser import CommonMarkParser sys.path.insert(0, os.path.abspath('docs')) sys.path.insert(0, os.path.abspath('.')) +import shared_bindings_matrix + master_doc = 'docs/index' # Grab the JSON values to use while building the module support matrix # in 'shared-bindings/index.rst' -shared_bindings_json = 'support_matrix.json' -if 'TRAVIS' in os.environ: - shared_bindings_json = os.path.join(os.environ['HOME'], shared_bindings_json) -else: - shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) -with open(shared_bindings_json) as json_file: - modules_support_matrix = json.load(json_file) + +modules_support_matrix = shared_bindings_matrix.support_matrix() + html_context = { 'support_matrix': modules_support_matrix } diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index d690e4718..59b67b7b2 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -45,13 +45,13 @@ def read_mpconfig(): return configs -def build_json(modules, configs): +def build_module_map(modules, configs): """ Establish the base of the JSON file, based on the contents from `configs`. Base will contain module names, if they're part of the `FULL_BUILD`, or their default value (0 | 1). """ - base_json = dict() + base = dict() full_build = False for module in modules: full_name = module @@ -67,22 +67,22 @@ def build_json(modules, configs): default_val = find_config.group(1) else: default_val = "None" - base_json[search_name] = { + base[search_name] = { "name": full_name, "full_build": str(full_build), "default_value": default_val, "excluded": [] } - return get_excluded_boards(base_json) + return get_excluded_boards(base) -def get_excluded_boards(base_json): +def get_excluded_boards(base): """ Cycles through each board's `mpconfigboard.mk` file to determine if each module is included or not. Boards are selected by existence in a port listed in `SUPPORTED_PORTS` (e.g. `/port/nrf/feather_52840`) """ - modules = list(base_json.keys()) + modules = list(base.keys()) for port in SUPPORTED_PORTS: port_dir = "ports/{}/boards".format(port) for entry in os.scandir(port_dir): @@ -97,8 +97,8 @@ def get_excluded_boards(base_json): # check if board uses `SMALL_BUILD`. if yes, and current # module is marked as `FULL_BUILD`, board is excluded small_build = re.search("CIRCUITPY_SMALL_BUILD = 1", contents) - if small_build and base_json[module]["full_build"] == "1": - base_json[module]["excluded"].append(entry.name) + if small_build and base[module]["full_build"] == "1": + base[module]["excluded"].append(entry.name) continue # check if module is specifically disabled for this board @@ -107,27 +107,19 @@ def get_excluded_boards(base_json): if not find_module: # check if default inclusion is off ('0'). if the board doesn't # have it explicitly enabled, its excluded. - if base_json[module]["default_value"] == "0": - base_json[module]["excluded"].append(entry.name) + if base[module]["default_value"] == "0": + base[module]["excluded"].append(entry.name) continue if (find_module.group(1) == "0" and - find_module.group(1) != base_json[module]["default_value"]): - base_json[module]["excluded"].append(entry.name) + find_module.group(1) != base[module]["default_value"]): + base[module]["excluded"].append(entry.name) - return base_json + return base -if __name__ == "__main__": + +def support_matrix(): modules = get_shared_bindings() configs = read_mpconfig() - base = build_json(sorted(modules), configs) - - final_json = json.dumps(base, indent=2) - - shared_bindings_json = 'support_matrix.json' - if 'TRAVIS' in os.environ: - shared_bindings_json = os.path.join(os.environ['HOME'], shared_bindings_json) - else: - print(final_json) - shared_bindings_json = os.path.join('shared-bindings', shared_bindings_json) - with open(shared_bindings_json, "w") as matrix: - json.dump(base, matrix, indent=2) + base = build_module_map(sorted(modules), configs) + + return base -- cgit v1.2.3 From 19e504f182e6498b06fbe4398a53f027e9b76088 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 27 Jul 2019 09:16:06 -0500 Subject: change conf.py to use modules-by-board --- conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'conf.py') diff --git a/conf.py b/conf.py index 0c23028ec..1e287e75e 100644 --- a/conf.py +++ b/conf.py @@ -32,7 +32,8 @@ master_doc = 'docs/index' # Grab the JSON values to use while building the module support matrix # in 'shared-bindings/index.rst' -modules_support_matrix = shared_bindings_matrix.support_matrix() +#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards() +modules_support_matrix = shared_bindings_matrix.support_matrix_by_board() html_context = { 'support_matrix': modules_support_matrix -- cgit v1.2.3 From d489c7a0579d13d29d42f29d6284cf51e57013d5 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 28 Jul 2019 15:59:26 -0500 Subject: change 'c2rst' from source_parser -> extension; allows use of sphinx 2.x --- conf.py | 6 +++--- docs/c2rst.py | 46 +++++++++++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 20 deletions(-) (limited to 'conf.py') diff --git a/conf.py b/conf.py index 7a00454e0..56625e758 100644 --- a/conf.py +++ b/conf.py @@ -54,7 +54,8 @@ extensions = [ 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', - 'rstjinja' + 'rstjinja', + 'c2rst' ] # Add any paths that contain templates here, relative to this directory. @@ -63,8 +64,7 @@ templates_path = ['templates'] # The suffix of source filenames. source_suffix = ['.rst', '.md', '.c', '.h'] -source_parsers = {'.md': CommonMarkParser, - '.c': "c2rst.CStrip", '.h': "c2rst.CStrip"} +source_parsers = {'.md': CommonMarkParser} # The encoding of source files. #source_encoding = 'utf-8-sig' diff --git a/docs/c2rst.py b/docs/c2rst.py index 904fb7408..76489dca3 100644 --- a/docs/c2rst.py +++ b/docs/c2rst.py @@ -1,19 +1,31 @@ -import sphinx.parsers +def c2rst(app, docname, source): + """ Pre-parse '.c' & '.h' files that contain rST source. + """ + # Make sure we're outputting HTML + if app.builder.format != 'html': + return -class CStrip(sphinx.parsers.Parser): - def __init__(self): - self.rst_parser = sphinx.parsers.RSTParser() + fname = app.env.doc2path(docname) + if (not fname.endswith(".c") and + not fname.endswith(".h")): + #print("skipping:", fname) + return - def parse(self, inputstring, document): - # This setting is missing starting with Sphinx 1.7.1 so we set it ourself. - document.settings.tab_width = 4 - document.settings.character_level_inline_markup = False - stripped = [] - for line in inputstring.split("\n"): - line = line.strip() - if line == "//|": - stripped.append("") - elif line.startswith("//| "): - stripped.append(line[len("//| "):]) - stripped = "\r\n".join(stripped) - self.rst_parser.parse(stripped, document) + src = source[0] + + stripped = [] + for line in src.split("\n"): + line = line.strip() + if line == "//|": + stripped.append("") + elif line.startswith("//| "): + stripped.append(line[len("//| "):]) + stripped = "\r\n".join(stripped) + + rendered = app.builder.templates.render_string( + stripped, app.config.html_context + ) + source[0] = rendered + +def setup(app): + app.connect("source-read", c2rst) -- cgit v1.2.3