Aller au contenu | Aller au menu | Aller à la recherche


TEST_coloration_syntaxique

TEST_coloration_syntaxique avec les différents plugins

  • Coloration syntaxique (hljs) 3.0.1 highlight.js pour Dotclear
  • YASH (yash) 4.0 Coloration syntaxique de code

hljs

///hljs language_code

ou

///code language_code

the ///yash language_code wiki macro is supported by HLJS for the following syntaxes if enabled in the settings.

the ///[language_code] wiki macro is supported by HLJS for the following syntaxes if enabled in the settings.

SyntaxeHL is a PHP library and then render code in content juste before it will be saved on the server database.

HLJS will only be run when the code will be displayed, in the client's browser.

yash

///yash language_code

GniehHl (Ne fonctionne pas)

GniehHL est un plugin permettant d'ajouter de la coloration syntaxique à vos billets. . GniehHL peut être configuré pour utiliser soit SyntaxHighlighter soit HIGHLIGHT.JS avec différents thèmes. En soit, GniehHL ne fait pas de coloration syntaxique, il permet juste une utilisation plus facile de deux projets efficaces faisant la coloration syntaxique du côté client.

SyntaxeHl (Ne fonctionne pas)

Ne fonctionne pas.

Examples

// ///[php]
$url = 'http://server.com/path';
$data = array(
		'param1' => 'value1''
);
// ///yash php
$url = 'http://server.com/path';
$data = array(
		'param1' => 'value1''
// ///hljs php
$url = 'http://server.com/path';
$data = array(
		'param1' => 'value1''
);
import placeoweb.com; // ///hljs java
Object o = new Integer("12");
import placeoweb.com; // ///yash java
Object o = new Integer("12");
import placeoweb.com;

Object o = new Integer("12");
// ///hljs php
$url = 'http://server.com/path';
$data = array(
		'param1' => 'value1',
		'param2' => 'value2'
);

// use key 'http' even if you send the request to https://...
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data),
    ),
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

echo "-- REQUEST ------------------------------" . PHP_EOL;
echo "URL: " . $url . PHP_EOL;
echo "DATA: " . print_r($data, true);

echo "-- HEADER ------------------------------" . PHP_EOL;
print_r($http_response_header);

echo "-- BODY ------------------------------" . PHP_EOL;
var_dump($result);

// array(7) {
//   [0]=>
//   string(15) "HTTP/1.1 200 OK"
// }

// Ou NULL si pas de réponse 
// PHP Warning:  file_get_contents(http://server.com/path): failed to open stream: php_network_getaddresses: getaddrinfo failed: H¶te inconnu.
// PHP Notice:  Undefined variable: http_response_header
// NULL

echo "-- ANALYSE ------------------------------" . PHP_EOL;
if(!empty($http_response_header)) {
	$arr = preg_split('/ /', $http_response_header[0]);
	echo 'Status:' . $arr[1] . PHP_EOL;
// Status:200
}
// ///yash php
$url = 'http://server.com/path';
$data = array(
		'param1' => 'value1',
		'param2' => 'value2'
);

// use key 'http' even if you send the request to https://...
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data),
    ),
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

echo "-- REQUEST ------------------------------" . PHP_EOL;
echo "URL: " . $url . PHP_EOL;
echo "DATA: " . print_r($data, true);

echo "-- HEADER ------------------------------" . PHP_EOL;
print_r($http_response_header);

echo "-- BODY ------------------------------" . PHP_EOL;
var_dump($result);

// array(7) {
//   [0]=>
//   string(15) "HTTP/1.1 200 OK"
// }

// Ou NULL si pas de réponse 
// PHP Warning:  file_get_contents(http://server.com/path): failed to open stream: php_network_getaddresses: getaddrinfo failed: H¶te inconnu.
// PHP Notice:  Undefined variable: http_response_header
// NULL

echo "-- ANALYSE ------------------------------" . PHP_EOL;
if(!empty($http_response_header)) {
	$arr = preg_split('/ /', $http_response_header[0]);
	echo 'Status:' . $arr[1] . PHP_EOL;
// Status:200
}

SQL

sql
SELECT * FROM myTable WHERE col = 'val'; -- ///sql
SELECT * FROM myTable WHERE col = 'val'; -- ///[sql]
mysql
SELECT * FROM myTable WHERE col = 'val'; -- ///mysql
SELECT * FROM myTable WHERE col = 'val'; -- ///[mysql]
SELECT * FROM myTable WHERE col = 'val'; -- ///yash mysql
SELECT * FROM myTable WHERE col = 'val'; -- ///yash sql
SELECT * FROM myTable WHERE col = 'val'; -- ///hljs sql
SELECT * FROM myTable WHERE col = 'val'; -- ///hljs [sql]
SELECT * FROM myTable WHERE col = 'val'; -- ///hljs mysql
SELECT * FROM myTable WHERE col = 'val'; -- ///hljs [mysql]
SELECT * FROM myTable WHERE col = 'val'; -- ///code sql
SELECT * FROM myTable WHERE col = 'val'; -- ///code [sql]
SELECT * FROM myTable WHERE col = 'val'; -- ///code mysql
SELECT * FROM myTable WHERE col = 'val'; -- ///code [mysql]

PHP

php
echo "URL: " . $url . PHP_EOL; // ///php
echo "URL: " . $url . PHP_EOL; // ///[php]
echo "URL: " . $url . PHP_EOL; // ///hljs php
echo "URL: " . $url . PHP_EOL; // ///hljs [php]
echo "URL: " . $url . PHP_EOL; // ///yash php
echo "URL: " . $url . PHP_EOL; // ///yash [php]

Ajouter un commentaire

Le code HTML est affiché comme du texte et les adresses web sont automatiquement transformées.

Fil des commentaires de ce billet