diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-08-08 23:14:22 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-08-08 23:14:22 +0200 |
| commit | 13243d96bf5bf945cb68fe752598abc8a0b0274a (patch) | |
| tree | 1c6adcfca40086b49f047a5a72450576681c6d6e /lib/base_exporter.rb | |
| parent | c99697a13e714d1ef87f047e5ad1c88f62f61f25 (diff) | |
| download | operum-13243d96bf5bf945cb68fe752598abc8a0b0274a.tar.gz operum-13243d96bf5bf945cb68fe752598abc8a0b0274a.zip | |
exporter: Avoid trailing dots on bare-bone items
Some items are going to be really empty: just the title and the author;
no year, no notes, etc. In these cases the exporter still tried to add
this missing information.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/base_exporter.rb')
| -rw-r--r-- | lib/base_exporter.rb | 6 |
1 files changed, 5 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)}" |
