mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-20 21:02:23 +12:00
Purging types from several files
This commit is contained in:
parent
8e7e953a37
commit
6551166000
|
@ -167,7 +167,7 @@ def infos(ref):
|
|||
ls=ls.replace("\n", "<br>")) if ls.strip() else "",
|
||||
notes="<p><b>{notesTitle}</b><br>{notes}</p>".format(
|
||||
notesTitle=notesTitle,
|
||||
notes=linkifyAllRefs(basicT2TFormat(notes))) if notes.strip() else "",
|
||||
notes=linkifyAllRefs(notes)) if notes.strip() else "",
|
||||
references=listReferences(ref)
|
||||
)
|
||||
|
||||
|
@ -582,30 +582,6 @@ def listReferences(ref, title=qApp.translate("references", "Referenced in:")):
|
|||
ref=listRefs) if listRefs else ""
|
||||
|
||||
|
||||
def basicT2TFormat(text, formatting=True, EOL=True, titles=True):
|
||||
"""A very basic t2t formatter to display notes and texts."""
|
||||
text = text.splitlines()
|
||||
for n, line in enumerate(text):
|
||||
if formatting:
|
||||
line = re.sub("\*\*(.*?)\*\*", "<b>\\1</b>", line)
|
||||
line = re.sub("//(.*?)//", "<i>\\1</i>", line)
|
||||
line = re.sub("__(.*?)__", "<u>\\1</u>", line)
|
||||
|
||||
if titles:
|
||||
for i in range(1, 6):
|
||||
r1 = '^\s*{s}([^=].*[^=]){s}\s*$'.format(s="=" * i)
|
||||
r2 = '^\s*{s}([^\+].*[^\+]){s}\s*$'.format(s="\\+" * i)
|
||||
t = "<h{n}>\\1</h{n}>".format(n=i)
|
||||
line = re.sub(r1, t, line)
|
||||
line = re.sub(r2, t, line)
|
||||
text[n] = line
|
||||
text = "\n".join(text)
|
||||
if EOL:
|
||||
text = text.replace("\n", "<br>")
|
||||
|
||||
return text
|
||||
|
||||
|
||||
def basicFormat(text):
|
||||
if not text:
|
||||
return ""
|
||||
|
|
|
@ -107,7 +107,7 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
autoResize=True)
|
||||
edt.setFrameShape(QFrame.NoFrame)
|
||||
edt.setStyleSheet("background: {};".format(settings.textEditor["background"]))
|
||||
edt.setStatusTip("{} ({})".format(itm.path(), itm.type()))
|
||||
edt.setStatusTip("{}".format(itm.path()))
|
||||
self.toggledSpellcheck.connect(edt.toggleSpellcheck, AUC)
|
||||
self.dictChanged.connect(edt.setDict, AUC)
|
||||
# edt.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
|
||||
|
|
|
@ -144,8 +144,6 @@ class revisions(QWidget, Ui_revisions):
|
|||
textBefore = [r[1] for r in item.revisions() if r[0] == ts][0]
|
||||
|
||||
if self.actShowVersion.isChecked():
|
||||
if item.type() == "t2t":
|
||||
textBefore = Ref.basicT2TFormat(textBefore)
|
||||
self.view.setText(textBefore)
|
||||
return
|
||||
|
||||
|
@ -160,7 +158,7 @@ class revisions(QWidget, Ui_revisions):
|
|||
else:
|
||||
_format = lambda x: x
|
||||
|
||||
extra = "" if item.type() == "html" else "<br>"
|
||||
extra = "<br>"
|
||||
diff = [d for d in diff if d and not d[:2] == "? "]
|
||||
mydiff = ""
|
||||
skip = False
|
||||
|
@ -177,8 +175,6 @@ class revisions(QWidget, Ui_revisions):
|
|||
|
||||
# Same line
|
||||
if op == " " and not self.actDiffOnly.isChecked():
|
||||
if item.type() == "t2t":
|
||||
txt = Ref.basicT2TFormat(txt)
|
||||
mydiff += "{}{}".format(txt, extra)
|
||||
|
||||
elif op == "- " and op2 == "+ ":
|
||||
|
|
Loading…
Reference in a new issue