Crayon Syntax Highlighter - Version 2.3.1

Version Description

  • ADDED:
    • New setting to remove <code> blocks surrounding the code, often not intended to be in the code itself
    • Scala language thanks to https://github.com/vkostyukov
  • FIXED:
    • Most important documentation paths now point to github docs.
Download this release

Release Info

Developer akarmenia
Plugin Icon wp plugin Crayon Syntax Highlighter
Version 2.3.1
Comparing to
See all releases

Code changes from version 2.3.0 to 2.3.1

crayon_highlighter.class.php CHANGED
@@ -226,7 +226,12 @@ class CrayonHighlighter {
226
  if ($this->setting_val(CrayonSettings::TRIM_WHITESPACE)) {
227
  $code = preg_replace("#(?:^\\s*\\r?\\n)|(?:\\r?\\n\\s*$)#", '', $code);
228
  }
229
-
 
 
 
 
 
230
  $before = $this->setting_val(CrayonSettings::WHITESPACE_BEFORE);
231
  if ($before > 0) {
232
  $code = str_repeat("\n", $before) . $code;
226
  if ($this->setting_val(CrayonSettings::TRIM_WHITESPACE)) {
227
  $code = preg_replace("#(?:^\\s*\\r?\\n)|(?:\\r?\\n\\s*$)#", '', $code);
228
  }
229
+
230
+ if ($this->setting_val(CrayonSettings::TRIM_CODE_TAG)) {
231
+ $code = preg_replace('#^\s*<\s*code[^>]*>#msi', '', $code);
232
+ $code = preg_replace('#</\s*code[^>]*>\s*$#msi', '', $code);
233
+ }
234
+
235
  $before = $this->setting_val(CrayonSettings::WHITESPACE_BEFORE);
236
  if ($before > 0) {
237
  $code = str_repeat("\n", $before) . $code;
crayon_settings.class.php CHANGED
@@ -62,6 +62,7 @@ class CrayonSettings {
62
  const TRIM_WHITESPACE = 'trim-whitespace';
63
  const WHITESPACE_BEFORE = 'whitespace-before';
64
  const WHITESPACE_AFTER = 'whitespace-after';
 
65
  const TAB_SIZE = 'tab-size';
66
  const FALLBACK_LANG = 'fallback-lang';
67
  const LOCAL_PATH = 'local-path';
@@ -193,6 +194,7 @@ class CrayonSettings {
193
  new CrayonSetting(self::TRIM_WHITESPACE, TRUE),
194
  new CrayonSetting(self::WHITESPACE_BEFORE, 0),
195
  new CrayonSetting(self::WHITESPACE_AFTER, 0),
 
196
  new CrayonSetting(self::TAB_SIZE, 4),
197
  new CrayonSetting(self::FALLBACK_LANG, CrayonLangs::DEFAULT_LANG),
198
  new CrayonSetting(self::LOCAL_PATH, ''),
62
  const TRIM_WHITESPACE = 'trim-whitespace';
63
  const WHITESPACE_BEFORE = 'whitespace-before';
64
  const WHITESPACE_AFTER = 'whitespace-after';
65
+ const TRIM_CODE_TAG = 'trim-code-tag';
66
  const TAB_SIZE = 'tab-size';
67
  const FALLBACK_LANG = 'fallback-lang';
68
  const LOCAL_PATH = 'local-path';
194
  new CrayonSetting(self::TRIM_WHITESPACE, TRUE),
195
  new CrayonSetting(self::WHITESPACE_BEFORE, 0),
196
  new CrayonSetting(self::WHITESPACE_AFTER, 0),
197
+ new CrayonSetting(self::TRIM_CODE_TAG, TRUE),
198
  new CrayonSetting(self::TAB_SIZE, 4),
199
  new CrayonSetting(self::FALLBACK_LANG, CrayonLangs::DEFAULT_LANG),
200
  new CrayonSetting(self::LOCAL_PATH, ''),
crayon_settings_wp.class.php CHANGED
@@ -1092,6 +1092,7 @@ class Human {
1092
  echo '<div class="crayon-hide-inline-only">';
1093
  self::checkbox(array(CrayonSettings::TRIM_WHITESPACE, crayon__('Remove whitespace surrounding the shortcode content')));
1094
  echo '</div>';
 
1095
  self::checkbox(array(CrayonSettings::MIXED, crayon__('Allow Mixed Language Highlighting with delimiters and tags.') . self::help_button('http://bit.ly/ukwts2')));
1096
  echo '<div class="crayon-hide-inline-only">';
1097
  self::checkbox(array(CrayonSettings::SHOW_MIXED, crayon__('Show Mixed Language Icon (+)')));
1092
  echo '<div class="crayon-hide-inline-only">';
1093
  self::checkbox(array(CrayonSettings::TRIM_WHITESPACE, crayon__('Remove whitespace surrounding the shortcode content')));
1094
  echo '</div>';
1095
+ self::checkbox(array(CrayonSettings::TRIM_CODE_TAG, crayon__('Remove &lt;code&gt; tags surrounding the shortcode content')));
1096
  self::checkbox(array(CrayonSettings::MIXED, crayon__('Allow Mixed Language Highlighting with delimiters and tags.') . self::help_button('http://bit.ly/ukwts2')));
1097
  echo '<div class="crayon-hide-inline-only">';
1098
  self::checkbox(array(CrayonSettings::SHOW_MIXED, crayon__('Show Mixed Language Icon (+)')));
crayon_wp.class.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
  Plugin Name: Crayon Syntax Highlighter
4
- Plugin URI: http://aramk.com/projects/crayon-syntax-highlighter
5
  Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
6
- Version: 2.3.0
7
  Author: Aram Kocharyan
8
  Author URI: http://aramk.com/
9
  Text Domain: crayon-syntax-highlighter
1
  <?php
2
  /*
3
  Plugin Name: Crayon Syntax Highlighter
4
+ Plugin URI: https://github.com/aramkocharyan/crayon-syntax-highlighter
5
  Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
6
+ Version: 2.3.1
7
  Author: Aram Kocharyan
8
  Author URI: http://aramk.com/
9
  Text Domain: crayon-syntax-highlighter
global.php CHANGED
@@ -21,7 +21,7 @@ $CRAYON_DATE = '27th September, 2011';
21
  $CRAYON_AUTHOR = 'Aram Kocharyan';
22
  $CRAYON_AUTHOR_SITE = 'http://aramk.com/';
23
  $CRAYON_DONATE = 'http://bit.ly/crayondonate';
24
- $CRAYON_WEBSITE = 'http://aramk.com/projects/crayon-syntax-highlighter';
25
  $CRAYON_EMAIL = 'crayon.syntax@gmail.com';
26
  $CRAYON_TWITTER = 'http://twitter.com/crayonsyntax';
27
  $CRAYON_GIT = 'http://github.com/aramkocharyan/crayon-syntax-highlighter/';
21
  $CRAYON_AUTHOR = 'Aram Kocharyan';
22
  $CRAYON_AUTHOR_SITE = 'http://aramk.com/';
23
  $CRAYON_DONATE = 'http://bit.ly/crayondonate';
24
+ $CRAYON_WEBSITE = 'https://github.com/aramkocharyan/crayon-syntax-highlighter';
25
  $CRAYON_EMAIL = 'crayon.syntax@gmail.com';
26
  $CRAYON_TWITTER = 'http://twitter.com/crayonsyntax';
27
  $CRAYON_GIT = 'http://github.com/aramkocharyan/crayon-syntax-highlighter/';
langs/scala/modifier.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ abstract
2
+ lazy
3
+ override
4
+ sealed
5
+ private
6
+ final
7
+ implicit
8
+ protected
langs/scala/reserved.txt ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import
2
+ do
3
+ object
4
+ return
5
+ trait
6
+ var
7
+ _
8
+ case
9
+ else
10
+ for
11
+ finally
12
+ try
13
+ while
14
+ catch
15
+ extends
16
+ forSome
17
+ match
18
+ package
19
+ super
20
+ true
21
+ with
22
+ class
23
+ false
24
+ if
25
+ new
26
+ this
27
+ type
28
+ yield
29
+ def
30
+ null
31
+ throw
32
+ val
33
+ :
34
+ =
35
+ =>
36
+ <-
37
+ <:
38
+ <%
39
+ >:
40
+ #
langs/scala/scala.txt ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### JAVA LANGUAGE ###
2
+
3
+ # ELEMENT_NAME [optional-css-class] REGULAR_EXPRESSION
4
+
5
+ NAME Scala
6
+ VERSION 2.10.0
7
+
8
+ COMMENT (?default)
9
+ STRING (?default)
10
+
11
+ NOTATION \@[\w-]+
12
+ STATEMENT (?default)
13
+ RESERVED (?default)|\b(?alt:reserved.txt)\b
14
+ TYPE (?default)
15
+ MODIFIER (?default)|\b(?alt:modifier.txt)\b
16
+
17
+ ENTITY (?default)|\b[a-z_]\w+\s*\|\s*[a-z_]\w+\b\s+(?=\b[a-z_]\w+\b)
18
+ VARIABLE (?default)
19
+ GENERIC:ENTITY <\w+>
20
+ IDENTIFIER (?default)
21
+ CONSTANT (?default)
22
+ OPERATOR (?default)
23
+ SYMBOL (?default)
readme.txt CHANGED
@@ -57,7 +57,7 @@ It also supports some neat features like:
57
  * <a href="https://github.com/aramkocharyan/crayon-syntax-highlighter" target="_blank">Beta Releases</a>
58
  * <a href="http://aramk.com/crayon/crayon-themes/" target="_blank">Themes Demo</a>
59
  * <a href="http://aksandbox.webege.com/?p=1" target="_blank">Live Demo</a>
60
- * <a href="http://aramk.com/projects/crayon-syntax-highlighter/" target="_blank">Short How-To</a>
61
 
62
  **Contributions**
63
 
@@ -186,6 +186,7 @@ A handful of articles from others written about Crayon, thanks guys!
186
 
187
  Thanks to all those who donate to the project:
188
 
 
189
  * Ivan Churakov, Russia
190
  * Carla Macías González, Mexico
191
  * Saulius Stonys, Lithuania
@@ -233,7 +234,7 @@ Thanks to all those who donate to the project:
233
 
234
  == Frequently Asked Questions ==
235
 
236
- Please see the <a href="http://aramk.com/projects/crayon-syntax-highlighter/" target="_blank">documentation</a> for all the details.
237
 
238
  = Support =
239
 
@@ -249,12 +250,20 @@ Contact me at http://twitter.com/crayonsyntax or crayon.syntax@gmail.com.
249
 
250
  == Changelog ==
251
 
 
 
 
 
 
 
 
252
  = 2.3.0 =
253
  * ADDED:
254
  * Ada langauge from https://github.com/antiphasis/crayon-lang-ada
255
  * Monokai theme
256
  * CG Cookie theme
257
  * MATLAB language
 
258
  * FIXED:
259
  * Escaping quotes in strings
260
  * R language type literals
@@ -786,7 +795,7 @@ Contact me at http://twitter.com/crayonsyntax or crayon.syntax@gmail.com.
786
  = 1.7.3 =
787
  * Added Mini Tags and Plain Tags into Crayon. http://aramk.com/projects/mini-tags-in-crayon/
788
  * Fixed a bug causing RSS feeds to contain malformed HTML of Crayons, now it shows plain code with correct indentations. Thanks to Артём.
789
- * Updated help in Settings and http://aramk.com/projects/crayon-syntax-highlighter/
790
 
791
  = 1.7.2 =
792
  * Fixed a bug that prevented foreign languages from being initialised and used. Thanks to @west_323 for finding it.
57
  * <a href="https://github.com/aramkocharyan/crayon-syntax-highlighter" target="_blank">Beta Releases</a>
58
  * <a href="http://aramk.com/crayon/crayon-themes/" target="_blank">Themes Demo</a>
59
  * <a href="http://aksandbox.webege.com/?p=1" target="_blank">Live Demo</a>
60
+ * <a href="https://github.com/aramkocharyan/crayon-syntax-highlighter" target="_blank">Short How-To</a>
61
 
62
  **Contributions**
63
 
186
 
187
  Thanks to all those who donate to the project:
188
 
189
+ * Kho Minh Vi, (http://khominhvi.com/), UK
190
  * Ivan Churakov, Russia
191
  * Carla Macías González, Mexico
192
  * Saulius Stonys, Lithuania
234
 
235
  == Frequently Asked Questions ==
236
 
237
+ Please see the <a href="https://github.com/aramkocharyan/crayon-syntax-highlighter" target="_blank">documentation</a> for all the details.
238
 
239
  = Support =
240
 
250
 
251
  == Changelog ==
252
 
253
+ = 2.3.1 =
254
+ * ADDED:
255
+ * New setting to remove &lt;code&gt; blocks surrounding the code, often not intended to be in the code itself
256
+ * Scala language thanks to https://github.com/vkostyukov
257
+ * FIXED:
258
+ * Most important documentation paths now point to github docs.
259
+
260
  = 2.3.0 =
261
  * ADDED:
262
  * Ada langauge from https://github.com/antiphasis/crayon-lang-ada
263
  * Monokai theme
264
  * CG Cookie theme
265
  * MATLAB language
266
+ * Scala language
267
  * FIXED:
268
  * Escaping quotes in strings
269
  * R language type literals
795
  = 1.7.3 =
796
  * Added Mini Tags and Plain Tags into Crayon. http://aramk.com/projects/mini-tags-in-crayon/
797
  * Fixed a bug causing RSS feeds to contain malformed HTML of Crayons, now it shows plain code with correct indentations. Thanks to Артём.
798
+ * Updated help in Settings and https://github.com/aramkocharyan/crayon-syntax-highlighter
799
 
800
  = 1.7.2 =
801
  * Fixed a bug that prevented foreign languages from being initialised and used. Thanks to @west_323 for finding it.
util/sample/scala.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // A sample class
2
+ object Newton extends App {
3
+
4
+ def EPS = 1e-5
5
+
6
+ def sqrt(x: Double): Double = {
7
+ def loop(y: Double): Double =
8
+ if (math.abs(y * y - x) > EPS) loop(((x / y) + y) / 2.0)
9
+ else y
10
+
11
+ loop(1.0)
12
+ }
13
+
14
+ println(sqrt(2.0)) // 1.41
15
+ }