New dygraphs home page
[dygraphs.git] / docs / ssi.py
diff --git a/docs/ssi.py b/docs/ssi.py
new file mode 100644 (file)
index 0000000..d750a0d
--- /dev/null
@@ -0,0 +1,14 @@
+'''
+Shared code for ssi_server.py and ssi_expander.py.
+'''
+
+import re
+
+def InlineIncludes(path):
+  """Read a file, expanding <!-- #include --> statements."""
+  content = file(path).read()
+  content = re.sub(r'<!-- *#include *virtual=[\'"]([^\'"]+)[\'"] *-->',
+      lambda x: file(x.group(1)).read(),
+      content)
+  return content
+