diff options
| -rw-r--r-- | lib/base_exporter.rb | 6 | ||||
| -rw-r--r-- | lib/plain_exporter.rb | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/base_exporter.rb b/lib/base_exporter.rb index f64301b..a67784e 100644 --- a/lib/base_exporter.rb +++ b/lib/base_exporter.rb @@ -59,7 +59,11 @@ class BaseExporter # # NOTE: the subclass *must* implement `parse_title`. def head(thing:) - str = "#{parse_authors(thing:)} (#{thing.year}). #{parse_title(title: thing.title)}." + str = if thing.year + "#{parse_authors(thing:)} (#{thing.year}). #{parse_title(title: thing.title)}." + else + "#{parse_authors(thing:)}. #{parse_title(title: thing.title)}." + end if thing.insideof.present? str += " #{inside_of(sub: thing.insideof)}" diff --git a/lib/plain_exporter.rb b/lib/plain_exporter.rb index 514d243..018c8f2 100644 --- a/lib/plain_exporter.rb +++ b/lib/plain_exporter.rb @@ -33,8 +33,11 @@ class PlainExporter < BaseExporter str += thing.note.present? ? "#{thing.note}. #{thing.publisher}" : thing.publisher end + str = str.strip if thing.address.present? str + ", #{thing.address}: #{thing.year}." + elsif str.blank? + nil else "#{str}." end |
