Sha256: 5eb04e5cafc913fc7638fbd330099fdbcce52c36f41a87eea146babb5b1b6426

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe Bergamasco::Pandoc do
  subject { Bergamasco::Pandoc }

  it 'should convert markdown' do
    filepath = fixture_path + 'cool-dois.html.md'
    file = IO.read(filepath)
    html = subject.convert(file, skip_yaml_header: true, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.yaml')
    expect(html).to start_with("<p>In 1998 Tim Berners-Lee coined the term cool URIs <span class=\"citation\">(1998)</span>, that is URIs that don’t change.")
  end

  it 'should convert to jats' do
    filepath = fixture_path + 'cool-dois.html.md'
    file = IO.read(filepath)
    xml = subject.convert_to_jats(file, skip_yaml_header: true, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.yaml')
    doc = Nokogiri::XML(xml)
    article_id = doc.at_xpath("//article-id")
    expect(article_id.text).to eq("10.5072/0000-03VC")
    expect(article_id.values.first).to eq("doi")
  end

  it 'should write bibliography to yaml' do
    bib_path = fixture_path + 'references.bib'
    yaml_path = fixture_path + 'references.yaml'
    yaml = subject.write_bibliograpy_to_yaml(bib_path, yaml_path)
    expect(yaml["references"].length).to eq(61)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bergamasco-0.3.17 spec/pandoc_spec.rb
bergamasco-0.3.16 spec/pandoc_spec.rb
bergamasco-0.3.15 spec/pandoc_spec.rb
bergamasco-0.3.14 spec/pandoc_spec.rb
bergamasco-0.3.13 spec/pandoc_spec.rb
bergamasco-0.3.12 spec/pandoc_spec.rb
bergamasco-0.3.11 spec/pandoc_spec.rb
bergamasco-0.3.10 spec/pandoc_spec.rb
bergamasco-0.3.9 spec/pandoc_spec.rb