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