This repository has been archived by the owner on Sep 23, 2021. It is now read-only.
forked from ether/etherpad-lite
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 325c322
Showing
207 changed files
with
35,989 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
if [ ! -x /usr/bin/java ]; then | ||
echo "You need to install Java to generate the JSDocs!" | ||
exit 1 | ||
fi | ||
|
||
cd "../doc/jsdoc-toolkit" | ||
|
||
JSRUN="jsrun.jar" | ||
RUNJS="app/run.js" | ||
OUTPUT_DIR="../jsdoc" | ||
NODE_DIR="../../node" | ||
TEMPLATE_DIR="templates/jsdoc" | ||
|
||
java -jar $JSRUN $RUNJS -v -d=$OUTPUT_DIR -t=$TEMPLATE_DIR $NODE_DIR && | ||
echo "Look on http://code.google.com/p/jsdoc-toolkit/wiki/InlineDocs to get Tipps for better documentation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
#if [[ $EUID -eq 0 ]]; then | ||
# echo "You shouldn't start LinePad as root!" 1>&2 | ||
# exit 1 | ||
#fi | ||
|
||
#if [ ! type -P node &>/dev/null ]; then | ||
# echo "You have no node installed!" 1>&2 | ||
# exit 1 | ||
#fi | ||
#|| { echo "I require foo but it's not installed. Aborting." >&2; exit 1; } | ||
|
||
cd ../node | ||
authbind node server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
type -P nodeunit &>/dev/null || { | ||
echo "You need to install Nodeunit to run the tests!" >&2 | ||
echo "You can install it with npm" >&2 | ||
echo "Run: npm install nodeunit" >&2 | ||
exit 1 | ||
} | ||
|
||
nodeunit ../tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
|
||
|
||
Copied from the old Etherpad. Found in /infrastructure/ace/ | ||
|
||
Goals: | ||
|
||
- no unicode (for efficient escaping, sightliness) | ||
- efficient operations for ACE and collab (attributed text, etc.) | ||
- good for time-slider | ||
- good for API | ||
- line-ending aware | ||
X more coherent (deleting or styling text merging with insertion) | ||
- server-side syntax highlighting? | ||
- unify author map with attribute pool | ||
- unify attributed text with changeset rep | ||
- not: reversible | ||
- force final newline of document to be preserved | ||
|
||
- Unicode bad: | ||
- ugly (hard to read) | ||
- more complex to parse | ||
- harder to store and transmit correctly | ||
- doesn't save all that much space anyway | ||
- blows up in size when string-escaped | ||
- embarrassing for API | ||
|
||
|
||
# Attributes: | ||
|
||
An "attribute" is a (key,value) pair such as (author,abc123456) or | ||
(bold,true). Sometimes an attribute is treated as an instruction to | ||
add that attribute, in which case an empty value means to remove it. | ||
So (bold,) removes the "bold" attribute. Attributes are interned and | ||
given numeric IDs, so the number "6" could represent "(bold,true)", | ||
for example. This mapping is stored in an attribute "pool" which may | ||
be shared by multiple changesets. | ||
|
||
Entries in the pool must be unique, so that attributes can be compared | ||
by their IDs. Attribute names cannot contain commas. | ||
|
||
A changeset looks something like the following: | ||
|
||
Z:5g>1|5=2p=v*4*5+1$x | ||
|
||
With the corresponding pool containing these entries: | ||
|
||
... | ||
4 -> (author,1059348573) | ||
5 -> (bold,true) | ||
... | ||
|
||
This changeset, together with the pool, represents inserting | ||
a bold letter "x" into the middle of a line. The string consists of: | ||
|
||
- a letter Z (the "magic character" and format version identifier) | ||
- a series of opcodes (punctuation) and numeric values in base 36 (the | ||
alphanumerics) | ||
- a dollar sign ($) | ||
- a string of characters used by insertion operations (the "char bank") | ||
|
||
If we separate out the operations and convert the numbers to base 10, we get: | ||
|
||
Z :196 >1 |5=97 =31 *4 *5 +1 $"x" | ||
|
||
Here are descriptions of the operations, where capital letters are variables: | ||
|
||
":N" : Source text has length N (must be first op) | ||
">N" : Final text is N (positive) characters longer than source text (must be second op) | ||
"<N" : Final text is N (positive) characters shorter than source text (must be second op) | ||
">0" : Final text is same length as source text | ||
"+N" : Insert N characters from the bank, none of them newlines | ||
"-N" : Skip over (delete) N characters from the source text, none of them newlines | ||
"=N" : Keep N characters from the source text, none of them newlines | ||
"|L+N" : Insert N characters from the source text, containing L newlines. The last | ||
character inserted MUST be a newline, but not the (new) document's final newline. | ||
"|L-N" : Delete N characters from the source text, containing L newlines. The last | ||
character inserted MUST be a newline, but not the (old) document's final newline. | ||
"|L=N" : Keep N characters from the source text, containing L newlines. The last character | ||
kept MUST be a newline, and the final newline of the document is allowed. | ||
"*I" : Apply attribute I from the pool to the following +, =, |+, or |= command. | ||
In other words, any number of * ops can come before a +, =, or | but not | ||
between a | and the corresponding + or =. | ||
If +, text is inserted having this attribute. If =, text is kept but with | ||
the attribute applied as an attribute addition or removal. | ||
Consecutive attributes must be sorted lexically by (key,value) with key | ||
and value taken as strings. It's illegal to have duplicate keys | ||
for (key,value) pairs that apply to the same text. It's illegal to | ||
have an empty value for a key in the case of an insertion (+), the | ||
pair should just be omitted. | ||
|
||
Characters from the source text that aren't accounted for are assumed to be kept | ||
with the same attributes. | ||
|
||
Additional Constraints: | ||
|
||
- Consecutive +, -, and = ops of the same type that could be combined are not allowed. | ||
Whether combination is possible depends on the attributes of the ops and whether | ||
each is multiline or not. For example, two multiline deletions can never be | ||
consecutive, nor can any insertion come after a non-multiline insertion with the | ||
same attributes. | ||
- "No-op" ops are not allowed, such as deleting 0 characters. However, attribute | ||
applications that don't have any effect are allowed. | ||
- Characters at the end of the source text cannot be explicitly kept with no changes; | ||
if the change doesn't affect the last N characters, those "keep" ops must be left off. | ||
- In any consecutive sequence of insertions (+) and deletions (-) with no keeps (=), | ||
the deletions must come before the insertions. | ||
- The document text before and after will always end with a newline. This policy avoids | ||
a lot of special-casing of the end of the document. If a final newline is | ||
always added when importing text and removed when exporting text, then the | ||
changeset representation can be used to process text files that may or may not | ||
have a final newline. | ||
|
||
Attribution string: | ||
|
||
An "attribution string" is a series of inserts with no deletions or keeps. | ||
For example, "*3+8|1+5" describes the attributes of a string of length 13, | ||
where the first 8 chars have attribute 3 and the next 5 chars have no | ||
attributes, with the last of these 5 chars being a newline. Constraints | ||
apply similar to those affecting changesets, but the restriction about | ||
the final newline of the new document being added doesn't apply. | ||
|
||
Attributes in an attribution string cannot be empty, like "(bold,)", they should | ||
instead be absent. | ||
|
||
|
||
|
||
|
||
|
||
------- | ||
Considerations: | ||
|
||
- composing changesets/attributions with different pools | ||
- generalizing "applyToAttribution" to make "mutateAttributionLines" and "compose" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
====================================================================== | ||
|
||
DESCRIPTION: | ||
|
||
This is the source code for JsDoc Toolkit, an automatic documentation | ||
generation tool for JavaScript. It is written in JavaScript and is run | ||
from a command line (or terminal) using Java and Mozilla's Rhino | ||
JavaScript runtime engine. | ||
|
||
Using this tool you can automatically turn JavaDoc-like comments in | ||
your JavaScript source code into published output files, such as HTML | ||
or XML. | ||
|
||
For more information, to report a bug, or to browse the technical | ||
documentation for this tool please visit the official JsDoc Toolkit | ||
project homepage at http://code.google.com/p/jsdoc-toolkit/ | ||
|
||
For the most up-to-date documentation on JsDoc Toolkit see the | ||
official wiki at http://code.google.com/p/jsdoc-toolkit/w/list | ||
|
||
====================================================================== | ||
|
||
REQUIREMENTS: | ||
|
||
JsDoc Toolkit is known to work with: | ||
java version "1.6.0_03" | ||
Java(TM) SE Runtime Environment (build 1.6.0_03-b05) | ||
on Windows XP, | ||
and java version "1.5.0_19" | ||
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304) | ||
on Mac OS X 10.5. | ||
|
||
Other versions of java may or may not work with JsDoc Toolkit. | ||
|
||
====================================================================== | ||
|
||
USAGE: | ||
|
||
Running JsDoc Toolkit requires you to have Java installed on your | ||
computer. For more information see http://www.java.com/getjava/ | ||
|
||
Before running the JsDoc Toolkit app you should change your current | ||
working directory to the jsdoc-toolkit folder. Then follow the | ||
examples below, or as shown on the project wiki. | ||
|
||
On a computer running Windows a valid command line to run JsDoc | ||
Toolkit might look like this: | ||
|
||
> java -jar jsrun.jar app\run.js -a -t=templates\jsdoc mycode.js | ||
|
||
On Mac OS X or Linux the same command would look like this: | ||
|
||
$ java -jar jsrun.jar app/run.js -a -t=templates/jsdoc mycode.js | ||
|
||
The above assumes your current working directory contains jsrun.jar, | ||
the "app" and "templates" subdirectories from the standard JsDoc | ||
Toolkit distribution and that the relative path to the code you wish | ||
to document is "mycode.js". | ||
|
||
The output documentation files will be saved to a new directory named | ||
"out" (by default) in the current directory, or if you specify a | ||
-d=somewhere_else option, to the somewhere_else directory. | ||
|
||
For help (usage notes) enter this on the command line: | ||
|
||
$ java -jar jsrun.jar app/run.js --help | ||
|
||
More information about the various command line options used by JsDoc | ||
Toolkit are available on the project wiki. | ||
|
||
====================================================================== | ||
|
||
RUNNING VIA SHELL SCRIPT | ||
|
||
Avi Deitcher has contributed the file jsrun.sh with the following usage notes: | ||
|
||
A script to simplify running jsdoc from the command-line, especially when | ||
running from within a development or build environment such as ant. | ||
|
||
Normally, to run jsdoc, you need a command-line as the following: | ||
java -Djsdoc.dir=/some/long/dir/path/to/jsdoc -jar | ||
/some/long/dir/path/to/jsdoc/jsrun.jar /some/long/dir/path/to/jsdoc/app/run.js | ||
-t=template -r=4 /some/long/dir/path/to/my/src/code | ||
|
||
This can get tedious to redo time and again, and difficult to use from within a build environment. | ||
|
||
To simplify the process, jsrun.sh will automatically run this path, as well as passing through any arguments. | ||
|
||
Usage: jsrun.sh <run.js arguments> | ||
|
||
All <run.js arguments> will be passed through. | ||
Additionally, jsrun.sh will take the following actions: | ||
1) If the environment variable JSDOCDIR is set, it will add | ||
"-Djsdoc.dir=$JSDOCDIR" to the command-line | ||
2) If the environment variable JSDOCTEMPLATEDIR is set, it will add | ||
"-Djsdoc.template.dir=$JSDOCTEMPLATEDIR" to the command-line | ||
3) java with the appropriate path to jsrun.jar and run.js will be instantiated | ||
|
||
If not variables are set, it is assumed that the path to jsrun.jar and app/ is in the current working directory. | ||
|
||
Example: | ||
# jsrun.sh ./src/ | ||
Assuming JSDOCDIR=/some/path/to/my/jsdoc will cause the following command to | ||
execute: | ||
java -Djsdoc.dir=/some/path/to/my/jsdoc -jar /some/path/to/my/jsdoc/jsrun.jar | ||
/some/path/to/my/jsdoc/app/run.js ./src/ | ||
|
||
====================================================================== | ||
|
||
TESTING: | ||
|
||
To run the suite of unit tests included with JsDoc Toolkit enter this | ||
on the command line: | ||
|
||
$ java -jar jsrun.jar app/run.js -T | ||
|
||
To see a dump of the internal data structure that JsDoc Toolkit has | ||
built from your source files use this command: | ||
|
||
$ java -jar jsrun.jar app/run.js mycode.js -Z | ||
|
||
====================================================================== | ||
|
||
LICENSE: | ||
|
||
JSDoc.pm | ||
|
||
This project is based on the JSDoc.pm tool, created by Michael | ||
Mathews and Gabriel Reid. More information on JsDoc.pm can | ||
be found on the JSDoc.pm homepage: http://jsdoc.sourceforge.net/ | ||
|
||
Complete documentation on JsDoc Toolkit can be found on the project | ||
wiki at http://code.google.com/p/jsdoc-toolkit/w/list | ||
|
||
Rhino | ||
|
||
Rhino (JavaScript in Java) is open source and licensed by Mozilla | ||
under the MPL 1.1 or later/GPL 2.0 or later licenses, the text of | ||
which is available at http://www.mozilla.org/MPL/ | ||
|
||
You can obtain the source code for Rhino from the Mozilla web site at | ||
http://www.mozilla.org/rhino/download.html | ||
|
||
JsDoc Toolkit is a larger work that uses the Rhino JavaScript engine | ||
but is not derived from it in any way. The Rhino library is used | ||
without modification and without any claims whatsoever. | ||
|
||
The Rhino Debugger | ||
|
||
You can obtain more information about the Rhino Debugger from the | ||
Mozilla web site at http://www.mozilla.org/rhino/debugger.html | ||
|
||
JsDoc Toolkit is a larger work that uses the Rhino Debugger but | ||
is not derived from it in any way. The Rhino Debugger is used | ||
without modification and without any claims whatsoever. | ||
|
||
JsDoc Toolkit | ||
|
||
All code specific to JsDoc Toolkit are free, open source and licensed | ||
for use under the X11/MIT License. | ||
|
||
JsDoc Toolkit is Copyright (c)2009 Michael Mathews <micmath@gmail.com> | ||
|
||
This program is free software; you can redistribute it and/or | ||
modify it under the terms below. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: The above copyright notice and this | ||
permission notice must be included in all copies or substantial | ||
portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
IO.include("frame/Opt.js"); | ||
IO.include("frame/Chain.js"); | ||
IO.include("frame/Link.js"); | ||
IO.include("frame/String.js"); | ||
IO.include("frame/Hash.js"); | ||
IO.include("frame/Namespace.js"); | ||
//IO.include("frame/Reflection.js"); | ||
|
||
/** A few helper functions to make life a little easier. */ | ||
|
||
function defined(o) { | ||
return (o !== undefined); | ||
} | ||
|
||
function copy(o) { // todo check for circular refs | ||
if (o == null || typeof(o) != 'object') return o; | ||
var c = new o.constructor(); | ||
for(var p in o) c[p] = copy(o[p]); | ||
return c; | ||
} | ||
|
||
function isUnique(arr) { | ||
var l = arr.length; | ||
for(var i = 0; i < l; i++ ) { | ||
if (arr.lastIndexOf(arr[i]) > i) return false; | ||
} | ||
return true; | ||
} | ||
|
||
/** Returns the given string with all regex meta characters backslashed. */ | ||
RegExp.escapeMeta = function(str) { | ||
return str.replace(/([$^\\\/()|?+*\[\]{}.-])/g, "\\$1"); | ||
} |
Oops, something went wrong.