Sha256: e99a512fcfaa2b5e06fb1860df9a759eb77d816fc515a52bfaa6a59b2b9f3a07

Contents?: true

Size: 697 Bytes

Versions: 2

Compression:

Stored size: 697 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
  # Add person to global list of authors
  unless $authors
    $authors = []
  end
  $authors.push(name)

  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

2 entries across 2 versions & 1 rubygems

Version Path
scholarmarkdown-2.4.0 lib/scholarmarkdown/snippets.rb
scholarmarkdown-2.3.0 lib/scholarmarkdown/snippets.rb