changeset 1579:aba122ac2d40 dockerise

Attempt (currently failing) to fix up the bibliography plugin for current version of citeproc
author Chris Cannam
date Fri, 04 Aug 2017 17:51:19 +0100
parents 06ca2df3d7ca
children fa3d9c22497c
files Gemfile extra/soundsoftware/vagranttest/provision.d/000-apt.sh plugins/redmine_bibliography/Gemfile plugins/redmine_bibliography/app/models/publication.rb
diffstat 4 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Gemfile	Fri Aug 04 15:43:03 2017 +0100
+++ b/Gemfile	Fri Aug 04 17:51:19 2017 +0100
@@ -9,10 +9,6 @@
 gem "mime-types"
 gem "awesome_nested_set", "2.1.6"
 
-#cc -- CiteProc v1.0.0 broke our citations (CiteProc.process returns nil).
-# Until I've managed to work out what's up and fix that...
-gem "citeproc", "0.0.6"
-
 # Optional gem for LDAP authentication
 group :ldap do
   gem "net-ldap", "~> 0.3.1"
--- a/extra/soundsoftware/vagranttest/provision.d/000-apt.sh	Fri Aug 04 15:43:03 2017 +0100
+++ b/extra/soundsoftware/vagranttest/provision.d/000-apt.sh	Fri Aug 04 17:51:19 2017 +0100
@@ -4,6 +4,7 @@
 
 apt-get update && \
     apt-get install -y \
+    ack-grep \
     apache2 \
     apache2-dev \
     apt-utils \
--- a/plugins/redmine_bibliography/Gemfile	Fri Aug 04 15:43:03 2017 +0100
+++ b/plugins/redmine_bibliography/Gemfile	Fri Aug 04 17:51:19 2017 +0100
@@ -1,3 +1,5 @@
 gem 'bibtex-ruby'
 gem 'nokogiri'
-gem 'citeproc-ruby'
\ No newline at end of file
+gem 'citeproc'
+gem 'citeproc-ruby'
+gem 'csl-styles'
--- a/plugins/redmine_bibliography/app/models/publication.rb	Fri Aug 04 15:43:03 2017 +0100
+++ b/plugins/redmine_bibliography/app/models/publication.rb	Fri Aug 04 17:51:19 2017 +0100
@@ -101,7 +101,17 @@
     end
 
     if style == :ieee
-      CiteProc.process(bib.to_citeproc, :style => :ieee, :format => :html)
+      citeproc = bib.to_citeproc
+      cite_id = citeproc["id"]
+      #!!! These warns should go once I've figured out why it's not rendering!
+      logger.warn { "rendering citation #{citeproc} with id #{ cite_id }" }
+      cp = CiteProc::Processor.new style: 'ieee', format: 'html'
+      cp.import citeproc
+      cp.render :bibliography, id: cite_id
+      logger.warn { "rendered" }
+      result
+
+#      CiteProc.process(bib.to_citeproc, :style => :ieee, :format => :html)
     else
       bibtex = bib.to_s :include => :meta_content
       bibtex.strip!