Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DAL] Fix term warnings #160

Merged
merged 2 commits into from Jun 4, 2020
Merged

[DAL] Fix term warnings #160

merged 2 commits into from Jun 4, 2020

Conversation

rlnx
Copy link
Contributor

@rlnx rlnx commented Jun 2, 2020

Fix #147 with the help of custom Sphinx role:

_term_ref_re = re.compile(r'(.+)<(.+)>', flags=re.DOTALL)
def capterm_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
    xref_role = roles.XRefRole(innernodeclass=nodes.inline,
                               warn_dangling=True)
    term_match = _term_ref_re.match(text)
    if term_match:
        txt, ref = term_match.group(1), term_match.group(2)
    else:
        txt, ref = text, text
    fixed_term = f'{txt.strip()} <{ref.strip().capitalize()}>'
    return xref_role('std:term', rawtext, fixed_term, lineno, inliner, options, content)

Results:

  • The produced output does not contain capitalized references.
  • Sphinx does not generate warnings during the build.
  • Less code: :term:`feature <Feature>` -> :capterm:`feature`

@rlnx rlnx added the DAL label Jun 2, 2020
@rlnx rlnx added this to the 0.9 release milestone Jun 2, 2020
@rlnx rlnx mentioned this pull request Jun 2, 2020
Copy link
Contributor

@michael-smirnov michael-smirnov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rlnx rlnx merged commit 11c1291 into uxlfoundation:master Jun 4, 2020
akukanov pushed a commit to akukanov/oneapi-spec that referenced this pull request Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[oneDAL] Glossary produces a lot of warnings
2 participants