public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/devmanual:master commit in: xsl/
Date: Mon,  6 Nov 2023 18:11:35 +0000 (UTC)	[thread overview]
Message-ID: <1699294123.2c608b94d37db7706096864c67ed34772724ffc8.ulm@gentoo> (raw)

commit:     2c608b94d37db7706096864c67ed34772724ffc8
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  4 20:43:34 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Mon Nov  6 18:08:43 2023 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=2c608b94

lang.highlight.ebuild.xsl: Collect shell commands in a variable

Rewrap some long lines.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 xsl/lang.highlight.ebuild.xsl | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xsl/lang.highlight.ebuild.xsl b/xsl/lang.highlight.ebuild.xsl
index 4dff8d1..30ccc08 100644
--- a/xsl/lang.highlight.ebuild.xsl
+++ b/xsl/lang.highlight.ebuild.xsl
@@ -11,6 +11,11 @@
   <xsl:variable name="lang.highlight.ebuild.variable-end">}</xsl:variable>
   <xsl:variable name="lang.highlight.ebuild.commentChar">#</xsl:variable>
 
+  <xsl:variable name="shell-keywords">
+    ; if then fi -ge -lt -le -gt elif else eval unset sed rm cat [[ ]] while do read done make echo cd local return for
+    case esac in -n [ ] -z -f &lt;&lt;- &gt; EOF
+  </xsl:variable>
+
   <xsl:variable name="pkg-mgr-keywords">
     <!-- Package manager commands in EAPI 0 (excluding commands banned in later EAPIs) -->
     assert best_version debug-print debug-print-function debug-print-section die diropts dobin docinto doconfd dodir
@@ -184,14 +189,9 @@
         </xsl:choose>
       </xsl:when>
 
-      <!-- Functioney highlighing -->
+      <!-- Function highlighting -->
       <!-- sh grammar -->
-      <xsl:when test="$data = ';' or $data = 'if' or $data = 'then' or $data = 'fi' or $data = '-ge' or $data = '-lt' or $data = '-le' or
-                      $data = '-gt' or $data = 'elif' or $data = 'else' or $data = 'eval' or $data = 'unset' or $data = 'sed' or
-                      $data = 'rm' or $data = 'cat' or $data = '[[' or $data = ']]' or $data = 'while' or $data = 'do' or $data = 'read' or
-                      $data = 'done' or $data = 'make' or $data = 'echo' or $data = 'cd' or $data = 'local' or $data = 'return' or
-                      $data = 'for' or $data = 'case' or $data = 'esac' or $data = 'in' or $data = '-n' or $data = '[' or $data = ']' or
-                      $data = '-z' or $data = '-f' or $data = '&lt;&lt;-' or $data = '&gt;' or $data = 'EOF'">
+      <xsl:when test="str:tokenize($shell-keywords)[$data = .]">
         <span class="Statement"><xsl:value-of select="$data"/></span>
       </xsl:when>
 
@@ -221,7 +221,8 @@
     <!-- Scan for comments. If a comment is found then this is a positional
          index that is non-zero that refers to the last node that is not
          a comment. -->
-    <xsl:variable name="commentSeeker" select="count(str:tokenize_plasmaroo(substring-before($data, concat(' ', $lang.highlight.ebuild.commentChar))))"/>
+    <xsl:variable name="commentSeeker" select="count(str:tokenize_plasmaroo(substring-before($data,
+                                               concat(' ', $lang.highlight.ebuild.commentChar))))"/>
 
     <!-- Scan for quotes... -->
     <xsl:for-each select="exslt:node-set($tokenizedData)">
@@ -232,7 +233,8 @@
       <!-- See if we should be processing comments by now; we need to test for
            two possible cases:  * commentSeeker != 0 (so we have a comment), or,
                                 * the first token is a "#" -->
-      <xsl:when test="($commentSeeker != 0 and position() &gt; $commentSeeker) or substring(../*[position()=1], 1, 1) = $lang.highlight.ebuild.commentChar or
+      <xsl:when test="($commentSeeker != 0 and position() &gt; $commentSeeker) or
+                      substring(../*[position()=1], 1, 1) = $lang.highlight.ebuild.commentChar or
                       . = $lang.highlight.ebuild.commentChar">
         <span class="Comment"><xsl:value-of select="."/></span>
       </xsl:when>


             reply	other threads:[~2023-11-06 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 18:11 Ulrich Müller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-22 18:19 [gentoo-commits] proj/devmanual:master commit in: xsl/ Ulrich Müller
2023-11-06 18:11 Ulrich Müller
2021-09-07 18:01 Ulrich Müller
2020-01-15 21:29 Ulrich Müller
2019-12-19  8:55 Ulrich Müller
2019-11-26  3:05 Göktürk Yüksek
2019-11-26  3:05 Göktürk Yüksek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1699294123.2c608b94d37db7706096864c67ed34772724ffc8.ulm@gentoo \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox