Sha256: bc4ad9bfbe7f323d1848b995bfc9c955d66f4ac6148e0646ba8aca8acade32f7

Contents?: true

Size: 1017 Bytes

Versions: 13

Compression:

Stored size: 1017 Bytes

Contents

require 'erb'

# Proper escaping of IRIs
include ERB::Util

# Create a section block with the given file contents
def section id, classes = nil
  section_suffix=''
  if classes
    section_suffix=" class=\"" + classes + "\""
  end
  item = @items["/#{id.to_s}.*"]
  if not item
    raise "Could not find the file '" + id.to_s + "'"
  end
  <<-HTML
<section #{section_suffix}>
<div datatype="rdf:HTML" property="schema:description" markdown="block">
#{item.raw_content}
</div>
</section>
  HTML
end

# Create a person block
def person name, website, profile, mainAuthor = true
  if mainAuthor
    # Add person to global list of authors
    unless $authors
      $authors = []
    end
    $authors.push(name)
  end

  if not website
    h name
  elsif not profile
    %{<a href="#{h website}">#{h name}</a>}
  else
    %{<a rev="lsc:participatesIn" property="foaf:maker schema:creator schema:author schema:publisher" href="#{h website}" typeof="foaf:Person schema:Person" resource="#{profile}">#{h name}</a>}
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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