Sha256: 62298280b28e1272322e14bcfdb75ec0ef18d528dd80bc284f04264b5eeebff3

Contents?: true

Size: 591 Bytes

Versions: 9

Compression:

Stored size: 591 Bytes

Contents

require 'erb'

# Proper escaping of IRIs
include ERB::Util

# Create a section block with the given file contents
def section id
  item = @items["/#{id.to_s}.*"]
  if not item
    raise "Could not find the file '" + id.to_s + "'"
  end
  <<-HTML
<section markdown="block">
#{item.raw_content}
</section>
  HTML
end

# Create a person block
def person name, website, profile
  if not website
    h name
  elsif not profile
    %{<a href="#{h website}">#{h name}</a>}
  else
    %{<a href="#{h website}" typeof="http://xmlns.com/foaf/0.1/Person" resource="#{profile}">#{h name}</a>}
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scholarmarkdown-2.2.0 lib/scholarmarkdown/snippets.rb
scholarmarkdown-2.1.0 lib/scholarmarkdown/snippets.rb
scholarmarkdown-2.0.0 lib/scholarmarkdown/snippets.rb
scholarmarkdown-1.4.0 lib/scholarmarkdown/snippets.rb
scholarmarkdown-1.3.1 lib/scholarmarkdown/snippets.rb
scholarmarkdown-1.3.0 lib/scholarmarkdown/snippets.rb
scholarmarkdown-1.2.0 lib/scholarmarkdown/snippets.rb
scholarmarkdown-1.1.0 lib/scholarmarkdown/snippets.rb
scholarmarkdown-1.0.0 lib/scholarmarkdown/snippets.rb