Add method to return title without item type.

This commit is contained in:
Edward Betts 2018-11-22 16:33:01 +00:00
parent e7df1758ec
commit 31e4bc81c5

View file

@ -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()