Sha256: ba3df1b57396803f9e30e8a3ec8870828f080536b3a15312084ba9489197f69f

Contents?: true

Size: 456 Bytes

Versions: 13

Compression:

Stored size: 456 Bytes

Contents

# Moves IDs on headings to their parent section
Nanoc::Filter.define(:scholar_headerids_to_section) do |content|
  content = content.dup
  content.gsub! /<section>(\s*)(<div[^>]*>)(\s*)(<h\d[^>]*)\sid="([^\s>]+)"([^>]*)>/ do |_|
    match = Regexp.last_match
    "<section id=\"#{match[5]}\" inlist=\"\" rel=\"schema:hasPart\" resource=\"##{match[5]}\">#{match[1]}#{match[2]}#{match[3]}#{match[4]} property=\"schema:name\"#{match[6]}>"
  end
  content
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
scholarmarkdown-3.3.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-3.2.1 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-3.2.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-3.1.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-3.0.1 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-3.0.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-2.11.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-2.10.1 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-2.10.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-2.9.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-2.8.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-2.7.0 lib/scholarmarkdown/filter/headerids_to_section.rb
scholarmarkdown-2.6.0 lib/scholarmarkdown/filter/headerids_to_section.rb