Changed evaluation braces from {...} to {{...}} (breaks backward compatibility), fixed displaying 'None' in gemini links with no label
This commit is contained in:
parent
1a86cafd38
commit
eb9dd047b4
|
@ -19,7 +19,7 @@ from gemtext import GemtextParser # from itself
|
|||
|
||||
# regex pre-compilation
|
||||
REGEX = {
|
||||
'evaluation': re.compile(r'\{([^\s}]+([^}]*[^\s}])?)\}'),
|
||||
'evaluation': re.compile(r'{{([^\s}]+([^}]*[^\s}])?)}}'),
|
||||
'url': re.compile(r'(https?://)([-\w]+[-\w.]*)(/\S*)?'),
|
||||
'generic_url': re.compile(r'^[\w]+:')
|
||||
}
|
||||
|
|
|
@ -91,7 +91,10 @@ class GemtextElement:
|
|||
if self.type == 'plain':
|
||||
return self.content
|
||||
elif self.type == 'link':
|
||||
return f'=> {self.href} {self.label}'
|
||||
if self.label:
|
||||
return f'=> {self.href} {self.label}'
|
||||
else:
|
||||
return f'=> {self.href}'
|
||||
elif self.type == 'preformatted':
|
||||
opening = '```'
|
||||
if self.alt: opening += self.alt
|
||||
|
|
Reference in New Issue