Add method to return title without item type.
This commit is contained in:
parent
e7df1758ec
commit
31e4bc81c5
|
@ -353,15 +353,19 @@ class SourceDoc(Item):
|
||||||
result = s[:length - len(end)].rsplit(' ', 1)[0]
|
result = s[:length - len(end)].rsplit(' ', 1)[0]
|
||||||
return result + end
|
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()
|
titles = XanaLink.get_all_titles()
|
||||||
from_link = self.title_from_link(titles=titles)
|
from_link = self.title_from_link(titles=titles)
|
||||||
if from_link:
|
if from_link:
|
||||||
return self.type + ': ' + from_link
|
return start + from_link
|
||||||
first_line = first_non_empty_line(self.text)
|
first_line = first_non_empty_line(self.text)
|
||||||
if first_line:
|
if first_line:
|
||||||
return self.type + ': ' + first_line
|
return start + first_line
|
||||||
return self.type + ': ' + self.hashid
|
return start + self.hashid
|
||||||
|
|
||||||
|
|
||||||
configure_mappers()
|
configure_mappers()
|
||||||
|
|
Loading…
Reference in a new issue