Class: PrmGenerator::LinkResolver

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/udb/prm_generator.rb

Overview

Handles link resolution for cross-references

Class Method Summary collapse

Class Method Details

.resolve(processor_config, content) ⇒ Object



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/udb/prm_generator.rb', line 353

def self.resolve(processor_config, content)
  return "" unless content.is_a?(String)

  # Resolve %%LINK%...%% and %%UDB_DOC_LINK%...%% markup
  content = content.gsub(/%%(UDB_DOC_LINK|LINK)%([^;%]+)\s*;\s*([^;%]+)\s*;\s*([^%]+)%%/) do
    type = $2.strip
    name = $3.strip
    link_text = $4.strip

    create_asciidoc_link(type, name, link_text)
  end

  # Use processor config's link resolver if available
  if processor_config.respond_to?(:find_replace_links)
    content = processor_config.find_replace_links(content)
  end

  content
end