• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 00dbc10b-d747-4ad7-b211-7b26d753abbb

14 Aug 2025 01:25PM UTC coverage: 0.483% (-94.9%) from 95.343%
00dbc10b-d747-4ad7-b211-7b26d753abbb

push

circleci

web-flow
Merge pull request #5181 from pulibrary/dependabot/bundler/activestorage-7.2.2.2

Bump activestorage from 7.2.2.1 to 7.2.2.2

47 of 9721 relevant lines covered (0.48%)

0.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/models/concerns/blacklight/document/cite_proc.rb
1
# frozen_string_literal: true
2

3
## Adds the methods needed for CiteProc citations,
4
# Including MLA, APA, and Chicago
5
module Blacklight::Document::CiteProc
×
6
  private
×
7

8
    def properties
×
9
      props = {}
×
10
      props[:id] = id
×
11
      props[:edition] = cite_proc_edition if cite_proc_edition
×
12
      props[:type] = cite_proc_type if cite_proc_type
×
13
      props[:author] = cite_proc_authors if cite_proc_authors
×
14
      props[:title] = cite_proc_title if cite_proc_title
×
15
      props[:publisher] = cite_proc_publisher if cite_proc_publisher
×
16
      props[:'publisher-place'] = cite_proc_publisher_place if cite_proc_publisher_place
×
17
      props[:issued] = cite_proc_issued if cite_proc_issued
×
18
      props
×
19
    end
×
20

21
    def cite_proc_type
×
22
      self[:format]&.first&.downcase
×
23
    end
×
24

25
    def cite_proc_authors
×
26
      @cite_proc_authors ||= cleaned_authors&.map do |author|
×
27
        if author.include?(', ')
×
28
          family, given = author.split(', ')
×
29
          CiteProc::Name.new(family:, given:)
×
30
        else
×
31
          CiteProc::Name.new(literal: author)
×
32
        end
×
33
      end
×
34
    end
×
35

36
    # Can remove after https://github.com/pulibrary/bibdata/issues/2646 is completed & re-indexed
37
    def cleaned_authors
×
38
      self[:author_citation_display]&.map do |author|
×
39
        # remove any parenthetical statements from author, as used for Corporate authors in Marc
40
        author.sub(/ \(.*\)/, '')
×
41
      end
×
42
    end
×
43

44
    def cite_proc_edition
×
45
      @cite_proc_edition ||= begin
×
46
        str = self[:edition_display]&.first
×
47
        str&.dup&.sub!(/[[:punct:]]?$/, '')
×
48
      end
×
49
    end
×
50

51
    def cite_proc_title
×
52
      @cite_proc_title ||= self[:title_citation_display]&.first
×
53
    end
×
54

55
    def cite_proc_publisher
×
56
      @cite_proc_publisher ||= begin
×
57
        publisher = self[:pub_citation_display]&.first&.split(': ').try(:[], 1)
×
58
        publisher&.gsub(/^<(.*)>$/, '\1')
×
59
      end
×
60
    end
×
61

62
    def cite_proc_publisher_place
×
63
      @cite_proc_publisher_place ||= self[:pub_citation_display]&.first&.split(': ').try(:[], 0)
×
64
    end
×
65

66
    def cite_proc_issued
×
67
      @cite_proc_issued ||= self[:pub_date_start_sort]
×
68
    end
×
69
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc