Merge branch 'master' of lel/AV-98 into master
This commit is contained in:
commit
9e6fecc0d8
11
av98.py
11
av98.py
|
@ -110,13 +110,10 @@ class GeminiItem():
|
||||||
return GeminiItem(self._derive_url("/"))
|
return GeminiItem(self._derive_url("/"))
|
||||||
|
|
||||||
def up(self):
|
def up(self):
|
||||||
pathbits = list(os.path.split(self.path))
|
pathbits = list(os.path.split(self.path.rstrip('/')))
|
||||||
# Get rid of empty string from trailing /
|
|
||||||
while not pathbits[-1]:
|
|
||||||
pathbits.pop()
|
|
||||||
# Don't try to go higher than root
|
# Don't try to go higher than root
|
||||||
if len(pathbits) == 1:
|
if len(pathbits) == 1:
|
||||||
return self.url
|
return self
|
||||||
# Get rid of bottom component
|
# Get rid of bottom component
|
||||||
pathbits.pop()
|
pathbits.pop()
|
||||||
new_path = os.path.join(*pathbits)
|
new_path = os.path.join(*pathbits)
|
||||||
|
@ -153,9 +150,9 @@ class GeminiItem():
|
||||||
|
|
||||||
def to_map_line(self, name=None):
|
def to_map_line(self, name=None):
|
||||||
if name or self.name:
|
if name or self.name:
|
||||||
return "=> {} {}".format(self.url, name or self.name)
|
return "=> {} {}\n".format(self.url, name or self.name)
|
||||||
else:
|
else:
|
||||||
return "=> {}".format(self.url)
|
return "=> {}\n".format(self.url)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_map_line(cls, line, origin_gi):
|
def from_map_line(cls, line, origin_gi):
|
||||||
|
|
Loading…
Reference in New Issue