Skip to content

Commit

Permalink
(SIMP-8609) Add compiler warning for wrong format (#398)
Browse files Browse the repository at this point in the history
The SIMP docs now prefer the forward slash delimiter to separate
Puppet modules' `org/name` references.  This patch adds a compiler
warning to the `:pupmod:` role to point out when the wrong format is
being used and shows the correct format.

[SIMP-8609] #comment :pupmod: role now warns on wrong delimiter

Co-authored-by: Trevor Vaughan <tvaughan@onyxpoint.com>
  • Loading branch information
op-ct and trevor-vaughan committed Oct 24, 2020
1 parent d12ac65 commit 424d68b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/_extensions/simp_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
if len(forge_names) == 2:
url = 'https://forge.puppet.com/%s/%s' % (forge_names[0], forge_names[1])
node = nodes.reference(rawtext, text, refuri=url, **options)
if re.search('-', text):
fixed_text = re.sub('-', '/', text)
print("WARNING: Use '/' to separate Puppet module names (.e.g., %s', not '%s')\n" % (fixed_text, text))
else:
node = nodes.inline(rawtext, text, **options)

Expand Down

0 comments on commit 424d68b

Please sign in to comment.