scripts:check-script

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
scripts:check-script [2022/03/22 11:03] erreur32scripts:check-script [2022/11/08 16:43] (Version actuelle) – modification externe 127.0.0.1
Ligne 7: Ligne 7:
 We have a simple **stat.sh** script: We have a simple **stat.sh** script:
  
-<sxh php; first-line: 89; highlight: [106,107]; title: New title attribute in action> +<sxh sh; title: simple stat.sh script>
-    /** +
-     * Render xhtml output or metadata +
-     * +
-     * @param string         $mode      Renderer mode (supported modes: xhtml) +
-     * @param Doku_Renderer  $renderer  The renderer +
-     * @param array          $data      The data from the handler() function +
-     * @return bool If rendering was successful. +
-     */ +
-    public function render($mode, Doku_Renderer &$renderer, $data) { +
-        if($mode != 'xhtml') return false; +
- +
-        if (count($data) != 3) { +
-            return true; +
-        } +
- +
-        list($syntax, $attr, $content) = $data; +
-        if ($syntax == 'sxh') { +
-            $title = $this->procTitle($attr); +
-            $highlight = $this->procHighlight($attr); +
-            $renderer->doc .= '<pre class="brush: ' . strtolower($attr . $highlight) . '"' . $title . '>' . $renderer->_xmlEntities($content) . '</pre>'; +
-        } else { +
-            $renderer->file($content); +
-        } +
- +
-        return true; +
-    } +
-</sxh> +
- +
-<sxh>+
 #!/usr/bin/env bash #!/usr/bin/env bash
  
Ligne 51: Ligne 22:
 echo "PYTHON FILES: $FILES" echo "PYTHON FILES: $FILES"
 echo "PYTHON LINES: $LINES" echo "PYTHON LINES: $LINES"
 +  
 </sxh> </sxh>
  
Ligne 62: Ligne 33:
 Then make test suits for **stat.sh**. We make a directory **testsuit** which contain test python files. Then make test suits for **stat.sh**. We make a directory **testsuit** which contain test python files.
  
-**testsuit/main.py** +<sxh sh; title: testsuit/main.py> 
-<code>+ 
 import foo import foo
 print(foo) print(foo)
-</code>+  
 +</sxh>
  
 **testsuit/foo.py** **testsuit/foo.py**
-<code>+<sxh sh; title: testsuit/foo.py > 
 BAR = 1 BAR = 1
 BUZ = BAR + 2 BUZ = BAR + 2
-</code>+  
 +</sxh>
  
 Ok! Our test suit is ready!  Ok! Our test suit is ready! 
Ligne 83: Ligne 57:
 Create file **tests.bashtest**: Create file **tests.bashtest**:
  
-<ccli>+<cli>
 $ ./stat.sh testsuit/ $ ./stat.sh testsuit/
 Evaluate *.py statistics Evaluate *.py statistics
Ligne 93: Ligne 67:
 This is our test! This is simple. Try to run it. This is our test! This is simple. Try to run it.
  
-<code sh>+<sxh sh> 
 # install bashtest if required! # install bashtest if required!
 $ pip install bashtest $ pip install bashtest
-</code>+  
 +</sxh>
  
-<code>+<sxh sh> 
 + 
 # run tests # run tests
 $ bashtest *.bashtest $ bashtest *.bashtest
Ligne 106: Ligne 83:
 1 passed and 0 failed. 1 passed and 0 failed.
 Test passed. Test passed.
-</code>+  
 +</sxh>
  
 Thats all. We wrote one test. You can write more tests if you want. Thats all. We wrote one test. You can write more tests if you want.
  • scripts/check-script.1647943424.txt
  • Dernière modification : 2022/03/22 11:03
  • de erreur32