|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
diff --git a/doc/include_anchors.py b/doc/include_anchors.py
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
--- a/doc/include_anchors.py
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+++ b/doc/include_anchors.py
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
@@ -13,12 +13,12 @@
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
import os
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
-pat1a = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.py\[\]')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
-pat1b = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.sh\[\]')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
-pat1c = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.h\[\]')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
-pat1d = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.cpp\[\]')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
-pat2 = re.compile('([^@]+)@([a-zA-Z0-9]+):')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
-pat3 = re.compile('([^@]+)@:([a-zA-Z0-9]+)')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+pat1a = re.compile(r'include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.py\[\]')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+pat1b = re.compile(r'include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.sh\[\]')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+pat1c = re.compile(r'include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.h\[\]')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+pat1d = re.compile(r'include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.cpp\[\]')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+pat2 = re.compile(r'([^@]+)@([a-zA-Z0-9]+):')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+pat3 = re.compile(r'([^@]+)@:([a-zA-Z0-9]+)')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
processed = set()
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
@@ -44,18 +44,18 @@
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
del anchors[anchor]
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
else:
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
for anchor in anchors:
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
- os.write(anchors[anchor].fileno(), line)
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+ os.write(anchors[anchor].fileno(), bytearray(line, 'utf-8'))
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
INPUT.close()
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
for anchor in anchors:
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
if anchor != '':
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
- print "ERROR: anchor '%s' did not terminate" % anchor
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+ print("ERROR: anchor '%s' did not terminate" % anchor)
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
anchors[anchor].close()
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
#
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
processed.add(bname)
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
for file in sys.argv[1:]:
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
- print "Processing file '%s' ..." % file
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+ print("Processing file '%s' ..." % file)
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
INPUT = open(file, 'r')
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
for line in INPUT:
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
suffix = None
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
@@ -82,8 +82,8 @@
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
#print "HERE", line, suffix
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
fname = m.group(1)+m.group(2)+'.'+suffix
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
if not os.path.exists(fname):
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
- print line
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
- print "ERROR: file '%s' does not exist!" % fname
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+ print(line)
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
+ print("ERROR: file '%s' does not exist!" % fname)
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
sys.exit(1)
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
process(m.group(1), m.group(2), suffix)
|
|
![](https://seccdn.libravatar.org/avatar/8330103627932ed137c83d1421736f0611b0a1efc8e30f8f788e77ee64afed95?s=16&d=retro) |
b289ab4 |
INPUT.close()
|