lib/stanford-mods/imprint.rb in stanford-mods-3.1.0 vs lib/stanford-mods/imprint.rb in stanford-mods-3.2.0
- old
+ new
@@ -147,11 +147,11 @@
def valid?
text.present? && !['9999', '0000-00-00', 'uuuu'].include?(text.strip)
end
# Element text reduced to digits and hyphen. Captures date ranges and
- # negative (B.C.) dates. Used for comparison/deduping.
+ # negative (BCE) dates. Used for comparison/deduping.
def base_value
if text =~ /^\[?1\d{3}-\d{2}\??\]?$/
return text.sub(/(\d{2})(\d{2})-(\d{2})/, '\1\2-\1\3')
end
@@ -191,29 +191,29 @@
when :month
date.strftime('%B %Y')
when :year
year = date.year
if year < 1
- "#{year.abs + 1} B.C."
- # Any dates before the year 1000 are explicitly marked A.D.
+ "#{year.abs + 1} BCE"
+ # Any dates before the year 1000 are explicitly marked CE
elsif year > 1 && year < 1000
- "#{year} A.D."
+ "#{year} CE"
else
year.to_s
end
when :century
if date.year.negative?
- "#{((date.year / 100).abs + 1).ordinalize} century B.C."
+ "#{((date.year / 100).abs + 1).ordinalize} century BCE"
else
"#{((date.year / 100) + 1).ordinalize} century"
end
when :decade
"#{date.year}s"
end
end
- # Decoded date with "B.C." or "A.D." and qualifier markers. See (outdated):
+ # Decoded date with "BCE" or "CE" and qualifier markers. See (outdated):
# https://consul.stanford.edu/display/chimera/MODS+display+rules#MODSdisplayrules-3b.%3CoriginInfo%3E
def qualified_value
qualified_format = case qualifier
when 'approximate'
'[ca. %s]'
@@ -248,11 +248,11 @@
# The encoding value for the start of the range, or stop if not present.
def encoding
@start&.encoding || @stop&.encoding
end
- # Decoded dates with "B.C." or "A.D." and qualifier markers applied to
+ # Decoded dates with "BCE" or "CE" and qualifier markers applied to
# the entire range, or individually if dates differ.
def qualified_value
if @start&.qualifier == @stop&.qualifier
qualifier = @start&.qualifier || @stop&.qualifier
date = "#{@start&.decoded_value} - #{@stop&.decoded_value}"
@@ -304,10 +304,10 @@
date_ranges.select { |r| r.base_values.include?(date.base_value) }
end
dates = dates - duplicated_ranges
- # output formatted dates with qualifiers, A.D./B.C., etc.
+ # output formatted dates with qualifiers, CE/BCE, etc.
dates.map(&:qualified_value)
end
end
end
end