Method: IsoDoc::PresentationXMLConvert#eref_url

Defined in:
lib/isodoc/presentation_function/erefs.rb

#eref_url(id) ⇒ Object



245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/isodoc/presentation_function/erefs.rb', line 245

def eref_url(id)
  b = eref_url_prep(id) or return nil
  %i(attachment citation).each do |x|
    u = b.at(ns("./uri[@type = '#{x}'][@language = '#{@lang}']")) ||
      b.at(ns("./uri[@type = '#{x}']")) and return { link: u.text, type: x }
  end
  if b["hidden"] == "true"
    u = b.at(ns("./uri")) or return nil
    { link: u.text, type: :citation }
  else { link: "##{id}", type: :anchor }
  end
end