Closed lukaspie closed 8 months ago
Thanks for creating the issue.
This could be a regex to check the lines ^\s*term\: (.+)
, we can replace here spec
and url
respectively (for url we even could do a proper url check?). ~For [\t\f\v ]*$
something like [\s^\r\n]*$
might also work (not sure about the syntax though).~ I think just using \s*
is fine, because we split in lines anyways or even better don't use $ (edited the regex above and below).
Edit: This could be something for url (from here):
^\s*url\:\s+(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})
When using the new xref feature, I came across an edge case when adding the following docstring:
which is translated to
In this case, the problem is with the following line picking up
term:
in the url field and then not correctly reading the URL anymore. https://github.com/FAIRmat-NFDI/nexus_definitions/blob/1016aa054582323d44cfd215685639ef9d4605b8/dev_tools/nyaml2nxdl/nyaml2nxdl_forward_tools.py#L302Suggestion by @domna was to use regex for checking for
spec
,term
, andurl
. @mkuehbach also mentioned that first it should be checked thatxref
is present before we check for the three sub-keywords.Other edge cases:
spec
,term
,url
is present more than once in xref?dev_tools/tests/data/doc_yaml2nxdl.yaml
.