From c0e665eb67dd09f20ad2e4751432ee593ce525ae Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 1 Dec 2014 18:12:22 +0100 Subject: [PATCH] only match sections at top level --- pandora/app/documentation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora/app/documentation.py b/pandora/app/documentation.py index e189f230..a5d7d020 100644 --- a/pandora/app/documentation.py +++ b/pandora/app/documentation.py @@ -31,10 +31,10 @@ def update(config_jsonc='config.jsonc', base='config.pandora.jsonc'): current_docs = get(config_jsonc) for key in docs: if key in current_docs: - match = re.escape(' '+docs[key]) + '\W+"' + re.escape(key) + '":' + match = '\n' + re.escape(' '+docs[key]) + '\W+"' + re.escape(key) + '":' else: - match = ' "' + re.escape(key) + '":' - data = re.sub(match, ' %s\n "%s":' % (docs[key], key), data) + match = '\n "' + re.escape(key) + '":' + data = re.sub(match, '\n %s\n "%s":' % (docs[key], key), data) if data != config: print('updating config documentation', config_jsonc) with open('%s' % config_jsonc, 'wb') as fd: