feature: include from *pointer
authorVolker Birk <vb@pep-project.org>
Thu, 08 Apr 2021 15:17:25 +0200
changeset 74 c3c5a089072a
parent 73 483d99ba1b16
child 75 9e93c218b9be
feature: include from *pointer
features.en.yhtml2
heading.en.yhtml2
yml2/backend.py
yml2/grammar.py
--- a/features.en.yhtml2	Thu Apr 08 14:42:47 2021 +0200
+++ b/features.en.yhtml2	Thu Apr 08 15:17:25 2021 +0200
@@ -992,7 +992,7 @@
 
     Code | include reverse part*.yml2
 
-    p > If there are the files part1.yml, part2.yml and part3.yml, part3.yml is included first now.
+    p > If there are the files part1.yml2, part2.yml2 and part3.yml2, part3.yml2 is included first now.
 
     p > To include plain text as text nodes, you can use:
 
@@ -1002,6 +1002,13 @@
 
     Code | include xml some.xml
 
+    p > If there is a file mask or a filename in a pointer you can include indirectly:
+
+    Code    ||
+            declare files = "*.yml2"
+            include from *files
+            ||
+
     h2 id=python > Escaping into Python – the Escape Operator !
 
     p > You can insert a Python command at any place by using the «!» operator:
--- a/heading.en.yhtml2	Thu Apr 08 14:42:47 2021 +0200
+++ b/heading.en.yhtml2	Thu Apr 08 15:17:25 2021 +0200
@@ -13,7 +13,7 @@
 div id=headline {
     p > YML – Why a Markup Language?!
     div class=small {
-        "YML 2.6.3 of Thu 19 Mar 2020  –  Copyleft 2007-2020, "
+        "YML 2.7.0 of Thu 08 Apr 2021  –  Copyleft 2007-2021, "
         a "http://blog.fdik.org", "Volker Birk";
         " – "
         a "http://fdik.org/yml2.tar.bz2", "Download YML 2";
--- a/yml2/backend.py	Thu Apr 08 14:42:47 2021 +0200
+++ b/yml2/backend.py	Thu Apr 08 15:17:25 2021 +0200
@@ -1,4 +1,4 @@
-# 2.6.1 backend
+# 2.7.0 backend
 
 # written by VB.
 
@@ -734,7 +734,7 @@
                 filemask = arg
 
         if kpointer:
-            filemask = pointer(filemask)
+            filemask = eval(pointer(filemask))
 
         if filemask[0] == '/' or filemask[0] == '.':
             files = sorted(glob(filemask))
--- a/yml2/grammar.py	Thu Apr 08 14:42:47 2021 +0200
+++ b/yml2/grammar.py	Thu Apr 08 15:17:25 2021 +0200
@@ -79,7 +79,7 @@
 _decl = keyword("decl"), listing(decl), [";", "."]
 def textsection():  return r(r'(\|\|(\>*)(.*?)\|\|(\>*))\s*$', re.S | re.M)
 def textsectionu(): return r(r'(\>\>.*?\>\>)', re.S)
-def include():      return keyword("include"), 0, reverse, 0, [ktext, kxml], [(kpointer, pointer), filename], 0, [";", "."]
+def include():      return keyword("include"), 0, reverse, 0, [ktext, kxml], 0, kpointer, filename, 0, [";", "."]
 def func():         return _func, 0, content
 def funclist():     return listing(func)
 _cmd = funclist, 0, [";", "."]
@@ -106,5 +106,5 @@
 def reverse():      return keyword("reverse")
 def ktext():        return keyword("text")
 def kxml():         return keyword("xml")
-def kpointer():     return keyword("pointer")
+def kpointer():     return keyword("from")
 def ymlCStyle():    return -1, [_decl, in_ns, include, python, operator, constant, tagQuote, lineQuote, quote, _cmd]