From 42c38c4a96fd85e492d88a270a531df6e0065894 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Fri, 22 Dec 2017 23:50:30 +0100 Subject: [PATCH] docs: add refs to port titles, fix readme files --- doc/manual/ports2markdown.py | 24 ++++++++++++++--------- port/posix-h4-atwilc3000/README.md | 4 ++-- port/samv71-xplained-atwilc3000/README.md | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/doc/manual/ports2markdown.py b/doc/manual/ports2markdown.py index 5cd2b383c..e84a20348 100755 --- a/doc/manual/ports2markdown.py +++ b/doc/manual/ports2markdown.py @@ -6,8 +6,8 @@ import fnmatch blacklist = [] -example_item = """ - - [PORT_TITLE](#sec:PORT_LABELPort): PORT_PATH""" +port_item = """ +- [PORT_TITLE](#sec:PORT_LABELPort)""" def get_readme_title(example_path): title = '' @@ -39,11 +39,11 @@ def process_readmes(intro_file, ports_folder, ports_file): for readme_dir, readme_file in matches.items(): with open(readme_file, 'rb') as fin: for line in fin: - #increase level of indetation - parts = re.match('(#\s+)(.*)\n',line) - if parts: - title = parts.group(2) - ports.write(example_item.replace("PORT_TITLE", title).replace("PORT_PATH", readme_file).replace("PORT_LABEL", readme_dir)) + # find title, add reference + title_parts = re.match('(#\s+)(.*)\n',line) + if title_parts: + title = title_parts.group(2) + ports.write(port_item.replace("PORT_TITLE", title).replace("PORT_LABEL", readme_dir)) break fin.close() ports.write("\n\n") @@ -52,11 +52,17 @@ def process_readmes(intro_file, ports_folder, ports_file): with open(readme_file, 'rb') as fin: for line in fin: #increase level of indetation - parts = re.match('#(.*\n)',line) + parts = re.match('#(.*)\n',line) + title_parts = re.match('(#\s+)(.*)\n',line) if parts: - ports.write("#" + line + "{#sec:"+ readme_dir + "Port}") + if title_parts: + ports.write("#" + title_parts.group(2) + " {" + "#sec:" + readme_dir + "Port}\n" ) + else: + ports.write("#" + line) else: ports.write(line) + + fin.close() ports.close() diff --git a/port/posix-h4-atwilc3000/README.md b/port/posix-h4-atwilc3000/README.md index 8dbb257e9..25d5268c9 100644 --- a/port/posix-h4-atwilc3000/README.md +++ b/port/posix-h4-atwilc3000/README.md @@ -2,13 +2,13 @@ This port allows to use the ATWILC3000 connected via UART with BTstack running on a POSIX host system, see test setup below (which lacks a proper RESET button). -# Compilation +## Compilation $ make The Makefile downloads the wilc3000_bt_firmware.bin firmware from the [GitHub atwilc3000/firmware](https://github.com/atwilc3000/firmware) repo. -# Usage +## Usage Just run any of the provided examples, e.g. diff --git a/port/samv71-xplained-atwilc3000/README.md b/port/samv71-xplained-atwilc3000/README.md index df3311ee2..2b280bf6d 100644 --- a/port/samv71-xplained-atwilc3000/README.md +++ b/port/samv71-xplained-atwilc3000/README.md @@ -8,7 +8,7 @@ To create all example projects in the example folder, you can run: $ make -# Compile Example +## Compile Example In one of the example folders: