[master] 54e060c Move vcl_var.rst, use sane variable name for fp.

Lasse Karstensen lkarsten at varnish-software.com
Fri Mar 21 15:09:48 CET 2014


commit 54e060c6542fe1109b7f893cc259065f7c21e596
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date:   Fri Mar 21 15:03:02 2014 +0100

    Move vcl_var.rst, use sane variable name for fp.
    
    Generated RST file should live in include/ like the others, not in reference/.
    
    Try to make the code slightly more readable through a descriptive variable name
    for the file handle.

diff --git a/.gitignore b/.gitignore
index a37080a..ba64e39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -95,7 +95,7 @@ cscope.*out
 /doc/*.html
 /doc/sphinx/build/
 /doc/sphinx/conf.py
-/doc/sphinx/reference/vcl_var.rst
+/doc/sphinx/include/vcl_var.rst
 
 # NetBeans insists on this
 /nbproject/private/
diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst
index c71577b..1268920 100644
--- a/doc/sphinx/reference/vcl.rst
+++ b/doc/sphinx/reference/vcl.rst
@@ -344,7 +344,7 @@ In VCL you have access to certain variable objects. These contain
 requests and responses currently being worked on. What variables are
 available depends on context.
 
-.. include:: vcl_var.rst
+.. include:: ../include/vcl_var.rst
 
 
 Functions
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index 84e363d..95c32eb 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -1131,7 +1131,7 @@ fo.close
 
 #######################################################################
 
-fo = open(buildroot + "/doc/sphinx/reference/vcl_var.rst", "w")
+fp_vclvar = open(buildroot + "/doc/sphinx/include/vcl_var.rst", "w")
 
 l = list()
 for i in sp_variables:
@@ -1164,14 +1164,14 @@ hdr=""
 for i in l:
 	j = i[0].split(".")
 	if j[0] != hdr:
-		fo.write("\n" + j[0] + "\n")
-		fo.write("~" * len(j[0]) + "\n")
+		fp_vclvar.write("\n" + j[0] + "\n")
+		fp_vclvar.write("~" * len(j[0]) + "\n")
 		hdr = j[0]
-	fo.write("\n" + i[0] + "\n\n")
-	fo.write("\tType: " + i[1] + "\n\n")
-	rst_where(fo, "Readable from: ", i[2])
-	rst_where(fo, "Writable from: ", i[3])
+	fp_vclvar.write("\n" + i[0] + "\n\n")
+	fp_vclvar.write("\tType: " + i[1] + "\n\n")
+	rst_where(fp_vclvar, "Readable from: ", i[2])
+	rst_where(fp_vclvar, "Writable from: ", i[3])
 	for j in i[4].split("\n"):
-		fo.write("\t" + j.strip() + "\n")
+		fp_vclvar.write("\t%s\n" % j.strip())
 
-fo.close()
+fp_vclvar.close()



More information about the varnish-commit mailing list