summaryrefslogtreecommitdiff
path: root/docs/_ext
diff options
context:
space:
mode:
authorrebortg <github@ghlr.de>2020-11-23 19:25:17 +0100
committerrebortg <github@ghlr.de>2020-11-23 19:25:17 +0100
commit45ddcdc8132fd59032d4fb204f509e4aab8031f7 (patch)
treeefbf2e7beedf3a6a07173d8fc27be698e94ebb81 /docs/_ext
parentc8e751e4d2a8e0b27966814e8a2f2133d092f6a8 (diff)
downloadvyos-documentation-45ddcdc8132fd59032d4fb204f509e4aab8031f7.tar.gz
vyos-documentation-45ddcdc8132fd59032d4fb204f509e4aab8031f7.zip
cmdinclude: fix leading spaces
Diffstat (limited to 'docs/_ext')
-rw-r--r--docs/_ext/vyos.py28
1 files changed, 8 insertions, 20 deletions
diff --git a/docs/_ext/vyos.py b/docs/_ext/vyos.py
index e42d4cf0..4001f0fe 100644
--- a/docs/_ext/vyos.py
+++ b/docs/_ext/vyos.py
@@ -277,27 +277,15 @@ class CfgInclude(Directive):
return codeblock.run()
new_include_lines = []
- var_value0 = self.options.get('var0', '')
- var_value1 = self.options.get('var1', '')
- var_value2 = self.options.get('var2', '')
- var_value3 = self.options.get('var3', '')
- var_value4 = self.options.get('var4', '')
- var_value5 = self.options.get('var5', '')
- var_value6 = self.options.get('var6', '')
- var_value7 = self.options.get('var7', '')
- var_value8 = self.options.get('var8', '')
- var_value9 = self.options.get('var9', '')
+
for line in include_lines:
- line = re.sub('{{\s?var0\s?}}',var_value0,line)
- line = re.sub('{{\s?var1\s?}}',var_value1,line)
- line = re.sub('{{\s?var2\s?}}',var_value2,line)
- line = re.sub('{{\s?var3\s?}}',var_value3,line)
- line = re.sub('{{\s?var4\s?}}',var_value4,line)
- line = re.sub('{{\s?var5\s?}}',var_value5,line)
- line = re.sub('{{\s?var6\s?}}',var_value6,line)
- line = re.sub('{{\s?var7\s?}}',var_value7,line)
- line = re.sub('{{\s?var8\s?}}',var_value8,line)
- line = re.sub('{{\s?var9\s?}}',var_value9,line)
+ for i in range(10):
+ value = self.options.get(f'var{i}','')
+ if value == '':
+ line = re.sub('\s?{{\s?var' + str(i) + '\s?}}',value,line)
+ else:
+ line = re.sub('{{\s?var' + str(i) + '\s?}}',value,line)
+
new_include_lines.append(line)
self.state_machine.insert_input(new_include_lines, path)
return []