liquid_cms 0.3.0.1 → 0.3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +5 -1
- data/Gemfile.lock +1 -1
- data/README.rdoc +5 -1
- data/app/helpers/cms/common_helper.rb +1 -0
- data/app/views/cms/pages/_page.html.erb +2 -1
- data/app/views/layouts/cms.html.erb +2 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/LICENSE +2 -2
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/css/csscolors.css +12 -8
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/css/docs.css +123 -29
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/csstest.html +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/htmltest.html +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/index.html +232 -179
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/codemirror.js +211 -65
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/editor.js +360 -194
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/mirrorframe.js +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/parsecss.js +11 -7
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/parsejavascript.js +14 -5
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/parsesparql.js +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/select.js +140 -87
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/stringstream.js +5 -0
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/tokenizejavascript.js +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/undo.js +7 -7
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/manual.html +148 -52
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/story.html +631 -614
- data/lib/generators/liquid_cms/templates/public/cms/stylesheets/styles.css +7 -7
- data/lib/liquid_cms/version.rb +1 -1
- metadata +4 -26
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/lua/LICENSE +0 -32
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/lua/css/luacolors.css +0 -63
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/lua/index.html +0 -68
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/lua/js/parselua.js +0 -253
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/LICENSE +0 -37
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/css/phpcolors.css +0 -114
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/index.html +0 -292
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/js/parsephp.js +0 -371
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/js/parsephphtmlmixed.js +0 -90
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/js/tokenizephp.js +0 -1006
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/plsql/LICENSE +0 -22
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/plsql/css/plsqlcolors.css +0 -57
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/plsql/index.html +0 -67
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/plsql/js/parseplsql.js +0 -233
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/python/LICENSE +0 -32
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/python/css/pythoncolors.css +0 -58
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/python/index.html +0 -141
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/python/js/parsepython.js +0 -542
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/sql/LICENSE +0 -22
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/sql/css/sqlcolors.css +0 -57
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/sql/index.html +0 -56
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/sql/js/parsesql.js +0 -211
@@ -1,22 +1,23 @@
|
|
1
|
-
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
2
3
|
<head>
|
3
|
-
<title>CodeMirror
|
4
|
+
<title>CodeMirror: User Manual</title>
|
4
5
|
<link rel="stylesheet" type="text/css" href="css/docs.css"/>
|
6
|
+
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans+Mono|Droid+Sans:bold"/>
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
5
8
|
</head>
|
6
9
|
<body>
|
7
|
-
<h1 class="underline">CodeMirror user manual</h1>
|
8
10
|
|
9
|
-
|
11
|
+
<h1><span class="logo-braces">{ }</span> CodeMirror</h1>
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
</ul>
|
13
|
+
<pre class="grey">
|
14
|
+
/* User manual and
|
15
|
+
reference guide */
|
16
|
+
</pre>
|
17
|
+
|
18
|
+
<div class="clear"><div class="leftbig blk">
|
18
19
|
|
19
|
-
<h2 id="
|
20
|
+
<h2 id="usage">Basic Usage</h2>
|
20
21
|
|
21
22
|
<p>Inside the editor, the tab key is used to re-indent the current
|
22
23
|
selection (or the current line when nothing is selected), and
|
@@ -112,6 +113,10 @@
|
|
112
113
|
stylesheet: "lib/codemirror/css/jscolors.css"
|
113
114
|
});</pre>
|
114
115
|
|
116
|
+
<p>Instances created like this will have a
|
117
|
+
<code>toTextArea()</code> method which removes them and restores
|
118
|
+
the text area they were based on.</p>
|
119
|
+
|
115
120
|
<p>The reason that the script path has to be configured is that
|
116
121
|
CodeMirror will load in a bunch of extra files when an editor is
|
117
122
|
created (the parser script, among others). To be able to do this,
|
@@ -145,7 +150,7 @@
|
|
145
150
|
when you are trying to figure out how they work, but wastes a lot
|
146
151
|
of bandwidth in a production system. Take a look at the
|
147
152
|
description of the <code>basefiles</code> option below if you want
|
148
|
-
to concatenate and minimise the library.</p>
|
153
|
+
to concatenate and minimise the library (see the <a href="compress.html">compression API</a>).</p>
|
149
154
|
|
150
155
|
<p>Apart from these, there are files that implement the various
|
151
156
|
parsers. These all start with either <code>parse</code> or
|
@@ -177,10 +182,14 @@
|
|
177
182
|
|
178
183
|
<dl>
|
179
184
|
|
180
|
-
<dt><code>stylesheet</code></dt><dd>The file name of the
|
181
|
-
that should be used to colour the
|
185
|
+
<dt><code>stylesheet</code></dt><dd>The file name of the
|
186
|
+
style-sheet, or style-sheets, that should be used to colour the
|
187
|
+
code in the editor frame. Can be a string or an array of
|
188
|
+
strings. See <a
|
182
189
|
href="css/jscolors.css"><code>jscolors.css</code></a> for an
|
183
|
-
example
|
190
|
+
example. The set of active stylesheets can be changed in a
|
191
|
+
running editor with the <code>setStylesheet</code> method, which
|
192
|
+
also takes a string or array of strings as argument.</dd>
|
184
193
|
|
185
194
|
<dt><code>path</code></dt><dd>The path that is prefixed to
|
186
195
|
script file names when they are loaded into an IFRAME. (Note that
|
@@ -257,7 +266,11 @@
|
|
257
266
|
|
258
267
|
<dt><code>width</code>, <code>height</code></dt><dd>The size of
|
259
268
|
the editor frame, given as a style-sheet quantities (for example
|
260
|
-
<code>"600px"</code> or <code>"100%"</code>)
|
269
|
+
<code>"600px"</code> or <code>"100%"</code>). When
|
270
|
+
<code>height</code> is set to <code>dynamic</code>, the editor
|
271
|
+
will automatically resize to fit its contents. In this case, the
|
272
|
+
<code>minHeight</code> option (an integer) is used to determine
|
273
|
+
the minimum height in pixels.</dd>
|
261
274
|
|
262
275
|
<dt><code>disableSpellcheck</code></dt><dd>Should the editor
|
263
276
|
disable spell-checking on browsers that support it (Firefox 2+).
|
@@ -281,6 +294,10 @@
|
|
281
294
|
<code>false</code>. Changeable with the
|
282
295
|
<code>setLineNumbers(on)</code> method.</dd>
|
283
296
|
|
297
|
+
<dt><code>firstLineNumber</code></dt><dd>When
|
298
|
+
<code>lineNumbers</code> is enabled, this determines the number
|
299
|
+
given to the first line. Defualt is <code>1</code>.</dd>
|
300
|
+
|
284
301
|
<dt><code>lineNumberDelay</code>,
|
285
302
|
<code>lineNumberTime</code></dt><dd>When both line numbers are
|
286
303
|
and text wrapping are turned on, updating line numbers can be
|
@@ -312,6 +329,24 @@
|
|
312
329
|
This option can be changed at run-time using the
|
313
330
|
<code>setTabMode(mode)</code> method.</dd>
|
314
331
|
|
332
|
+
<dt><code>enterMode</code></dt><dd>Determines how a new line
|
333
|
+
created by pressing enter is indented. Supported modes are:
|
334
|
+
<dl>
|
335
|
+
<dt><code>"indent"</code></dt><dd>The default. Causes the new
|
336
|
+
line to be intented by the rules of the parser.</dd>
|
337
|
+
<dt><code>"keep"</code></dt><dd>Keeps the indentation of the
|
338
|
+
previous line.</dd>
|
339
|
+
<dt><code>"flat"</code></dt><dd>Never indents new lines.</dd>
|
340
|
+
</dl>
|
341
|
+
The <code>setEnterMode</code> method can be used to change this
|
342
|
+
option in a running editor.</dd>
|
343
|
+
|
344
|
+
<dt><code>electricChars</code></dt><dd>A boolean that can be
|
345
|
+
used to turn "electric chars" (characters that cause the current
|
346
|
+
line to be reindented when typed, such as <code>{</code> and
|
347
|
+
<code>}</code> in C-like languages) on and off. Default is
|
348
|
+
on.</dd>
|
349
|
+
|
315
350
|
<dt><code>reindentOnLoad</code></dt><dd>When <code>true</code>,
|
316
351
|
this causes the content of the editor to be reindented
|
317
352
|
immediately when the editor loads. Defaults to
|
@@ -320,6 +355,11 @@
|
|
320
355
|
<dt><code>readOnly</code></dt><dd>When set to <code>true</code>,
|
321
356
|
the document is not editable.</dd>
|
322
357
|
|
358
|
+
<dt><code>domain</code></dt><dd>Can be set to the value
|
359
|
+
<code>document.domain</code> should have inside of the iframe.
|
360
|
+
Used to prevent access issues in IE, where this value isn't
|
361
|
+
automatically inherited by iframes.</dd>
|
362
|
+
|
323
363
|
<dt><code>initCallback</code></dt><dd>If set to a function, this
|
324
364
|
will be called (with the editor object as its argument) after
|
325
365
|
the editor has finished initialising.</dd>
|
@@ -409,8 +449,15 @@
|
|
409
449
|
|
410
450
|
<dt><code><a
|
411
451
|
href="contrib/php/js/parsephp.js">contrib/php/js/parsephp.js</a></code>
|
412
|
-
(<a href="contrib/php/index.html">demo</a>)</dt><dd>PHP
|
413
|
-
|
452
|
+
(<a href="contrib/php/index.html">demo</a>)</dt><dd>PHP parser.
|
453
|
+
There is also <code><a
|
454
|
+
href="contrib/php/js/parsephphtmlmixed.js">contrib/php/js/parsephphtmlmixed.js</a></code>,
|
455
|
+
which wraps this parser to allow mixed-mode HTML + PHP parsing.
|
456
|
+
This one takes a configuration parameter <code>opening</code>,
|
457
|
+
which should contain an array of XML processing instruction
|
458
|
+
openings (<code><?php</code>, <code><?</code> etc) which
|
459
|
+
can be used to open a PHP block. Default is
|
460
|
+
<code>["<?php"]</code>.</dd>
|
414
461
|
|
415
462
|
<dt><code><a
|
416
463
|
href="contrib/python/js/parsepython.js">contrib/python/js/parsepython.js</a></code>
|
@@ -433,7 +480,7 @@
|
|
433
480
|
href="js/mirrorframe.js"><code>mirrorframe.js</code></a> provides
|
434
481
|
a basic example of their usage.</p>
|
435
482
|
|
436
|
-
<h3>Properties</h3>
|
483
|
+
<h3 id="properties">Properties</h3>
|
437
484
|
|
438
485
|
<dl>
|
439
486
|
<dt><code>frame</code></dt><dd>The editable frame.</dd>
|
@@ -444,7 +491,7 @@
|
|
444
491
|
<code>CodeMirror-wrapping</code>.</dd>
|
445
492
|
</dl>
|
446
493
|
|
447
|
-
<h3>Methods</h3>
|
494
|
+
<h3 id="methods">Methods</h3>
|
448
495
|
|
449
496
|
<dl>
|
450
497
|
<dt><code>getCode()</code> →
|
@@ -457,15 +504,6 @@
|
|
457
504
|
<dt><code>focus()</code></dt><dd>Gives focus to the editor
|
458
505
|
frame.</dd>
|
459
506
|
|
460
|
-
<dt><code>currentLine()</code> →
|
461
|
-
<code>number</code></dt><dd>Returns the line on which the cursor
|
462
|
-
is currently sitting. <span class="warn">(Deprecated, see the
|
463
|
-
line-based interface below)</span></dd>
|
464
|
-
|
465
|
-
<dt><code>jumpToLine(number)</code></dt><dd>Moves the cursor to
|
466
|
-
the start of the given line. <span
|
467
|
-
class="warn">(Deprecated)</span></dd>
|
468
|
-
|
469
507
|
<dt><code>selection()</code> →
|
470
508
|
<code>string</code></dt><dd>Returns the text that is currently
|
471
509
|
selected in the editor.</dd>
|
@@ -480,23 +518,32 @@
|
|
480
518
|
<dt><code>reindentSelection()</code></dt><dd>Automatically
|
481
519
|
re-indent the selected lines.</dd>
|
482
520
|
|
483
|
-
<dt><code>getSearchCursor(string,
|
484
|
-
→ <code>cursor</code></dt><dd>The first argument
|
485
|
-
the string that should be searched for
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
521
|
+
<dt><code>getSearchCursor(string, startPos, caseFold)</code>
|
522
|
+
→ <code>cursor</code></dt><dd>The first argument provides
|
523
|
+
the string that should be searched for. The second determines
|
524
|
+
where to start searching. It can be <code>false</code> (or left
|
525
|
+
off) for the start of the document, <code>true</code> for the
|
526
|
+
current cursor position, or a <code>{line, character}</code>
|
527
|
+
object (as returned by <code>cursorPosition</code>, or created
|
528
|
+
yourself using a line handle and a number) to set a random
|
529
|
+
position. The third argument, a boolean, determines whether the
|
530
|
+
search will be case-sensitive. If it is not provided, the search
|
531
|
+
will only be case-sensitive if the search string contains
|
532
|
+
uppercase characters. Returns an object that provides an
|
533
|
+
interface for searching. Call its <code>findNext()</code> and
|
534
|
+
<code>findPrevious()</code> methods to search for an occurrence.
|
535
|
+
This returns <code>true</code> if something is found, or
|
536
|
+
<code>false</code> if the end or start of the document was
|
537
|
+
reached. When an occurrence has been found, you can call
|
538
|
+
<code>select()</code> to select it, or
|
495
539
|
<code>replace(string)</code> to replace it with a given string.
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
540
|
+
To find out where the match was found, call the
|
541
|
+
<code>position()</code> method, which returns a <code>{line,
|
542
|
+
character}</code> object. Note that letting the user change the
|
543
|
+
document, or programmatically changing it in any way except for
|
544
|
+
calling <code>replace</code> on the cursor itself, might cause a
|
545
|
+
cursor object to skip back to the beginning of the
|
546
|
+
document.</dd>
|
500
547
|
|
501
548
|
<dt><code>undo()</code></dt><dd>Undo one changeset, if available.</dd>
|
502
549
|
<dt><code>redo()</code></dt><dd>Redo one changeset, if available.</dd>
|
@@ -520,14 +567,26 @@
|
|
520
567
|
<dt><code>ungrabKeys()</code></dt><dd>Revert the effect of
|
521
568
|
<code>grabKeys</code>.</dd>
|
522
569
|
|
523
|
-
<dt><code>setParser(name)</code></dt><dd>Change
|
524
|
-
parser. To use this you'll have to load more than one
|
525
|
-
(put the one you want to use as default at the end of the
|
526
|
-
Then call this function with a string containing the name
|
527
|
-
parser you want to switch to (see the parser script file
|
528
|
-
the name, it'll be something like
|
570
|
+
<dt><code>setParser(name, parserConfig)</code></dt><dd>Change
|
571
|
+
the active parser. To use this you'll have to load more than one
|
572
|
+
parser (put the one you want to use as default at the end of the
|
573
|
+
list). Then call this function with a string containing the name
|
574
|
+
of the parser you want to switch to (see the parser script file
|
575
|
+
to find the name, it'll be something like
|
576
|
+
<code>CSSParser</code>). The second argument is optional, and
|
577
|
+
can be used to pass a new parser configuration object.</dd>
|
578
|
+
|
579
|
+
<dt><code>cursorCoords(start)</code></dt><dd>Get the coordinates
|
580
|
+
of the cursor in the editor, relative to the top-left corner of
|
581
|
+
the outer document. Normally returns an object with
|
582
|
+
<code>x</code>, <code>y</code>, and <code>yBot</code> (the
|
583
|
+
bottom of the cursor) properties. May return <code>null</code>
|
584
|
+
if the cursor position could not be determined (for example, if
|
585
|
+
the editor is not focused).</dd>
|
529
586
|
</dl>
|
530
587
|
|
588
|
+
<h3 id="lines">Line Manipulation</h3>
|
589
|
+
|
531
590
|
<p>For detailed interaction with the content of the editor,
|
532
591
|
CodeMirror exposes a line-oriented interface, which allows you to
|
533
592
|
inspect and manipulate the document line by line. Line handles
|
@@ -546,6 +605,9 @@
|
|
546
605
|
character}</code> object representing the cursor position.
|
547
606
|
<code>start</code> defaults to <code>true</code> and determines
|
548
607
|
if the startpoint or the endpoint of the selection is used.</dd>
|
608
|
+
<dt><code>cursorLine()</code> →
|
609
|
+
<code>handle</code></dt><dd>Returns the line on which the cursor
|
610
|
+
is currently sitting.</dd>
|
549
611
|
<dt><code>firstLine()</code> →
|
550
612
|
<code>handle</code></dt><dd>Get the first line of the
|
551
613
|
document.</dd>
|
@@ -572,6 +634,8 @@
|
|
572
634
|
<dt><code>lineNumber(handle)</code> →
|
573
635
|
<code>number</code></dt><dd>Ask which line of the document
|
574
636
|
(1-based) the given line is.</dd>
|
637
|
+
<dt><code>jumpToLine(handle)</code></dt><dd>Moves the cursor to
|
638
|
+
the start of the given line.</dd>
|
575
639
|
<dt><code>selectLines(startHandle, startOffset,
|
576
640
|
endHandle, endOffset)</code></dt><dd>Move the selection to a
|
577
641
|
specific point. <code>endHandle</code> and
|
@@ -659,5 +723,37 @@
|
|
659
723
|
<a href="js/parsexml.js"><code>parsexml.js</code></a>, and <a
|
660
724
|
href="js/parsecss.js"><code>parsecss.js</code></a>.</p>
|
661
725
|
|
726
|
+
</div><div class="rightsmall blk">
|
727
|
+
|
728
|
+
<h2>Contents</h2>
|
729
|
+
|
730
|
+
<ul>
|
731
|
+
<li><a href="#usage">Basic Usage</a></li>
|
732
|
+
<li><a href="#configuration">Configuration</a></li>
|
733
|
+
<li><a href="#parsers">Parsers</a></li>
|
734
|
+
<li><a href="#programming">Programming Interface</a>
|
735
|
+
<ul>
|
736
|
+
<li><a href="#properties">Properties</a></li>
|
737
|
+
<li><a href="#methods">Methods</a></li>
|
738
|
+
<li><a href="#lines">Line Manipulation</a></li>
|
739
|
+
</ul>
|
740
|
+
</li>
|
741
|
+
<li><a href="#writeparser">Writing a Parser</a></li>
|
742
|
+
</ul>
|
743
|
+
|
744
|
+
<h2>Site</h2>
|
745
|
+
|
746
|
+
<ul>
|
747
|
+
<li><a href="index.html">Front Page</a></li>
|
748
|
+
<li><a href="faq.html">FAQ</a></li>
|
749
|
+
<li><a href="http://groups.google.com/group/codemirror">Google Group</a></li>
|
750
|
+
<li><a href="compress.html">Compression Helper</a></li>
|
751
|
+
<li><a href="story.html">War Story</a></li>
|
752
|
+
</ul>
|
753
|
+
|
754
|
+
</div></div>
|
755
|
+
|
756
|
+
<div style="height: 2em"> </div>
|
757
|
+
|
662
758
|
</body>
|
663
759
|
</html>
|