From 349d145014cd48bbe6f1a2eb864904f2797f5922 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Mon, 23 Mar 2020 07:55:48 +0100 Subject: [PATCH] Ident html in editor Sometime I like to print html to understand why it bugs. And I really prefer to have html indented if it's okay with you. There is no change appart from the identation and quotes --- qt/aqt/editor.py | 75 +++++++++++++++++++++++++++++++-------------- qt/ts/src/editor.ts | 41 +++++++++++++++++-------- 2 files changed, 80 insertions(+), 36 deletions(-) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index ed183e40e..6bbb830aa 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -63,9 +63,18 @@ _html = """ html { background: %s; } #topbutsOuter { background: %s; } -
%s
-
- +
+
+%s +
+
+
+
+ """ # caller is responsible for resetting note on reset @@ -117,20 +126,35 @@ class Editor: # The color selection buttons do not use an icon so the HTML must be specified manually tip = _("Set foreground colour (F7)") righttopbtns.append( - """""".format( + """ """.format( tip ) ) tip = _("Change colour (F8)") righttopbtns.extend( [ - """""".format( + """""".format( tip ), self._addButton( @@ -249,18 +273,23 @@ class Editor: theclass = "linkb" if not disables: theclass += " perm" - return ( - '''""".format( - imgelm=imgelm, - cmd=cmd, - tip=tip, - labelelm=labelelm, - id=idstr, - togglesc=toggleScript, - theclass=theclass, - ) + return """ """.format( + imgelm=imgelm, + cmd=cmd, + tip=tip, + labelelm=labelelm, + id=idstr, + togglesc=toggleScript, + theclass=theclass, ) def setupShortcuts(self) -> None: diff --git a/qt/ts/src/editor.ts b/qt/ts/src/editor.ts index f3eba5c4a..87bf61e80 100644 --- a/qt/ts/src/editor.ts +++ b/qt/ts/src/editor.ts @@ -333,20 +333,35 @@ function setFields(fields) { if (!f) { f = "
"; } - txt += `${n}`; - txt += `
${f}
`; - txt += ""; + txt += ` + + ${n} + + + +
+${f} +
+ + `; } - $("#fields").html( - "" + - txt + - "
" - ); + $("#fields").html(` + +${txt} +
`); maybeDisableButtons(); }