Compare commits

...

4 Commits

Author SHA1 Message Date
  Hartmut Goebel fb26ff989e yml2proc: Fix encoding error in debug output. 2 months ago
  Hartmut Goebel 018e3f10c5 yml2proc: Enhance help. 2 months ago
  Hartmut Goebel 1ff97ad284 Update URLs in setup.cfg. 2 months ago
  Hartmut Goebel e4bb883e8d Make "include" search relative file relative to include file. 2 months ago
3 changed files with 15 additions and 5 deletions
Split View
  1. +3
    -1
      setup.cfg
  2. +5
    -1
      yml2/backend.py
  3. +7
    -3
      yml2proc

+ 3
- 1
setup.cfg View File

@ -6,7 +6,9 @@ name = yml2
version = 2.7.0
author = Volker Birk
author_email = vb@pep-project.org
url = https://pep.foundation/dev/repos/yml2/
url = https://gitea.pep.foundation/fdik/yml2
project_urls =
Documentation = http://fdik.org/yml/
license = GPL v2
license_file = gpl-2.0.txt


+ 5
- 1
yml2/backend.py View File

@ -736,8 +736,12 @@ def codegen(obj):
if kpointer:
filemask = eval(pointer(filemask))
if filemask[0] == '/' or filemask[0] == '.':
if os.path.isabs(filemask):
files = sorted(glob(filemask))
elif filemask.startswith(os.curdir):
# by chance, this also strips the trailing line number
directory = os.path.dirname(line)
files = sorted(glob(os.path.join(directory, filemask)))
else:
files = []
for directory in includePath:


+ 7
- 3
yml2proc View File

@ -46,7 +46,9 @@ def main():
optParser.add_option("--debug", action="store_true", dest="trace",
help="switch on tracing to stderr", default=False)
optParser.add_option("-d", "--paramdict", dest="params", metavar="PARAMS",
help="call X/YSLT script with dictionary PARAMS as parameters")
help=("call X/YSLT script with dictionary PARAMS as parameters. "
"PARAMS is a Python expression which evaluates to a "
"Python dictionary."))
optParser.add_option("-e", "--xpath", dest="xpath", metavar="XPATH",
help="execute XPath expression XPATH and print result")
optParser.add_option("-E", "--encoding", dest="encoding", metavar="ENCODING", default=locale.getdefaultlocale()[1],
@ -66,7 +68,9 @@ def main():
optParser.add_option("-P", "--pretty", action="store_true", default=False,
help="pretty print output adding whitespace")
optParser.add_option("-s", "--stringparamdict", dest="stringparams", metavar="STRINGPARAMS",
help="call X/YSLT script with dictionary STRINGPARAMS as string parameters")
help=("call X/YSLT script with dictionary STRINGPARAMS as string "
"parameters. STRINGPARAMS is a Python expression which "
"evaluates to a Python dictionary. Values will get quoted."))
optParser.add_option("-x", "--xml", action="store_true", default=False,
help="input document is XML already")
optParser.add_option("-X", "--xslt", dest="xslt", metavar="XSLTSCRIPT",
@ -136,7 +140,7 @@ def main():
def ymldebug(context, text):
if options.trace:
sys.stderr.write("Debug: " + codecs.encode(u(text), options.encoding) + "\n")
print("Debug:", u(text), file=sys.stderr)
return ""
def ymlassert(context, value, msg):


Loading…
Cancel
Save