Version Description
- Added the feature to specify the starting line number both globally in settings and also using the attribute: ** [crayon start-line="1234"]fun code[/crayon]
- Thanks for the suggestion from travishill: ** http://wordpress.org/support/topic/plugin-crayon-syntax-highlighter-add-the-ability-to-specify-starting-line-number?replies=2#post-2389518
=
Download this release
Release Info
Developer | akarmenia |
Plugin | Crayon Syntax Highlighter |
Version | 1.2.1 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.2.1
- crayon_formatter.class.php +6 -2
- crayon_settings.class.php +2 -0
- crayon_settings_wp.class.php +2 -0
- crayon_wp.class.php +1 -1
- readme.txt +7 -1
- util/help.htm +5 -0
crayon_formatter.class.php
CHANGED
@@ -71,6 +71,9 @@ class CrayonFormatter {
|
|
71 |
$print_code = '';
|
72 |
$print_nums = '';
|
73 |
$hl->line_count(preg_match_all("|^.*$|m", $code, $code_lines));
|
|
|
|
|
|
|
74 |
for ($i = 1; $i <= $hl->line_count(); $i++) {
|
75 |
$code_line = $code_lines[0][$i - 1];
|
76 |
// Check if the current line has been selected
|
@@ -100,9 +103,10 @@ class CrayonFormatter {
|
|
100 |
$striped_num = $striped_line = '';
|
101 |
}
|
102 |
// Generate the lines
|
103 |
-
$
|
|
|
104 |
if (!is_string($line_numbers)) {
|
105 |
-
$print_nums .= '<div class="crayon-num' . $marked_num . $striped_num . '">' . $
|
106 |
}
|
107 |
}
|
108 |
// If $line_numbers is a string, display it
|
71 |
$print_code = '';
|
72 |
$print_nums = '';
|
73 |
$hl->line_count(preg_match_all("|^.*$|m", $code, $code_lines));
|
74 |
+
|
75 |
+
// The line number to start from
|
76 |
+
$start_line = $hl->setting_val(CrayonSettings::START_LINE);
|
77 |
for ($i = 1; $i <= $hl->line_count(); $i++) {
|
78 |
$code_line = $code_lines[0][$i - 1];
|
79 |
// Check if the current line has been selected
|
103 |
$striped_num = $striped_line = '';
|
104 |
}
|
105 |
// Generate the lines
|
106 |
+
$line_num = $start_line + $i - 1;
|
107 |
+
$print_code .= '<div class="crayon-line' . $marked_line . $striped_line . '" id="line-' . $line_num . '">' . $code_line . '</div>';
|
108 |
if (!is_string($line_numbers)) {
|
109 |
+
$print_nums .= '<div class="crayon-num' . $marked_num . $striped_num . '">' . $line_num . '</div>';
|
110 |
}
|
111 |
}
|
112 |
// If $line_numbers is a string, display it
|
crayon_settings.class.php
CHANGED
@@ -45,6 +45,7 @@ class CrayonSettings {
|
|
45 |
const SHOW_TITLE = 'show-title';
|
46 |
const STRIPED = 'striped';
|
47 |
const MARKING = 'marking';
|
|
|
48 |
const NUMS = 'nums';
|
49 |
const NUMS_TOGGLE = 'nums-toggle';
|
50 |
const TRIM_WHITESPACE = 'trim-whitespace';
|
@@ -120,6 +121,7 @@ class CrayonSettings {
|
|
120 |
new CrayonSetting(self::SHOW_TITLE, TRUE),
|
121 |
new CrayonSetting(self::STRIPED, TRUE),
|
122 |
new CrayonSetting(self::MARKING, TRUE),
|
|
|
123 |
new CrayonSetting(self::NUMS, TRUE),
|
124 |
new CrayonSetting(self::NUMS_TOGGLE, TRUE),
|
125 |
new CrayonSetting(self::TRIM_WHITESPACE, TRUE),
|
45 |
const SHOW_TITLE = 'show-title';
|
46 |
const STRIPED = 'striped';
|
47 |
const MARKING = 'marking';
|
48 |
+
const START_LINE = 'start-line';
|
49 |
const NUMS = 'nums';
|
50 |
const NUMS_TOGGLE = 'nums-toggle';
|
51 |
const TRIM_WHITESPACE = 'trim-whitespace';
|
121 |
new CrayonSetting(self::SHOW_TITLE, TRUE),
|
122 |
new CrayonSetting(self::STRIPED, TRUE),
|
123 |
new CrayonSetting(self::MARKING, TRUE),
|
124 |
+
new CrayonSetting(self::START_LINE, 1),
|
125 |
new CrayonSetting(self::NUMS, TRUE),
|
126 |
new CrayonSetting(self::NUMS_TOGGLE, TRUE),
|
127 |
new CrayonSetting(self::TRIM_WHITESPACE, TRUE),
|
crayon_settings_wp.class.php
CHANGED
@@ -374,6 +374,8 @@ EOT;
|
|
374 |
self::checkbox(array(CrayonSettings::MARKING, 'Enable line marking for important lines'));
|
375 |
self::checkbox(array(CrayonSettings::NUMS, 'Display line numbers by default'));
|
376 |
self::checkbox(array(CrayonSettings::NUMS_TOGGLE, 'Enable line number toggling'));
|
|
|
|
|
377 |
}
|
378 |
|
379 |
public static function langs() {
|
374 |
self::checkbox(array(CrayonSettings::MARKING, 'Enable line marking for important lines'));
|
375 |
self::checkbox(array(CrayonSettings::NUMS, 'Display line numbers by default'));
|
376 |
self::checkbox(array(CrayonSettings::NUMS_TOGGLE, 'Enable line number toggling'));
|
377 |
+
echo 'Start line numbers from: ';
|
378 |
+
self::textbox(array('name' => CrayonSettings::START_LINE, 'size' => 2, 'break' => TRUE));
|
379 |
}
|
380 |
|
381 |
public static function langs() {
|
crayon_wp.class.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://ak.net84.net/
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text. <a href="options-general.php?page=crayon_settings">View Settings.</a>
|
6 |
-
Version: 1.2
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://ak.net84.net/
|
9 |
License: GPL2
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://ak.net84.net/
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text. <a href="options-general.php?page=crayon_settings">View Settings.</a>
|
6 |
+
Version: 1.2.1
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://ak.net84.net/
|
9 |
License: GPL2
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://ak.net84.net/
|
|
4 |
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3
|
7 |
-
Stable tag: 1.2.
|
8 |
|
9 |
Syntax Highlighter supporting multiple languages, themes, highlighting from a URL, local file or post text.
|
10 |
|
@@ -75,6 +75,12 @@ Contact me at http://twitter.com/crayonsyntax or crayon.syntax@gmail.com.
|
|
75 |
* Removed redundant dependency on filesystem path slashes
|
76 |
* PHP now fades surrounding HTML
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
== Upgrade Notice ==
|
79 |
|
80 |
No issues upgrading.
|
4 |
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3
|
7 |
+
Stable tag: 1.2.1
|
8 |
|
9 |
Syntax Highlighter supporting multiple languages, themes, highlighting from a URL, local file or post text.
|
10 |
|
75 |
* Removed redundant dependency on filesystem path slashes
|
76 |
* PHP now fades surrounding HTML
|
77 |
|
78 |
+
= 1.2.1 =
|
79 |
+
* Added the feature to specify the starting line number both globally in settings and also using the attribute:
|
80 |
+
** [crayon start-line="1234"]fun code[/crayon]
|
81 |
+
* Thanks for the suggestion from travishill:
|
82 |
+
** http://wordpress.org/support/topic/plugin-crayon-syntax-highlighter-add-the-ability-to-specify-starting-line-number?replies=2#post-2389518
|
83 |
+
|
84 |
== Upgrade Notice ==
|
85 |
|
86 |
No issues upgrading.
|
util/help.htm
CHANGED
@@ -63,6 +63,11 @@
|
|
63 |
<td width="60%">Set the font size in pixels.</td>
|
64 |
<td width="30%"><code>font-size="20"</code></td>
|
65 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
66 |
</table>
|
67 |
<p>Here's a simple example of attributes:</p>
|
68 |
<p><code>
|
63 |
<td width="60%">Set the font size in pixels.</td>
|
64 |
<td width="30%"><code>font-size="20"</code></td>
|
65 |
</tr>
|
66 |
+
<tr>
|
67 |
+
<td width="20">start-line</td>
|
68 |
+
<td width="60%">Set the starting line number.</td>
|
69 |
+
<td width="30%"><code>start-line="184"</code></td>
|
70 |
+
</tr>
|
71 |
</table>
|
72 |
<p>Here's a simple example of attributes:</p>
|
73 |
<p><code>
|