Version Description
- Another fix regarding the \r\n line breaks
Download this release
Release Info
Developer | akarmenia |
Plugin | Crayon Syntax Highlighter |
Version | 1.9.10 |
Comparing to | |
See all releases |
Code changes from version 1.9.7 to 1.9.10
- crayon_formatter.class.php +15 -15
- crayon_highlighter.class.php +5 -4
- crayon_settings.class.php +2 -0
- crayon_settings_wp.class.php +6 -4
- crayon_wp.class.php +5 -6
- langs/apache/haskell.txt +22 -0
- langs/apache/reserved.txt +200 -0
- langs/apache/type.txt +29 -0
- langs/haskell/haskell.txt +22 -0
- langs/haskell/reserved.txt +200 -0
- langs/haskell/type.txt +29 -0
- langs/tex/tex.txt +15 -0
- readme.txt +17 -1
- util/sample/haskell.txt +23 -0
- util/sample/tex.txt +5 -0
crayon_formatter.class.php
CHANGED
@@ -24,9 +24,9 @@ class CrayonFormatter {
|
|
24 |
private function __construct() {}
|
25 |
|
26 |
/* Formats the code using the parsed language elements. */
|
27 |
-
public static function format_code($code, $language, $hl = NULL
|
28 |
// Ensure the language is defined
|
29 |
-
if ($language != NULL && $
|
30 |
/* Perform the replace on the code using the regex, pass the captured matches for
|
31 |
formatting before they are replaced */
|
32 |
try {
|
@@ -311,7 +311,7 @@ class CrayonFormatter {
|
|
311 |
$readonly = $touch ? '' : 'readonly';
|
312 |
$print_plain = $print_plain_button = '';
|
313 |
// TODO remove wrap
|
314 |
-
$print_plain = '<textarea wrap="off" class="crayon-plain print-no" data-settings="' . $plain_settings . '" '. $readonly .' style="' . $plain_style .' '. $font_style . '">' .
|
315 |
} else {
|
316 |
$print_plain = $plain_settings = $plain_settings = '';
|
317 |
}
|
@@ -442,7 +442,7 @@ class CrayonFormatter {
|
|
442 |
|
443 |
// Delimiters =============================================================
|
444 |
|
445 |
-
public static function format_mixed_code($code, $language, $hl
|
446 |
self::$curr = $hl;
|
447 |
self::$delim_pieces = array();
|
448 |
// Remove crayon internal element from INPUT code
|
@@ -461,7 +461,7 @@ class CrayonFormatter {
|
|
461 |
$internal_code = preg_replace_callback(self::$delim_regex, 'CrayonFormatter::delim_to_internal', $code);
|
462 |
|
463 |
// Format with given language
|
464 |
-
$formatted_code = CrayonFormatter::format_code($internal_code, $language, $hl
|
465 |
|
466 |
// Replace internal elements with delimited pieces
|
467 |
$formatted_code = preg_replace_callback('#\{\{crayon-internal:(\d+)\}\}#', 'CrayonFormatter::internal_to_code', $formatted_code);
|
@@ -479,7 +479,8 @@ class CrayonFormatter {
|
|
479 |
return $matches[0];
|
480 |
}
|
481 |
$internal = sprintf('{{crayon-internal:%d}}', count(self::$delim_pieces));
|
482 |
-
|
|
|
483 |
return $internal;
|
484 |
}
|
485 |
|
@@ -489,14 +490,17 @@ class CrayonFormatter {
|
|
489 |
|
490 |
// Auxiliary Methods ======================================================
|
491 |
/* Prepares code for formatting. */
|
492 |
-
public static function clean_code($code) {
|
493 |
if (empty($code)) {
|
494 |
return $code;
|
495 |
}
|
496 |
/* Convert <, > and & characters to entities, as these can appear as HTML tags and entities. */
|
497 |
$code = CrayonUtil::htmlspecialchars($code);
|
498 |
-
|
499 |
-
|
|
|
|
|
|
|
500 |
// Replace tabs with 4 spaces
|
501 |
$code = preg_replace('#\t#', str_repeat(' ', CrayonGlobalSettings::val(CrayonSettings::TAB_SIZE)), $code);
|
502 |
return $code;
|
@@ -516,13 +520,9 @@ class CrayonFormatter {
|
|
516 |
}
|
517 |
|
518 |
public static function split_lines($code, $class) {
|
519 |
-
// var_dump($code);
|
520 |
$code = self::clean_code($code);
|
521 |
-
|
522 |
-
|
523 |
-
// echo "\n";
|
524 |
-
$code = preg_replace('|^|m', '<span class="'.$class.'">', $code);
|
525 |
-
$code = preg_replace('|$|m', '</span>', $code);
|
526 |
return $code;
|
527 |
}
|
528 |
|
24 |
private function __construct() {}
|
25 |
|
26 |
/* Formats the code using the parsed language elements. */
|
27 |
+
public static function format_code($code, $language, $hl = NULL) {
|
28 |
// Ensure the language is defined
|
29 |
+
if ($language != NULL && $hl->is_highlighted) {
|
30 |
/* Perform the replace on the code using the regex, pass the captured matches for
|
31 |
formatting before they are replaced */
|
32 |
try {
|
311 |
$readonly = $touch ? '' : 'readonly';
|
312 |
$print_plain = $print_plain_button = '';
|
313 |
// TODO remove wrap
|
314 |
+
$print_plain = '<textarea wrap="off" class="crayon-plain print-no" data-settings="' . $plain_settings . '" '. $readonly .' style="' . $plain_style .' '. $font_style . '">' . $hl->code() . '</textarea>';
|
315 |
} else {
|
316 |
$print_plain = $plain_settings = $plain_settings = '';
|
317 |
}
|
442 |
|
443 |
// Delimiters =============================================================
|
444 |
|
445 |
+
public static function format_mixed_code($code, $language, $hl) {
|
446 |
self::$curr = $hl;
|
447 |
self::$delim_pieces = array();
|
448 |
// Remove crayon internal element from INPUT code
|
461 |
$internal_code = preg_replace_callback(self::$delim_regex, 'CrayonFormatter::delim_to_internal', $code);
|
462 |
|
463 |
// Format with given language
|
464 |
+
$formatted_code = CrayonFormatter::format_code($internal_code, $language, $hl);
|
465 |
|
466 |
// Replace internal elements with delimited pieces
|
467 |
$formatted_code = preg_replace_callback('#\{\{crayon-internal:(\d+)\}\}#', 'CrayonFormatter::internal_to_code', $formatted_code);
|
479 |
return $matches[0];
|
480 |
}
|
481 |
$internal = sprintf('{{crayon-internal:%d}}', count(self::$delim_pieces));
|
482 |
+
// TODO fix
|
483 |
+
self::$delim_pieces[] = CrayonFormatter::format_code($matches[0], $lang, self::$curr);
|
484 |
return $internal;
|
485 |
}
|
486 |
|
490 |
|
491 |
// Auxiliary Methods ======================================================
|
492 |
/* Prepares code for formatting. */
|
493 |
+
public static function clean_code($code, $spaces = TRUE) {
|
494 |
if (empty($code)) {
|
495 |
return $code;
|
496 |
}
|
497 |
/* Convert <, > and & characters to entities, as these can appear as HTML tags and entities. */
|
498 |
$code = CrayonUtil::htmlspecialchars($code);
|
499 |
+
if ($spaces) {
|
500 |
+
// Replace 2 spaces with html escaped characters
|
501 |
+
$code = preg_replace('#[ ]{2}#msi', ' ', $code);
|
502 |
+
}
|
503 |
+
$code = preg_replace('#(\r(?!\n))|((?<!\r)\n)#msi', "\r\n", $code);
|
504 |
// Replace tabs with 4 spaces
|
505 |
$code = preg_replace('#\t#', str_repeat(' ', CrayonGlobalSettings::val(CrayonSettings::TAB_SIZE)), $code);
|
506 |
return $code;
|
520 |
}
|
521 |
|
522 |
public static function split_lines($code, $class) {
|
|
|
523 |
$code = self::clean_code($code);
|
524 |
+
$code = preg_replace('#^#m', '<span class="'.$class.'">', $code);
|
525 |
+
$code = preg_replace('#(?=\r\n|\r|\n)#m', '</span>', $code);
|
|
|
|
|
|
|
526 |
return $code;
|
527 |
}
|
528 |
|
crayon_highlighter.class.php
CHANGED
@@ -27,7 +27,7 @@ class CrayonHighlighter {
|
|
27 |
private $is_mixed = FALSE;
|
28 |
// Inline code on a single floating line
|
29 |
private $is_inline = FALSE;
|
30 |
-
|
31 |
|
32 |
// Objects
|
33 |
// Stores the CrayonLang being used
|
@@ -174,13 +174,14 @@ class CrayonHighlighter {
|
|
174 |
}
|
175 |
// Save code so output is plain output is the same
|
176 |
$this->code = $code;
|
|
|
177 |
// Allow mixed if langauge supports it and setting is set
|
178 |
if (!$this->setting_val(CrayonSettings::MIXED) || !$this->language->mode(CrayonParser::ALLOW_MIXED)) {
|
179 |
// Format the code with the generated regex and elements
|
180 |
-
$this->formatted_code = CrayonFormatter::format_code($code, $this->language, $this
|
181 |
} else {
|
182 |
// Format the code with Mixed Highlighting
|
183 |
-
$this->formatted_code = CrayonFormatter::format_mixed_code($code, $this->language, $this
|
184 |
}
|
185 |
} catch (Exception $e) {
|
186 |
$this->error($e->message());
|
@@ -194,7 +195,7 @@ class CrayonHighlighter {
|
|
194 |
/* Used to format the glue in between code when finding mixed languages */
|
195 |
private function format_glue($glue, $highlight = TRUE) {
|
196 |
// TODO $highlight
|
197 |
-
return CrayonFormatter::format_code($glue, $this->language, $
|
198 |
}
|
199 |
|
200 |
/* Sends the code to the formatter for printing. Apart from the getters and setters, this is
|
27 |
private $is_mixed = FALSE;
|
28 |
// Inline code on a single floating line
|
29 |
private $is_inline = FALSE;
|
30 |
+
public $is_highlighted = TRUE;
|
31 |
|
32 |
// Objects
|
33 |
// Stores the CrayonLang being used
|
174 |
}
|
175 |
// Save code so output is plain output is the same
|
176 |
$this->code = $code;
|
177 |
+
|
178 |
// Allow mixed if langauge supports it and setting is set
|
179 |
if (!$this->setting_val(CrayonSettings::MIXED) || !$this->language->mode(CrayonParser::ALLOW_MIXED)) {
|
180 |
// Format the code with the generated regex and elements
|
181 |
+
$this->formatted_code = CrayonFormatter::format_code($code, $this->language, $this);
|
182 |
} else {
|
183 |
// Format the code with Mixed Highlighting
|
184 |
+
$this->formatted_code = CrayonFormatter::format_mixed_code($code, $this->language, $this);
|
185 |
}
|
186 |
} catch (Exception $e) {
|
187 |
$this->error($e->message());
|
195 |
/* Used to format the glue in between code when finding mixed languages */
|
196 |
private function format_glue($glue, $highlight = TRUE) {
|
197 |
// TODO $highlight
|
198 |
+
return CrayonFormatter::format_code($glue, $this->language, $this, $highlight);
|
199 |
}
|
200 |
|
201 |
/* Sends the code to the formatter for printing. Apart from the getters and setters, this is
|
crayon_settings.class.php
CHANGED
@@ -549,10 +549,12 @@ class CrayonGlobalSettings {
|
|
549 |
}
|
550 |
|
551 |
public static function val($name = NULL) {
|
|
|
552 |
return self::$global->val($name);
|
553 |
}
|
554 |
|
555 |
public static function val_str($name = NULL) {
|
|
|
556 |
return self::$global->val_str($name);
|
557 |
}
|
558 |
|
549 |
}
|
550 |
|
551 |
public static function val($name = NULL) {
|
552 |
+
self::init();
|
553 |
return self::$global->val($name);
|
554 |
}
|
555 |
|
556 |
public static function val_str($name = NULL) {
|
557 |
+
self::init();
|
558 |
return self::$global->val_str($name);
|
559 |
}
|
560 |
|
crayon_settings_wp.class.php
CHANGED
@@ -291,12 +291,14 @@ class CrayonSettingsWP {
|
|
291 |
return self::wp_root_path() . 'wp-load.php';
|
292 |
}
|
293 |
|
294 |
-
public static function admin_init() {
|
295 |
// Load default settings if they don't exist
|
296 |
-
|
297 |
self::load_settings();
|
|
|
|
|
|
|
|
|
298 |
// General
|
299 |
-
|
300 |
// Some of these will the $editor arguments, if TRUE it will alter for use in the Tag Editor
|
301 |
self::add_section(self::GENERAL, crayon__('General'));
|
302 |
self::add_field(self::GENERAL, crayon__('Theme'), 'theme');
|
@@ -310,8 +312,8 @@ class CrayonSettingsWP {
|
|
310 |
self::add_field(self::GENERAL, crayon__('Files'), 'files');
|
311 |
self::add_field(self::GENERAL, crayon__('Tag Editor'), 'tag_editor');
|
312 |
self::add_field(self::GENERAL, crayon__('Misc'), 'misc');
|
313 |
-
// Debug
|
314 |
|
|
|
315 |
self::add_section(self::DEBUG, crayon__('Debug'));
|
316 |
self::add_field(self::DEBUG, crayon__('Errors'), 'errors');
|
317 |
self::add_field(self::DEBUG, crayon__('Log'), 'log');
|
291 |
return self::wp_root_path() . 'wp-load.php';
|
292 |
}
|
293 |
|
294 |
+
public static function admin_init() {
|
295 |
// Load default settings if they don't exist
|
|
|
296 |
self::load_settings();
|
297 |
+
|
298 |
+
// Update db
|
299 |
+
CrayonWP::update();
|
300 |
+
|
301 |
// General
|
|
|
302 |
// Some of these will the $editor arguments, if TRUE it will alter for use in the Tag Editor
|
303 |
self::add_section(self::GENERAL, crayon__('General'));
|
304 |
self::add_field(self::GENERAL, crayon__('Theme'), 'theme');
|
312 |
self::add_field(self::GENERAL, crayon__('Files'), 'files');
|
313 |
self::add_field(self::GENERAL, crayon__('Tag Editor'), 'tag_editor');
|
314 |
self::add_field(self::GENERAL, crayon__('Misc'), 'misc');
|
|
|
315 |
|
316 |
+
// Debug
|
317 |
self::add_section(self::DEBUG, crayon__('Debug'));
|
318 |
self::add_field(self::DEBUG, crayon__('Errors'), 'errors');
|
319 |
self::add_field(self::DEBUG, crayon__('Log'), 'log');
|
crayon_wp.class.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://ak.net84.net/projects/crayon-syntax-highlighter
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
|
6 |
-
Version: 1.9.
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://ak.net84.net/
|
9 |
Text Domain: crayon-syntax-highlighter
|
@@ -82,9 +82,9 @@ class CrayonWP {
|
|
82 |
|
83 |
// Public Methods =========================================================
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
// Methods ================================================================
|
90 |
|
@@ -832,9 +832,8 @@ if (defined('ABSPATH')) {
|
|
832 |
if (!is_admin()) {
|
833 |
register_activation_hook(__FILE__, 'CrayonWP::install');
|
834 |
register_deactivation_hook(__FILE__, 'CrayonWP::uninstall');
|
835 |
-
CrayonWP::update();
|
836 |
|
837 |
-
|
838 |
add_filter('init', 'CrayonWP::init');
|
839 |
|
840 |
CrayonSettingsWP::load_settings(TRUE);
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://ak.net84.net/projects/crayon-syntax-highlighter
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
|
6 |
+
Version: 1.9.10
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://ak.net84.net/
|
9 |
Text Domain: crayon-syntax-highlighter
|
82 |
|
83 |
// Public Methods =========================================================
|
84 |
|
85 |
+
public static function post_captures() {
|
86 |
+
return self::$post_queue;
|
87 |
+
}
|
88 |
|
89 |
// Methods ================================================================
|
90 |
|
832 |
if (!is_admin()) {
|
833 |
register_activation_hook(__FILE__, 'CrayonWP::install');
|
834 |
register_deactivation_hook(__FILE__, 'CrayonWP::uninstall');
|
|
|
835 |
|
836 |
+
// // Filters and Actions
|
837 |
add_filter('init', 'CrayonWP::init');
|
838 |
|
839 |
CrayonSettingsWP::load_settings(TRUE);
|
langs/apache/haskell.txt
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### HASKELL LANGUAGE ###
|
2 |
+
|
3 |
+
# ELEMENT_NAME [optional-css-class] REGULAR_EXPRESSION
|
4 |
+
|
5 |
+
NAME Haskell
|
6 |
+
VERSION 1.9.8
|
7 |
+
|
8 |
+
COMMENT (--.*?$)|({-[^\}]*})
|
9 |
+
STRING (?default)
|
10 |
+
|
11 |
+
QUALIFIER:VARIABLE (?<=import)\s+[^\s]+
|
12 |
+
RESERVED \b(?alt:reserved.txt)\b
|
13 |
+
TYPE \b(?alt:type.txt)\b
|
14 |
+
|
15 |
+
RECORD:VARIABLE \b\w+\b\s*(?=::)(?=[^{]*})
|
16 |
+
ENTITY \b\w+\b\s*(?=::)
|
17 |
+
ARG:VARIABLE (\b[\w\t ]+\b(?=\s*->))|((?<=->)\s*\b[\w\t ]+\b\s*$)
|
18 |
+
CAPS:VARIABLE (?-i)\b[A-Z]\w+\b(?i)
|
19 |
+
IDENTIFIER (?default)
|
20 |
+
CONSTANT (?default)
|
21 |
+
OPERATOR (?default)
|
22 |
+
SYMBOL (?default)
|
langs/apache/reserved.txt
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
enumFromThenTo
|
2 |
+
properFraction
|
3 |
+
isNegativeZero
|
4 |
+
isDenomalized
|
5 |
+
enumFromThen
|
6 |
+
fromRational
|
7 |
+
fromIntegral
|
8 |
+
fromInteger
|
9 |
+
floatDigits
|
10 |
+
decodeFloat
|
11 |
+
encodeFloat
|
12 |
+
significand
|
13 |
+
getContents
|
14 |
+
enumFromTo
|
15 |
+
toRational
|
16 |
+
floatRadix
|
17 |
+
floatRange
|
18 |
+
scaleFloat
|
19 |
+
isInfinite
|
20 |
+
realToFrac
|
21 |
+
showString
|
22 |
+
appendFile
|
23 |
+
qualified
|
24 |
+
otherwise
|
25 |
+
toInteger
|
26 |
+
sequence_
|
27 |
+
undefined
|
28 |
+
concatMap
|
29 |
+
teakWhile
|
30 |
+
dropWhile
|
31 |
+
showParen
|
32 |
+
readsPrec
|
33 |
+
readParen
|
34 |
+
writeFile
|
35 |
+
userError
|
36 |
+
deriving
|
37 |
+
instance
|
38 |
+
fromEnum
|
39 |
+
enumFrom
|
40 |
+
minBound
|
41 |
+
maxBound
|
42 |
+
truncate
|
43 |
+
exponent
|
44 |
+
subtract
|
45 |
+
sequence
|
46 |
+
asTypeOf
|
47 |
+
zipWith3
|
48 |
+
showPrec
|
49 |
+
showList
|
50 |
+
showChar
|
51 |
+
readList
|
52 |
+
putStrLn
|
53 |
+
interact
|
54 |
+
readFile
|
55 |
+
default
|
56 |
+
newtype
|
57 |
+
Foreign
|
58 |
+
Numeric
|
59 |
+
Prelude
|
60 |
+
uncurry
|
61 |
+
compare
|
62 |
+
quotRem
|
63 |
+
logBase
|
64 |
+
ceiling
|
65 |
+
'filter
|
66 |
+
reverse
|
67 |
+
product
|
68 |
+
maximum
|
69 |
+
minimum
|
70 |
+
iterate
|
71 |
+
splitAt
|
72 |
+
notElem
|
73 |
+
zipWith
|
74 |
+
unlines
|
75 |
+
unwords
|
76 |
+
putChar
|
77 |
+
getChar
|
78 |
+
getLine
|
79 |
+
ioError
|
80 |
+
forall
|
81 |
+
hiding
|
82 |
+
import
|
83 |
+
infixl
|
84 |
+
infixr
|
85 |
+
module
|
86 |
+
either
|
87 |
+
toEnum
|
88 |
+
negate
|
89 |
+
signum
|
90 |
+
divMod
|
91 |
+
isIEEE
|
92 |
+
return
|
93 |
+
length
|
94 |
+
foldl1
|
95 |
+
foldr1
|
96 |
+
concat
|
97 |
+
scanl1
|
98 |
+
scanr1
|
99 |
+
repeat
|
100 |
+
lookup
|
101 |
+
unzip3
|
102 |
+
putStr
|
103 |
+
readIO
|
104 |
+
readLn
|
105 |
+
class
|
106 |
+
infix
|
107 |
+
where
|
108 |
+
maybe
|
109 |
+
curry
|
110 |
+
recip
|
111 |
+
asinh
|
112 |
+
acosh
|
113 |
+
atanh
|
114 |
+
round
|
115 |
+
floor
|
116 |
+
isNaN
|
117 |
+
atan2
|
118 |
+
mapM_
|
119 |
+
const
|
120 |
+
'flip
|
121 |
+
until
|
122 |
+
error
|
123 |
+
foldl
|
124 |
+
foldr
|
125 |
+
scanl
|
126 |
+
scanr
|
127 |
+
cycle
|
128 |
+
break
|
129 |
+
unzip
|
130 |
+
lines
|
131 |
+
words
|
132 |
+
shows
|
133 |
+
reads
|
134 |
+
print
|
135 |
+
catch
|
136 |
+
case
|
137 |
+
data
|
138 |
+
then
|
139 |
+
else
|
140 |
+
type
|
141 |
+
succ
|
142 |
+
pred
|
143 |
+
quot
|
144 |
+
sqrt
|
145 |
+
asin
|
146 |
+
acos
|
147 |
+
atan
|
148 |
+
sinh
|
149 |
+
cosh
|
150 |
+
tanh
|
151 |
+
even
|
152 |
+
fail
|
153 |
+
fmap
|
154 |
+
mapM
|
155 |
+
'map
|
156 |
+
head
|
157 |
+
last
|
158 |
+
tail
|
159 |
+
init
|
160 |
+
null
|
161 |
+
take
|
162 |
+
drop
|
163 |
+
span
|
164 |
+
elem
|
165 |
+
zip3
|
166 |
+
show
|
167 |
+
read
|
168 |
+
let
|
169 |
+
not
|
170 |
+
fst
|
171 |
+
snd
|
172 |
+
max
|
173 |
+
min
|
174 |
+
abs
|
175 |
+
rem
|
176 |
+
div
|
177 |
+
mod
|
178 |
+
exp
|
179 |
+
log
|
180 |
+
sin
|
181 |
+
cos
|
182 |
+
tan
|
183 |
+
odd
|
184 |
+
gcd
|
185 |
+
lcm
|
186 |
+
seq
|
187 |
+
and
|
188 |
+
any
|
189 |
+
all
|
190 |
+
sum
|
191 |
+
zip
|
192 |
+
lex
|
193 |
+
as
|
194 |
+
of
|
195 |
+
do
|
196 |
+
if
|
197 |
+
in
|
198 |
+
pi
|
199 |
+
id
|
200 |
+
or
|
langs/apache/type.txt
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Fractional
|
2 |
+
RealFloat
|
3 |
+
Ordering
|
4 |
+
Rational
|
5 |
+
Integral
|
6 |
+
Floating
|
7 |
+
RealFrac
|
8 |
+
Bounded
|
9 |
+
Integer
|
10 |
+
Functor
|
11 |
+
Either
|
12 |
+
String
|
13 |
+
Double
|
14 |
+
Maybe
|
15 |
+
Float
|
16 |
+
Monad
|
17 |
+
ShowS
|
18 |
+
ReadS
|
19 |
+
Bool
|
20 |
+
Char
|
21 |
+
Enum
|
22 |
+
Real
|
23 |
+
Show
|
24 |
+
Read
|
25 |
+
Ord
|
26 |
+
Int
|
27 |
+
Num
|
28 |
+
Eq
|
29 |
+
IO
|
langs/haskell/haskell.txt
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### HASKELL LANGUAGE ###
|
2 |
+
|
3 |
+
# ELEMENT_NAME [optional-css-class] REGULAR_EXPRESSION
|
4 |
+
|
5 |
+
NAME Haskell
|
6 |
+
VERSION 1.9.8
|
7 |
+
|
8 |
+
COMMENT (--.*?$)|({-[^\}]*})
|
9 |
+
STRING (?default)
|
10 |
+
|
11 |
+
QUALIFIER:VARIABLE (?<=import)\s+[^\s]+
|
12 |
+
RESERVED \b(?alt:reserved.txt)\b
|
13 |
+
TYPE \b(?alt:type.txt)\b
|
14 |
+
|
15 |
+
RECORD:VARIABLE \b\w+\b\s*(?=::)(?=[^{]*})
|
16 |
+
ENTITY \b\w+\b\s*(?=::)
|
17 |
+
ARG:VARIABLE (\b[\w\t ]+\b(?=\s*->))|((?<=->)\s*\b[\w\t ]+\b\s*$)
|
18 |
+
CAPS:VARIABLE (?-i)\b[A-Z]\w+\b(?i)
|
19 |
+
IDENTIFIER (?default)
|
20 |
+
CONSTANT (?default)
|
21 |
+
OPERATOR (?default)
|
22 |
+
SYMBOL (?default)
|
langs/haskell/reserved.txt
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
enumFromThenTo
|
2 |
+
properFraction
|
3 |
+
isNegativeZero
|
4 |
+
isDenomalized
|
5 |
+
enumFromThen
|
6 |
+
fromRational
|
7 |
+
fromIntegral
|
8 |
+
fromInteger
|
9 |
+
floatDigits
|
10 |
+
decodeFloat
|
11 |
+
encodeFloat
|
12 |
+
significand
|
13 |
+
getContents
|
14 |
+
enumFromTo
|
15 |
+
toRational
|
16 |
+
floatRadix
|
17 |
+
floatRange
|
18 |
+
scaleFloat
|
19 |
+
isInfinite
|
20 |
+
realToFrac
|
21 |
+
showString
|
22 |
+
appendFile
|
23 |
+
qualified
|
24 |
+
otherwise
|
25 |
+
toInteger
|
26 |
+
sequence_
|
27 |
+
undefined
|
28 |
+
concatMap
|
29 |
+
teakWhile
|
30 |
+
dropWhile
|
31 |
+
showParen
|
32 |
+
readsPrec
|
33 |
+
readParen
|
34 |
+
writeFile
|
35 |
+
userError
|
36 |
+
deriving
|
37 |
+
instance
|
38 |
+
fromEnum
|
39 |
+
enumFrom
|
40 |
+
minBound
|
41 |
+
maxBound
|
42 |
+
truncate
|
43 |
+
exponent
|
44 |
+
subtract
|
45 |
+
sequence
|
46 |
+
asTypeOf
|
47 |
+
zipWith3
|
48 |
+
showPrec
|
49 |
+
showList
|
50 |
+
showChar
|
51 |
+
readList
|
52 |
+
putStrLn
|
53 |
+
interact
|
54 |
+
readFile
|
55 |
+
default
|
56 |
+
newtype
|
57 |
+
Foreign
|
58 |
+
Numeric
|
59 |
+
Prelude
|
60 |
+
uncurry
|
61 |
+
compare
|
62 |
+
quotRem
|
63 |
+
logBase
|
64 |
+
ceiling
|
65 |
+
'filter
|
66 |
+
reverse
|
67 |
+
product
|
68 |
+
maximum
|
69 |
+
minimum
|
70 |
+
iterate
|
71 |
+
splitAt
|
72 |
+
notElem
|
73 |
+
zipWith
|
74 |
+
unlines
|
75 |
+
unwords
|
76 |
+
putChar
|
77 |
+
getChar
|
78 |
+
getLine
|
79 |
+
ioError
|
80 |
+
forall
|
81 |
+
hiding
|
82 |
+
import
|
83 |
+
infixl
|
84 |
+
infixr
|
85 |
+
module
|
86 |
+
either
|
87 |
+
toEnum
|
88 |
+
negate
|
89 |
+
signum
|
90 |
+
divMod
|
91 |
+
isIEEE
|
92 |
+
return
|
93 |
+
length
|
94 |
+
foldl1
|
95 |
+
foldr1
|
96 |
+
concat
|
97 |
+
scanl1
|
98 |
+
scanr1
|
99 |
+
repeat
|
100 |
+
lookup
|
101 |
+
unzip3
|
102 |
+
putStr
|
103 |
+
readIO
|
104 |
+
readLn
|
105 |
+
class
|
106 |
+
infix
|
107 |
+
where
|
108 |
+
maybe
|
109 |
+
curry
|
110 |
+
recip
|
111 |
+
asinh
|
112 |
+
acosh
|
113 |
+
atanh
|
114 |
+
round
|
115 |
+
floor
|
116 |
+
isNaN
|
117 |
+
atan2
|
118 |
+
mapM_
|
119 |
+
const
|
120 |
+
'flip
|
121 |
+
until
|
122 |
+
error
|
123 |
+
foldl
|
124 |
+
foldr
|
125 |
+
scanl
|
126 |
+
scanr
|
127 |
+
cycle
|
128 |
+
break
|
129 |
+
unzip
|
130 |
+
lines
|
131 |
+
words
|
132 |
+
shows
|
133 |
+
reads
|
134 |
+
print
|
135 |
+
catch
|
136 |
+
case
|
137 |
+
data
|
138 |
+
then
|
139 |
+
else
|
140 |
+
type
|
141 |
+
succ
|
142 |
+
pred
|
143 |
+
quot
|
144 |
+
sqrt
|
145 |
+
asin
|
146 |
+
acos
|
147 |
+
atan
|
148 |
+
sinh
|
149 |
+
cosh
|
150 |
+
tanh
|
151 |
+
even
|
152 |
+
fail
|
153 |
+
fmap
|
154 |
+
mapM
|
155 |
+
'map
|
156 |
+
head
|
157 |
+
last
|
158 |
+
tail
|
159 |
+
init
|
160 |
+
null
|
161 |
+
take
|
162 |
+
drop
|
163 |
+
span
|
164 |
+
elem
|
165 |
+
zip3
|
166 |
+
show
|
167 |
+
read
|
168 |
+
let
|
169 |
+
not
|
170 |
+
fst
|
171 |
+
snd
|
172 |
+
max
|
173 |
+
min
|
174 |
+
abs
|
175 |
+
rem
|
176 |
+
div
|
177 |
+
mod
|
178 |
+
exp
|
179 |
+
log
|
180 |
+
sin
|
181 |
+
cos
|
182 |
+
tan
|
183 |
+
odd
|
184 |
+
gcd
|
185 |
+
lcm
|
186 |
+
seq
|
187 |
+
and
|
188 |
+
any
|
189 |
+
all
|
190 |
+
sum
|
191 |
+
zip
|
192 |
+
lex
|
193 |
+
as
|
194 |
+
of
|
195 |
+
do
|
196 |
+
if
|
197 |
+
in
|
198 |
+
pi
|
199 |
+
id
|
200 |
+
or
|
langs/haskell/type.txt
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Fractional
|
2 |
+
RealFloat
|
3 |
+
Ordering
|
4 |
+
Rational
|
5 |
+
Integral
|
6 |
+
Floating
|
7 |
+
RealFrac
|
8 |
+
Bounded
|
9 |
+
Integer
|
10 |
+
Functor
|
11 |
+
Either
|
12 |
+
String
|
13 |
+
Double
|
14 |
+
Maybe
|
15 |
+
Float
|
16 |
+
Monad
|
17 |
+
ShowS
|
18 |
+
ReadS
|
19 |
+
Bool
|
20 |
+
Char
|
21 |
+
Enum
|
22 |
+
Real
|
23 |
+
Show
|
24 |
+
Read
|
25 |
+
Ord
|
26 |
+
Int
|
27 |
+
Num
|
28 |
+
Eq
|
29 |
+
IO
|
langs/tex/tex.txt
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### TeX LANGUAGE ###
|
2 |
+
# http://blog.keyboardplaying.org/2012/06/08/syntax-highlighting-latex/
|
3 |
+
# ELEMENT_NAME [optional-css-class] REGULAR_EXPRESSION
|
4 |
+
|
5 |
+
NAME TeX
|
6 |
+
VERSION 1.9.8
|
7 |
+
|
8 |
+
COMMENT (?<!\\)%.*?$
|
9 |
+
|
10 |
+
# Make math formulaes appear as Strings
|
11 |
+
MATH:STRING ((?<!\\)\$\$.*?(?<!\\)\$\$)|((?<!\\)\$.*?(?<!\\)\$)|((?<!\\)\\\[.*?(?<!\\)\\\])
|
12 |
+
|
13 |
+
STATEMENT (\\[\w]+)|(\\['`^"~=.$vuH][\w]?)
|
14 |
+
|
15 |
+
SYMBOL (?<!\\)(?default)
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: akarmenia
|
|
3 |
Donate link: https://www.paypal.com/au/cgi-bin/webscr?cmd=_flow&SESSION=PPqWIQJ0gEZp4pVGNnYzhcwFGvx3MGwD95tvUcZgeYlHIEjBS7x6QHG34B4&dispatch=5885d80a13c0db1f8e263663d3faee8d0288a7fd2903afb85a5540fd44243d03
|
4 |
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
|
@@ -72,6 +72,7 @@ See the <a href="http://ak.net84.net/projects/crayon-language-file-specification
|
|
72 |
* C#
|
73 |
* C++
|
74 |
* CSS
|
|
|
75 |
* HTML (XML/XHTML)
|
76 |
* Lua
|
77 |
* Monkey (thanks to <a href="https://github.com/devolonter" target="_blank">Devolonter</a>)
|
@@ -86,6 +87,7 @@ See the <a href="http://ak.net84.net/projects/crayon-language-file-specification
|
|
86 |
* Ruby
|
87 |
* Scheme (thanks to <a href="https://github.com/harry75369" target="_blank">Harry75369</a>)
|
88 |
* Shell (Unix)
|
|
|
89 |
* Visual Basic
|
90 |
* YAML
|
91 |
* Others will be added when requested
|
@@ -197,6 +199,20 @@ Contact me at http://twitter.com/crayonsyntax or crayon.syntax@gmail.com.
|
|
197 |
|
198 |
== Changelog ==
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
= 1.9.7 =
|
201 |
* Fixed a crucial but hard to spot bug causing Crayon code to break by incorrectly handling ignored Crayons
|
202 |
* Added functions to generate Crayons when given Crayon tags in strings like the post content
|
3 |
Donate link: https://www.paypal.com/au/cgi-bin/webscr?cmd=_flow&SESSION=PPqWIQJ0gEZp4pVGNnYzhcwFGvx3MGwD95tvUcZgeYlHIEjBS7x6QHG34B4&dispatch=5885d80a13c0db1f8e263663d3faee8d0288a7fd2903afb85a5540fd44243d03
|
4 |
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.4
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
|
72 |
* C#
|
73 |
* C++
|
74 |
* CSS
|
75 |
+
* Haskell
|
76 |
* HTML (XML/XHTML)
|
77 |
* Lua
|
78 |
* Monkey (thanks to <a href="https://github.com/devolonter" target="_blank">Devolonter</a>)
|
87 |
* Ruby
|
88 |
* Scheme (thanks to <a href="https://github.com/harry75369" target="_blank">Harry75369</a>)
|
89 |
* Shell (Unix)
|
90 |
+
* TeX
|
91 |
* Visual Basic
|
92 |
* YAML
|
93 |
* Others will be added when requested
|
199 |
|
200 |
== Changelog ==
|
201 |
|
202 |
+
= 1.9.10 =
|
203 |
+
* Another fix regarding the \r\n line breaks
|
204 |
+
|
205 |
+
= 1.9.9 =
|
206 |
+
* Fixed a bug caused when ensuring "\r\n" was present in 1.9.8. It was due to using '\r\n' instead of "\r\n".
|
207 |
+
|
208 |
+
= 1.9.8 =
|
209 |
+
* New API to access Crayon internals
|
210 |
+
* Added TeX thanks to http://blog.keyboardplaying.org/2012/06/08/syntax-highlighting-latex/
|
211 |
+
* Moved update method into settings page to improve efficiency a bit
|
212 |
+
* Fixed an issue causing HTML spaces to appear in plain code
|
213 |
+
* Made sure \r\n was present for all line breaks in plain code
|
214 |
+
* Fixed minor bugs in settings
|
215 |
+
|
216 |
= 1.9.7 =
|
217 |
* Fixed a crucial but hard to spot bug causing Crayon code to break by incorrectly handling ignored Crayons
|
218 |
* Added functions to generate Crayons when given Crayon tags in strings like the post content
|
util/sample/haskell.txt
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module Interpret(interpret) where
|
2 |
+
|
3 |
+
import Prog
|
4 |
+
|
5 |
+
import System.IO.Unsafe
|
6 |
+
import Control.Monad
|
7 |
+
import Char
|
8 |
+
|
9 |
+
-- In a call to this function such as "interpret prog vars entry debug":
|
10 |
+
-- prog is the ABCD program to be interpreted;
|
11 |
+
-- vars represents the initial values of the four variables;
|
12 |
+
-- entry is the name of the entry point function, "main" by default; and
|
13 |
+
-- debug specifies whether the user wants debugging output.
|
14 |
+
|
15 |
+
interpret :: Prog -> Vars -> String -> MaybeDebug -> IO ()
|
16 |
+
interpret prog vars entry debug = do
|
17 |
+
let context = Context prog vars entry debug 0
|
18 |
+
let newContext = runFunc entry context
|
19 |
+
let output =
|
20 |
+
case newContext of
|
21 |
+
IError s -> "abcdi: " ++ s
|
22 |
+
IOK c -> (strVal (getVar A (cVars c))) ++ "\n"
|
23 |
+
putStrLn output
|
util/sample/tex.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
\begin{document}
|
2 |
+
\hello % Here a comment
|
3 |
+
% Here a comment from line beginning
|
4 |
+
|
5 |
+
10\% is not a comment.
|