From cc019cff99afcf7a93de4bca22c19f996aa07937 Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Wed, 8 Dec 2021 18:30:49 +0100 Subject: [PATCH] pydev-s6 --- Test/FitnessePages/MdocExtractor/content.txt | 2 ++ Test/etc/Testdocument.xml | 1 + doc/mdoc-extract.1 | 9 +++++---- python/mDoc/mdoc/extractor.py | 12 +++++++++--- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Test/FitnessePages/MdocExtractor/content.txt b/Test/FitnessePages/MdocExtractor/content.txt index dc80633..11cfc8d 100644 --- a/Test/FitnessePages/MdocExtractor/content.txt +++ b/Test/FitnessePages/MdocExtractor/content.txt @@ -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| diff --git a/Test/etc/Testdocument.xml b/Test/etc/Testdocument.xml index c72a967..589a69f 100644 --- a/Test/etc/Testdocument.xml +++ b/Test/etc/Testdocument.xml @@ -3,6 +3,7 @@ cl1-Text nicht cl1-text cl1.1-Text +cl1.1+cl2-Text nicht cl1.1-text cl2-Text nicht cl2-text diff --git a/doc/mdoc-extract.1 b/doc/mdoc-extract.1 index 2d95034..75e9111 100644 --- a/doc/mdoc-extract.1 +++ b/doc/mdoc-extract.1 @@ -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 This text is always used - This text appears only in "base.sub" - and its subclasses + This text appears only in "base.sub" + and its subclasses as well as for "otherbase" and its subclasses. This text does not appear in "base.sub" and its subclasses diff --git a/python/mDoc/mdoc/extractor.py b/python/mDoc/mdoc/extractor.py index 1b9b7be..1f0fd9d 100644 --- a/python/mDoc/mdoc/extractor.py +++ b/python/mDoc/mdoc/extractor.py @@ -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: -- 2.20.1