From 28181e692501a2c52c4e06c97e19324a7cb97f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Tue, 18 Jan 2022 15:32:11 +0100 Subject: [PATCH] Use PageRange package to interprete the \excludecolumns command in the input file (allow printer range syntax) --- tools/lib/dfbOptions.py | 7 ++++--- tools/requirements.txt | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/lib/dfbOptions.py b/tools/lib/dfbOptions.py index 755e5199..c390361b 100644 --- a/tools/lib/dfbOptions.py +++ b/tools/lib/dfbOptions.py @@ -2,6 +2,7 @@ from TexSoup import TexSoup,TexCmd from . import formats from .data import dataFileBase,DataType, method, state, exSet from collections import defaultdict +from pagerange import PageRange class dfbOptions(object): def __init__(self): @@ -96,7 +97,7 @@ class dfbOptions(object): for node in dfbexcludeColumnsNodes: excludeColumns=node.expr if type(excludeColumns) is TexCmd: - commas_string=excludeColumns.args[0].value - ints=[int(x.strip()) for x in commas_string.split(",")] - dfb_Opt.excludeColumns.update(ints) + range_string=excludeColumns.args[0].value + PageRangeParser=PageRange(range_string) + dfb_Opt.excludeColumns.update(PageRangeParser.pages) return dfb_Opt \ No newline at end of file diff --git a/tools/requirements.txt b/tools/requirements.txt index ee7ea037..96bcf842 100644 --- a/tools/requirements.txt +++ b/tools/requirements.txt @@ -3,3 +3,4 @@ numpy>=1.18.3,<1.20 GitPython>=3.1.14 PyYAML>=5.3.1 TexSoup==0.2.1 +PageRange>=0.4 \ No newline at end of file