Sha256: 6ef0889aef29e5cd56f4dd1866092cfb87ba733077a1491b1dee3fcc2cf7a4cf

Contents?: true

Size: 1.75 KB

Versions: 7

Compression:

Stored size: 1.75 KB

Contents

# coding: utf-8

require "asciidoctor-bibliography"
require_relative "../../../citation_helper"

describe CiteProc::Ruby::Formats::Adoc do
  before { processor.import(BibTeX.open("spec/fixtures/database.bib").to_citeproc) }

  context "using apa citations" do
    let(:processor) { CiteProc::Processor.new(style: "apa", format: "adoc") }
    let(:year) { processor.engine.style.citation.children["layout"].children[0].children[1] }
    let(:rendered_citation) { processor.render(:citation, id: "Gettier63") }

    describe ".apply_font_style" do
      it "makes journal italic" do
        year["font-style"] = "italic"
        expect(rendered_citation).to eq("(Gettier, _1963_)")
      end
    end

    describe ".apply_font_weight" do
      it "makes journal bold" do
        year["font-weight"] = "bold"
        expect(rendered_citation).to eq("(Gettier, *1963*)")
      end
    end

    describe ".apply_vertical_align" do
      it "makes journal supscript " do
        year["vertical-align"] = "sup"
        expect(rendered_citation).to eq("(Gettier, ^1963^)")
      end

      it "makes journal subscript " do
        year["vertical-align"] = "sub"
        expect(rendered_citation).to eq("(Gettier, ~1963~)")
      end
    end
  end

  context "using ieee bibliography" do
    let(:processor) { CiteProc::Processor.new(style: "ieee", format: "adoc") }
    let(:rendered_bibliography) { processor.render(:bibliography, id: "Gettier63").first }

    describe ".apply_suffix" do
      before { processor.import(BibTeX.open("spec/fixtures/database.bib").to_citeproc) }
      it "adds space between first and second field" do
        processor.items["Gettier63"].merge("citation-number": "0")
        expect(rendered_bibliography).to match(/^\[0\] E. L. Gettier/)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
asciidoctor-bibliography-0.11.0 spec/citeproc/ruby/formats/adoc_spec.rb
asciidoctor-bibliography-0.10.3 spec/citeproc/ruby/formats/adoc_spec.rb
asciidoctor-bibliography-0.10.2 spec/citeproc/ruby/formats/adoc_spec.rb
asciidoctor-bibliography-0.10.1 spec/citeproc/ruby/formats/adoc_spec.rb
asciidoctor-bibliography-0.10.0 spec/citeproc/ruby/formats/adoc_spec.rb
asciidoctor-bibliography-0.9.2 spec/citeproc/ruby/formats/adoc_spec.rb
asciidoctor-bibliography-0.9.1 spec/citeproc/ruby/formats/adoc_spec.rb