Module: PuppetStrings::Yard::Util
- Defined in:
- lib/puppet-strings/yard/util.rb
Overview
The module for various puppet-strings utility helpers.
Class Method Summary collapse
-
.github_to_yard_links(data) ⇒ String
hacksville, usa YARD creates ids in the html with with the style of “label-Module+description”, where the markdown we use in the README involves the GitHub-style, which is #module-description.
-
.scrub_string(str) ⇒ String
Trims indentation from trailing whitespace and removes ruby literal quotation syntax ‘%Q{}` and `%q` from parsed strings.
Class Method Details
.github_to_yard_links(data) ⇒ String
hacksville, usa YARD creates ids in the html with with the style of “label-Module+description”, where the markdown we use in the README involves the GitHub-style, which is #module-description. This takes our GitHub-style links and converts them to reference the YARD-style ids.
25 26 27 28 29 30 |
# File 'lib/puppet-strings/yard/util.rb', line 25 def self.github_to_yard_links(data) data.scan(/href\=\"\#(.+)\"/).each do |bad_link| data.gsub!("=\"##{bad_link.first}\"", "=\"#label-#{bad_link.first.capitalize.gsub('-', '+')}\"") end data end |
.scrub_string(str) ⇒ String
Trims indentation from trailing whitespace and removes ruby literal quotation syntax ‘%Q{}` and `%q` from parsed strings.
9 10 11 12 13 14 15 16 |
# File 'lib/puppet-strings/yard/util.rb', line 9 def self.scrub_string(str) match = str.match(/^%[Qq]{(.*)}$/m) if match return Puppet::Util::Docs.scrub(match[1]) end Puppet::Util::Docs.scrub(str) end |