[augeas-devel] [PATCH 5/6] Update httpd and xml lens according to square args

Francis Giraldeau francis.giraldeau at gmail.com
Sun Aug 12 21:37:21 UTC 2012


---
 lenses/httpd.aug |    6 ++++--
 lenses/xml.aug   |    8 ++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lenses/httpd.aug b/lenses/httpd.aug
index 49456a1..caea9b6 100644
--- a/lenses/httpd.aug
+++ b/lenses/httpd.aug
@@ -77,9 +77,11 @@ let directive = [ indent . label "directive" . store word .
                   (sep_spc . argv arg_dir)? . eol ]
 
 let section (body:lens) =
-    let h = (sep_spc . argv arg_sec)? . sep_osp .
+    let inner = (sep_spc . argv arg_sec)? . sep_osp .
              dels ">" . eol . body* . indent . dels "</" in
-        [ indent . dels "<" . square word h . del ">" ">" . eol ]
+    let kword = key word in
+    let dword = del word "a" in
+        [ indent . dels "<" . square kword inner dword . del ">" ">" . eol ]
 
 let rec content = section (content|directive|comment|empty)
 
diff --git a/lenses/xml.aug b/lenses/xml.aug
index 6bcbb54..50b1712 100644
--- a/lenses/xml.aug
+++ b/lenses/xml.aug
@@ -109,11 +109,15 @@ let text      = [ label "#text" . store text_re ]
 let cdata     = [ label "#CDATA" . dels "<![CDATA[" .
                   store (char* - (char* . "]]>" . char*)) . dels "]]>" ]
 
+(* the value of nmtoken_del is always the nmtoken_key string *)
+let nmtoken_key = key nmtoken
+let nmtoken_del = del nmtoken "a"
+
 let element (body:lens) =
     let h = attributes? . sep_osp . dels ">" . body* . dels "</" in
-        [ dels "<" . square nmtoken h . sep_osp . del_end ]
+        [ dels "<" . square nmtoken_key h nmtoken_del . sep_osp . del_end ]
 
-let empty_element = [ dels "<" . key nmtoken . value "#empty" .
+let empty_element = [ dels "<" . nmtoken_key . value "#empty" .
                       attributes? . sep_osp . del /\/>[\r?\n]?/ "/>\n" ]
 
 let pi_instruction = [ dels "<?" . label "#pi" .
-- 
1.7.9.5




More information about the augeas-devel mailing list