[utilities/kate] /: Fixes, links, and wording as suggested by @ichthyosaurus

Thomas Friedrichsmeier null at kde.org
Tue Jun 10 13:42:34 BST 2025


Git commit 28f01e3cc02158d55d919c174fe07b9e8f8afd9e by Thomas Friedrichsmeier.
Committed on 10/06/2025 at 12:37.
Pushed by tfry into branch 'master'.

Fixes, links, and wording as suggested by @ichthyosaurus

M  +11   -9    addons/snippets/editsnippet.cpp
M  +1    -1    addons/snippets/editsnippet.ui
M  +9    -9    doc/kate/plugins.docbook
M  +2    -2    doc/katepart/development.docbook

https://invent.kde.org/utilities/kate/-/commit/28f01e3cc02158d55d919c174fe07b9e8f8afd9e

diff --git a/addons/snippets/editsnippet.cpp b/addons/snippets/editsnippet.cpp
index cc48a71774..a8e9731811 100644
--- a/addons/snippets/editsnippet.cpp
+++ b/addons/snippets/editsnippet.cpp
@@ -72,15 +72,14 @@ EditSnippet::EditSnippet(SnippetRepository *repository, Snippet *snippet, QWidge
     connect(m_ui->modeComboBox, &QComboBox::currentIndexChanged, this, [this]() {
         if (m_ui->modeComboBox->currentData().toInt() == Snippet::TextTemplate) {
             m_ui->snippetLabel->setText(
-                i18n("Text to insert into the document (see "
-                     "<a href=\"help:/kate/kate-application-plugin-snippets.html\">handbook</a> "
+                i18n("Text to insert into the document (see the "
+                     "<a href=\"help:/kate/kate-application-plugin-snippets.html#snippet-input-template\">handbook</a> "
                      "for special fields)."));
             m_snippetView->document()->setMode(QStringLiteral("Normal"));
         } else {
-            // TODO
             m_ui->snippetLabel->setText(
-                i18n("Javascript code to evaluate (see "
-                     "<a href=\"help:/kate/kate-application-plugin-snippets.html\">handbook</a> "
+                i18n("JavaScript code to evaluate (see the "
+                     "<a href=\"help:/kate/kate-application-plugin-snippets.html#snippet-input-script\">handbook</a> "
                      "for details)."));
             m_snippetView->document()->setMode(QStringLiteral("JavaScript"));
         }
@@ -95,12 +94,15 @@ EditSnippet::EditSnippet(SnippetRepository *repository, Snippet *snippet, QWidge
     m_scriptsView->document()->setModified(false);
 
     m_ui->scriptLabel->setText(
-        i18n("JavaScript functions shared between all snippets in this repository (see "
-             "<a href=\"help:/kate/kate-application-plugin-snippets.html\">handbook</a>)."));
+        i18n("JavaScript functions shared between all snippets in this repository (see the "
+             "<a href=\"help:/kate/kate-application-plugin-snippets.html#snippet-input-library\">handbook</a>)."));
+    m_ui->scriptLabel->setOpenExternalLinks(true);
 
-    m_ui->descriptionLabel->setText(i18n("(Optional) description to show in tooltips. May contain HTML formatting."));
+    m_ui->descriptionLabel->setText(i18n("Optional description to show in tooltips. You may use basic HTML formatting."));
     m_descriptionView = createView(m_ui->descriptionTab);
-    m_descriptionView->document()->setText(m_snippet->description());
+    if (m_snippet != nullptr) {
+        m_descriptionView->document()->setText(m_snippet->description());
+    }
     m_descriptionView->document()->setModified(false);
 
     // view for testing the snippet
diff --git a/addons/snippets/editsnippet.ui b/addons/snippets/editsnippet.ui
index f9b90d0c59..4d72b937b8 100644
--- a/addons/snippets/editsnippet.ui
+++ b/addons/snippets/editsnippet.ui
@@ -41,7 +41,7 @@
        <item>
         <widget class="QLineEdit" name="snippetNameEdit">
          <property name="placeholderText">
-          <string>(required) Identifier (will also be shown in the completion list)</string>
+          <string>Name to be shown in the completion list (required)</string>
          </property>
         </widget>
        </item>
diff --git a/doc/kate/plugins.docbook b/doc/kate/plugins.docbook
index a61fdf50a6..9173a41da3 100644
--- a/doc/kate/plugins.docbook
+++ b/doc/kate/plugins.docbook
@@ -3469,8 +3469,8 @@ than one file type pressing the &Shift; while adding types.</para></listitem>
 <varlistentry>
 <term><guilabel>Type</guilabel></term>
 <listitem><para>Snippets may either be defined as text templates or scripts. Both types allow to use &javascript; functions
-(see below, for details), and can thus be used to similar effect. However, as a rule of thumb, text templates will be more
-suiteable, if you mostly want to <emphasis>insert</emphasis> text, while scripts are often an easier solution, if you want to
+(see below for details), and can thus be used to similar effect. However, as a rule of thumb, text templates will be more
+suiteable if you mostly want to <emphasis>insert</emphasis> text, while scripts are often an easier solution if you want to
 <emphasis>modify</emphasis> text).</para></listitem>
 </varlistentry>
 
@@ -3480,7 +3480,7 @@ suiteable, if you mostly want to <emphasis>insert</emphasis> text, while scripts
 </varlistentry>
 
 <varlistentry>
-<term><guilabel>Snippet</guilabel> (type <userinput>Text Template</userinput>)</term>
+<term><anchor id="snippet-input-template"/><guilabel>Snippet</guilabel> (type <userinput>Text Template</userinput>)</term>
 <listitem><para>The text your snippet will insert into the document.</para>
 <para>A snippet can contain editable fields. They can be cycled by
 pressing 	. The following expressions can be used in the template
@@ -3504,21 +3504,21 @@ of the cursor after everything else was filled in.</para>
 </varlistentry>
 
 <varlistentry>
-<term><guilabel>Snippet</guilabel> (type <userinput>Script</userinput>)</term>
+<term><anchor id="snippet-input-script"/><guilabel>Snippet</guilabel> (type <userinput>Script</userinput>)</term>
 <listitem><para>The &javascript; code to evaluate for this snippet</para>
-<para>If this code contains a <userinput>return</userinput>, the returned string will be inserted at the current
-cursor position, but you can also use the <ulink url="help:/katepart/dev-scripting.html#dev-scripting-api">&kate;
-scripting API</ulink> to modify the document, directly.</para>
+<para>If this code contains a <userinput>return</userinput> statement, the returned string will be inserted at the current
+cursor position. You can also use the <ulink url="help:/katepart/dev-scripting.html#dev-scripting-api">&kate;
+scripting API</ulink> to modify the document directly.</para>
 <para>Additionally, your code may use functions defined in the <guilabel>Script Library</guilabel> tab, which
 are shared between all snippets in a repository.</para>
 </listitem>
 </varlistentry>
 
 <varlistentry>
-<term><guilabel>Script Library</guilabel></term>
+<term><anchor id="snippet-input-library"/><guilabel>Script Library</guilabel></term>
 <listitem><para>&javascript; helper functions to use in your snippets. These functions are shared between all snippets in a repository.</para>
 <para>You can use the <ulink url="help:/katepart/dev-scripting.html#dev-scripting-api">&kate; scripting API</ulink>
-to get the selected text, full text, file name and more by using the appropriate methods of the <userinput>document</userinput>
+to get the selected text, full text, file name, and more by using the appropriate methods of the <userinput>document</userinput>
 and <userinput>view</userinput> objects. Refer to the scripting API
 documentation for more information.</para>
 
diff --git a/doc/katepart/development.docbook b/doc/katepart/development.docbook
index 86fbd50148..827bd70e04 100644
--- a/doc/katepart/development.docbook
+++ b/doc/katepart/development.docbook
@@ -2585,7 +2585,7 @@ The &kappname; editor component is easily extensible by writing scripts.
 The scripting language is ECMAScript (widely known as &javascript;).
 &kappname; supports two kinds of scripts: indentation and command line scripts.
 A functionality similar to command line scripts is also provided in the
-<ulink url="help:/kate/kate-application-plugin-snippets.html">snippets plugin</ulink>
+<ulink url="help:/kate/kate-application-plugin-snippets.html">snippets plugin</ulink>.
 </para>
 
 <sect2 id="dev-scripting-indentation">
@@ -2745,7 +2745,7 @@ by <ulink url="mailto:kwrite-devel at kde.org">contacting the mailing list</ulink>.
 <title>Command Line Scripts</title>
 
 <note>
-<para>A functionality similar the command line scripts, detailed here, is also provided in the
+<para>A functionality similar to command line scripts is also provided in the
 <ulink url="help:/kate/kate-application-plugin-snippets.html">snippets plugin</ulink>.
 This plugin may provide an easier starting point, especially for small custom scripts.</para>
 </note>



More information about the kde-doc-english mailing list