]> wagnertech.de Git - mDoc.git/commitdiff
pydev-s6
authorMichael Wagner <michael@wagnertech.de>
Wed, 8 Dec 2021 17:30:49 +0000 (18:30 +0100)
committerMichael Wagner <michael@wagnertech.de>
Wed, 8 Dec 2021 17:30:49 +0000 (18:30 +0100)
Test/FitnessePages/MdocExtractor/content.txt
Test/etc/Testdocument.xml
doc/mdoc-extract.1
python/mDoc/mdoc/extractor.py

index dc80633ab5642f4cbceccd700e563be1d6acfb03..11cfc8d352c6840635a6c8c30893fd17a4dcbdfe 100644 (file)
@@ -5,6 +5,8 @@
 |call script|grep "cl1-Text" etc/Testdocument.tex|
 |call script|mdoc-extract etc/Testdocument.xml cl1.1|
 |call script|grep "cl1.1-Text" etc/Testdocument.tex|
+|call script|grep "cl1.1+cl2-Text" etc/Testdocument.tex|
 |call script|mdoc-extract etc/Testdocument.xml cl2|
 |call script|grep "cl2-Text" etc/Testdocument.tex|
+|call script|grep "cl1.1+cl2-Text" etc/Testdocument.tex|
 
index c72a967ce034de90b5872e17b33b2180232acea3..589a69f53618b0bd9296c9cfc3758b6032b7c177 100644 (file)
@@ -3,6 +3,7 @@
 <text include="cl1">cl1-Text</text>
 <text exclude="cl1">nicht cl1-text</text>
 <text include="cl1.1">cl1.1-Text</text>
+<text include="cl1.1:cl2">cl1.1+cl2-Text</text>
 <text exclude="cl1.1">nicht cl1.1-text</text>
 <text include="cl2">cl2-Text</text>
 <text exclude="cl2">nicht cl2-text</text>
index 2d9503467d8264b0fd754a24ee5fc17e531f37d7..75e9111c9b5d9d95a813a1af5df7c065226972f9 100644 (file)
@@ -1,6 +1,6 @@
 .\" Manpage for mdoc-extract.
 .\" Contact mail@wagnertech.de to correct errors or typos.
-.TH MDOC-EXTRACT 1 "27 Jan 2020" Linux "Linux Manual"
+.TH MDOC-EXTRACT 1 "08 Dez 2021" Linux "Linux Manual"
 .SH NAME
 mdoc-extract \- mdoc extraction tool
 .SH SYNOPSIS
@@ -15,7 +15,8 @@ or
 .I exclude
 tags. The value of these tags is the class name from which on this advise is valid. Advices are inherited 
 to subclasses. Subclasses are named by "base.sub". Advices for "base.sub" are valid for CLASS=base.sub, 
-CLASS=base.sub.subsub and so on, but not for CLASS=base.
+CLASS=base.sub.subsub and so on, but not for CLASS=base. There can also be more than one class in an advice.
+These classes are separated by ":".
 .TP
 \fBINPUT\fR
 Input xml file name
@@ -27,8 +28,8 @@ Input file is expected with this format:
 .nf
 <document>
   <text>This text is always used</text>
-  <text include="base.sub">This text appears only in "base.sub" 
-     and its subclasses</text>
+  <text include="base.sub:otherbase">This text appears only in "base.sub" 
+     and its subclasses as well as for "otherbase" and its subclasses.</text>
   <text exclude="base.sub">This text does not appear in "base.sub"
      and its subclasses</text>
 </document>
index 1b9b7be705d68685453d7cb34e0f21c493fca460..1f0fd9d814f793c7e84ac85bf0ec331d9227cc2e 100644 (file)
@@ -5,7 +5,6 @@ Created on 26.03.2021
 '''
 from mutil.XmlExtractor import XmlExtractor
 from mutil import XmlExtractor as XMLE
-from pickle import NONE, FALSE, TRUE
 
 def eval_class(classs, item):
     item_hira = item.split(".")
@@ -18,15 +17,22 @@ def eval_class(classs, item):
             return False,ilen
     return True,ilen
     
+def eval_attribute(classs, attribute):
+    for item in attribute.split(":"):
+        ret,ilen = eval_class(classs, item)
+        if ret:
+            return True,ilen
+    return False,ilen
+
 def is_for_print(classs, attrs):
     include = False
     exclude = False
     ilen    = 0
     elen    = 0
     if "include" in attrs:
-        include,ilen = eval_class(classs, attrs["include"])
+        include,ilen = eval_attribute(classs, attrs["include"])
     if "exclude" in attrs:
-        exclude,elen = eval_class(classs, attrs["exclude"])
+        exclude,elen = eval_attribute(classs, attrs["exclude"])
     if ilen > 0 and elen == 0:
         return include
     elif elen > 0 and ilen == 0: