From 31e4bc81c56812c164145eb3cb50556445609538 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 22 Nov 2018 16:33:01 +0000 Subject: [PATCH] Add method to return title without item type. --- sourcing/model.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sourcing/model.py b/sourcing/model.py index 2c328af..4297479 100644 --- a/sourcing/model.py +++ b/sourcing/model.py @@ -353,15 +353,19 @@ class SourceDoc(Item): result = s[:length - len(end)].rsplit(' ', 1)[0] return result + end - def title(self, titles=None): + def raw_title(self): + return self.title(with_type=False) + + def title(self, titles=None, with_type=True): + start = self.type + ': ' if with_type else '' titles = XanaLink.get_all_titles() from_link = self.title_from_link(titles=titles) if from_link: - return self.type + ': ' + from_link + return start + from_link first_line = first_non_empty_line(self.text) if first_line: - return self.type + ': ' + first_line - return self.type + ': ' + self.hashid + return start + first_line + return start + self.hashid configure_mappers()