text processing utilities

Highlight documentation

Syntax Samples

Bash

01 #!/bin/bash
02 #  Upload file pair (Filename.lsm, Filename.tar.gz)
03 #+ to incoming directory at Sunsite/UNC (ibiblio.org).
04 
05 E_ARGERROR=85
06 
07 if [ -z "$1" ]
08 then
09   echo "Usage: `basename $0` Filename-to-upload"
10   exit $E_ARGERROR
11 fi
12 
13 Filename=`basename $1`           # Strips pathname out of file name.
14 
15 Server="ibiblio.org"
16 Directory="/incoming/Linux"
17 
18 Password="your.e-mail.address"   # Change above to suit.
19 
20 ftp -n $Server <<End-Of-Session
21 
22 user anonymous "$Password"       #  If this doesn't work, then try:
23                                  #  quote user anonymous "$Password"
24 binary
25 bell                             # Ring 'bell' after each file transfer.
26 cd $Directory
27 put "$Filename.lsm"
28 put "$Filename.tar.gz"
29 bye
30 End-Of-Session
31 
32 exit 0

Javascript with codefold plugin

01   function hlToggleFold(sender){ 
02     elem =    document.getElementById(sender.id);
03     var num = parseInt(sender.id.substr(4));
04     var isFolding = elem.className.indexOf ('unfold')>0;
05     foldedLines[num] = isFolding ;
06     elem.className = "hl fld hl arrow_" + (isFolding ? "fold":"unfold");
07     for (var i=num+1; i<=endOfBlock[num]-1; i++){
08       if (!foldedLines[i]) foldedLines[i] = 0 ;
09       foldedLines[i] = foldedLines[i] + (isFolding ? 1:-1);
10       elem = document.getElementById('line'+i);	  
11       if (    (isFolding || elem.style.display=='block')
12            || (!isFolding && foldedLines[i]>=1 && elem.className.indexOf ('_fold') < 0) 
13            || (!isFolding && foldedLines[i]>=2 && elem.className.indexOf ('_fold') > 0)) {
14           elem.style.display = 'none';
15       } else {
16           elem.style.display = 'block';
17       }
18       if (elem.nextSibling 
19         && elem.nextSibling.nodeType==3 
20         && !elem.nextSibling.data.match(/\S/) ) {
21           elem.parentNode.removeChild(elem.nextSibling);
22           if (elem.textContent.length==0) elem.textContent = " ";
23         }
24       }
25     }

HTML + PHP + CSS + Javascript

01 <!DOCTYPE html>
02 <html>
03 <head>
04 <title>Embedded syntax test</title>
05 
06     <!-- JS Snippet -->
07     <script language="JavaScript">
08     // init color to red
09     function start () {
10        document.getElementById ('status').style.color = 'red';
11        window.setTimeout ('changeStatus ()', 3 * 1000);
12     }
13 
14     // change color to green
15     function changeStatus () {
16        document.getElementById ('status').firstChild.data = 'Fertig!';
17        document.getElementById ('status').style.color = 'green';
18     }
19     </script>
20 
21     <!-- CSS Snippet -->
22     <style type="text/css">
23           body { background-color:#fff5ee; }
24           p    { color:#000000; font-size:12pt; font-family:'Courier New'; }
25     </style>
26 </head>
27 <body onload="start()">
28     <h1>Some HTML code...</h1>
29 
30    <!-- PHP Snippet -->
31    <?php if (preg_match( "^de.*" ,$_SERVER['HTTP_ACCEPT_LANGUAGE']  )){  ?>
32      <p>Deutscher Text</p>
33    <?php } else { ?>
34      <p>English text</p>
35    <?php } ?>
36 
37 </body>
38 </html>

C++ with qtproject.org Plug-In

01  // hellothreadpool/main.cpp
02  class Work : public QRunnable
03  {
04  public:
05      void run()
06      {
07          qDebug() << "Hello from thread " << QThread::currentThread();
08      }
09  };
10 
11  int main(int argc, char *argv[])
12  {
13      QCoreApplication app(argc, argv);
14      Work work;
15      work.setAutoDelete(false);
16      QThreadPool *threadPool = QThreadPool::globalInstance();
17      threadPool->start(&work);
18      qDebug() << "hello from GUI thread " << QThread::currentThread();
19      threadPool->waitForDone();
20      return 0;
21  }
Tupel7