mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-09-28 07:21:31 +12:00
Better formatting in notes and cheat sheet
This commit is contained in:
parent
e7234239d6
commit
1e9b239803
3 changed files with 10 additions and 5 deletions
|
@ -94,7 +94,7 @@ def infoForRef(ref):
|
|||
ls=ls.replace("\n", "<br>")) if ls else "",
|
||||
notes="<p><b>{notesTitle}</b><br>{notes}</p>".format(
|
||||
notesTitle=notesTitle,
|
||||
notes=linkifyAllRefs(notes).replace("\n", "<br>")) if notes else "",
|
||||
notes=linkifyAllRefs(basicT2TFormat(notes))) if notes else "",
|
||||
)
|
||||
|
||||
return text
|
||||
|
@ -208,6 +208,13 @@ def refToLink(ref):
|
|||
def linkifyAllRefs(text):
|
||||
return re.sub(r"::(\w):(\d+?)::", lambda m: refToLink(m.group(0)), text)
|
||||
|
||||
def basicT2TFormat(text):
|
||||
text = re.sub("\*\*(.*?)\*\*", "<b>\\1</b>", text)
|
||||
text = re.sub("//(.*?)//", "<i>\\1</i>", text)
|
||||
text = re.sub("__(.*?)__", "<u>\\1</u>", text)
|
||||
text = text.replace("\n", "<br>")
|
||||
return text
|
||||
|
||||
def tooltipForRef(ref):
|
||||
match = re.fullmatch("::(\w):(\d+?)::", ref)
|
||||
if match:
|
||||
|
|
|
@ -45,7 +45,7 @@ class textFormat(QWidget, Ui_textFormat):
|
|||
self.setVisible(False)
|
||||
return
|
||||
|
||||
if index.column() != Outline.text.value:
|
||||
if index.column() not in [Outline.text.value, Outline.notes.value]:
|
||||
self.setVisible(False)
|
||||
return
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class textEditView(QTextEdit):
|
|||
self._textFormat = "text"
|
||||
return
|
||||
|
||||
if self._column != Outline.text.value:
|
||||
if self._column not in [Outline.text.value, Outline.notes.value]:
|
||||
self._textFormat = "text"
|
||||
|
||||
else:
|
||||
|
@ -477,8 +477,6 @@ class textEditView(QTextEdit):
|
|||
|
||||
def applyFormat(self, _format):
|
||||
|
||||
print(_format)
|
||||
|
||||
if self._textFormat == "html":
|
||||
|
||||
if _format == "Clear":
|
||||
|
|
Loading…
Reference in a new issue