puppetlabs / puppet-strings

The next generation Puppet documentation extraction and presentation tool.
http://puppetlabs.github.io/puppet-strings/
Apache License 2.0
90 stars 84 forks source link

none unique anchors #341

Closed b4ldr closed 1 year ago

b4ldr commented 1 year ago

Describe the Bug

While adding some type definitions to stdlib it was noticed that puppet-strings generates the same anchore for thge following two types

Stdlib::Httpstatus
Stdlib::Http::Status

This seems to be because strings does something equivalent to the following

anchor =- @type.tr(':', '').downcase

i think it would be better to replace the '::' with something like '__' to keep the anchors unique

Expected Behaviour

All types should have unique anchors

Steps to Reproduce

create the following two types and run puppet strings

@summary some documentation 
Stdlib::Httpstatus = String
@summary some other documentation 
Stdlib::Http::Status = String
ekohl commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a states name is deprecated:

Was required to define a possible target location in a page. In HTML 4.01, id and name could both be used on , as long as they had identical values.

Note: Use the global attribute id instead.

Then https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id states:

Note: Technically, the value for an id attribute may contain any character, except whitespace characters. However, to avoid inadvertent errors, only ASCII letters, digits, '_', and '-' should be used and the value for an id attribute should start with a letter. For example, . has a special meaning in CSS (it acts as a class selector). Unless you are careful to escape it in the CSS, it won't be recognized as part of the value of an id attribute. It is easy to forget to do this, resulting in bugs in your code that could be hard to detect.

Given - is invalid in a Puppet type alias I'd recommend to use that instead of :.

b4ldr commented 1 year ago

this is a duplicate of #300 and fixed in #303 @ekohl should we create a separate bug for the id vs name issue