Sha256: 1df7e7370cd0e11620fcd734e296fd75384c968c749dcc200837ad1262cba5cb

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

# Define a filter for adding Dokieli annotations
Nanoc::Filter.define(:scholar_dokieli) do |content, params|
  content = content.dup

  # Add Dokieli scripts at the end of the <head>
  content.gsub! %r{\<\/head\>} do |match|
    <<-HTML
  <link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" rel="stylesheet" />
  <link href="https://dokie.li/media/css/do.css" media="all" rel="stylesheet" />
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" media="all" rel="stylesheet" />
  <script src="https://dokie.li/scripts/simplerdf.js"></script>
  <script src="https://dokie.li/scripts/medium-editor.min.js"></script>
  <script src="https://dokie.li/scripts/medium-editor-tables.min.js"></script>
  <script src="https://dokie.li/scripts/do.js"></script>
</head>
    HTML
  end
  
  # Add Dokieli actions at the end of the <header>
  content.gsub! %r{\<\/header\>} do |match|
    <<-HTML
  <section class="actions">
    <h2 id="notifications-and-annotations">Notifications and annotations</h2>
    <ul>
      <li><a href="#{params[:notifications]}" rel="ldp:inbox">notification inbox</a></li>
      <li><a href="#{params[:annotations]}" rel="oa:annotationService">annotation service</a></li>
    </ul>
  </section>
</header>
    HTML
  end
  
  content
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scholarmarkdown-1.4.0 lib/scholarmarkdown/filter/dokieli.rb
scholarmarkdown-1.3.1 lib/scholarmarkdown/filter/dokieli.rb
scholarmarkdown-1.3.0 lib/scholarmarkdown/filter/dokieli.rb
scholarmarkdown-1.2.0 lib/scholarmarkdown/filter/dokieli.rb
scholarmarkdown-1.1.0 lib/scholarmarkdown/filter/dokieli.rb