diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80af35e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ + +.sass-cache +gems.locked diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 9b5827a..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Samuel G. D. Williams. - -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 shall 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. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 52c83d7..0000000 --- a/README.md +++ /dev/null @@ -1,113 +0,0 @@ -# jQuery.Syntax [release-3.0] # - -jQuery.Syntax is a light-weight client-side syntax highlighter, which dynamically loads external dependencies (JavaScript & CSS) when required. It uses jQuery to make it cross-browser compatible and to simplify integration. - -To use jQuery.Syntax with minimal work, simply review the examples and use the files in the public sub-directory. - -For more advanced usage and customisation, you will need to install the following dependencies to use jQuery.Syntax: - $ sudo gem install rake haml - -To install jQuery.Syntax into the standard 'public' directory - $ rake install - -To customise the install process, including destination directory and theme, edit install.yaml. - -jQuery.Syntax depends on jQuery 1.4.1+. - -For downloads, documentation, compatibility, please visit . - -There are several plugins available (source code - for stable releases see the main project page above): - - - DokuWiki: - - WordPress: - -## License ## - -Copyright (c) 2011 Samuel G. D. Williams. - -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 shall 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. - -## Change Log ## - -### release-3.0 ### - - Changed license from AGPL to MIT. - - Improvements to the following brushes: C#, Objective-C, Java, Ruby, PHP, HTML, SQL, Assembly, Bash - - Added support for perl style regular expressions. - - Improved bash brush formatting and command matching. - - Fixed some issues when highlighting ruby code with scope operator '::' and symbols. - - Bug fixes to rakefile - new environment variable PREFIX determines install location. - - Improvements to XML brush including supporting CDATA tags. - - Bug fixes to several brushes including: - - Objective-C methods (incorrect highlighting of last argument). - - Diff insertion and deletion how highlight the background row colour. - - Camel case type now expects a capital letter in the first non-underscore position. - - Improved the style of XML entities, percent-escapes. - - Several examples now included in examples sub-directory. - - Default install now included in public sub-directory. - - Fixed minor issue in path detection regular expression. - - Installation now staged directly into destination directory. - - Installation now supports configuration files. - - Minor fixes to brushes. - - Support for marked up content. - - Support for several new languages (Kai, io). - - Installation process (now the recommended process). - - Enhanced support for themes. - - Support for derived brushes. - -### release-2.2.2 ### - - Major Internet Exploder bugfix. - -### release-2.2 ### - - Added support for Lua, C# - - Added new fixed and list layouts. - - Improvements to whitespace handling. - - Several bug fixes and enhancements. - -### release-1.9.1 ### - - Added several new languages. - - Minor bug fixes and enhancements. - -### release-1.8 ### - - Improved the simple function usability. - - Improved shorthand notation so it is now more flexible. - - You can now specify a combination of classes, in any order. - -### release-1.7 ### - - Added support for YAML. - - Fixed a bug in the bisection algorithm. - - Added support for highlighting inline code tags. - - Added shorthand notation - - Improved simple function to improve consistency. - -Shorthand notation depends on the classes being in a specific order, i.e. "syntax {language}". e.g. - - - -Previously, this would have been written as (and is still acceptable): - - - -### release-1.6 ### - - Fixed a compatibility issue with jQuery 1.4.2. - -### release-1.5 ### - - Added support for [Visual] Basic, SQL and Lisp. - - Enabled a small optimization in the bisection algorithm. - - Fixed a bug with alias names (they weren't working). - - Minor updates to several other brushes. diff --git a/rakefile b/bake.rb similarity index 62% rename from rakefile rename to bake.rb index 2fac899..5919560 100644 --- a/rakefile +++ b/bake.rb @@ -9,25 +9,30 @@ require 'pathname' require 'yaml' -require 'ext/theme' +require 'closure-compiler' + +require_relative 'ext/theme' -JSMIN_EXEC = File.dirname(__FILE__) + "/ext/jsmin.rb" CACHE_FILE = "jquery.syntax.cache.js" MINIFIED_FILE = "jquery.syntax.min.js" + LICENSE = < - EOF -BASE_PATH = Pathname.new(Dir.getwd) -$config = nil +BASE_PATH = Pathname(Dir.getwd) +DIST_PATH = 'dist' -if ENV['PREFIX'] - Dir.chdir(ENV['PREFIX']) +def initialize(*) + super + @config = nil end -task :update_aliases do +# if ENV['PREFIX'] +# Dir.chdir(ENV['PREFIX']) +# end + +def update_aliases code = StringIO.new code.puts "// This file is automatically generated. Any changes may be lost." @@ -36,7 +41,7 @@ code.puts "// Brush Aliases" - Dir["jquery.syntax.brush.*.js"].each do |path| + Dir["jquery.syntax.brush.*.js"].sort.each do |path| File.open(path, "r") do |f| first_line = f.readline rescue "" @@ -47,7 +52,7 @@ end styles = {} - Dir["**/jquery.syntax.*.css"].each do |path| + Dir["**/jquery.syntax.*.css"].sort.each do |path| basename = File.basename(path, ".css") styles[basename] ||= [] styles[basename] << path @@ -61,7 +66,7 @@ code.puts code.puts "// Theme Configuration" - Dir["**/theme.js"].each do |path| + Dir["**/theme.js"].sort.each do |path| code.write File.read(path) end @@ -73,11 +78,12 @@ # puts code.string end -task :generate_stylesheets, [:theme] do |task, arguments| - theme = arguments[:theme] || "base" - output = File.join("./", theme) +def generate_stylesheets(theme: "base") + output = File.expand_path(theme) FileUtils.mkdir_p(output) + cache_path = File.expand_path(".sass-cache", __dir__) + aggregate_theme = Theme.new(output, File.join(File.dirname(__FILE__), "themes")) aggregate_theme.load_theme(theme) @@ -85,7 +91,7 @@ output_name = File.basename(sass).sub(/\.(sass|scss)$/, ".css") output_path = File.join(output, output_name) - command = "sass -I #{output.dump} --stdin #{output_path}" + command = ["sass", "--sourcemap=none", "-I", output, "--stdin", output_path, "--cache-location", cache_path] IO.popen(command, "w") do |io| aggregate_theme.includes_for(sass, :prepend).each do |incl| @@ -112,44 +118,42 @@ end # This builds a combined jquery.syntax.js and jquery.syntax.cache.js and minifies the result -task :build_combined => [:update_aliases] do - IO.popen(JSMIN_EXEC, "r+") do |min| - ["jquery.syntax.js", "jquery.syntax.cache.js"].each do |path| - min.write(File.read(path)) - end +def build_combined + self.update_aliases - min.close_write + compiler = Closure::Compiler.new - buf = min.read + output = compiler.compile_files( + ["jquery.syntax.js", "jquery.syntax.cache.js"] + ) - File.open(MINIFIED_FILE, "w") do |fp| - fp.write(LICENSE) - fp.write(buf) - end + File.open(MINIFIED_FILE, "w") do |file| + file.write(LICENSE) + file.write(output) end end # Note... this is one way ! -task :compress_all => [:build_combined] do +def compress_all + self.build_combined + files = Dir["jquery.syntax*.js"] + compiler = Closure::Compiler.new puts "Minifying JavaScript..." files.each do |path| - # puts "Minifying #{File.basename(path)}..." - IO.popen(JSMIN_EXEC, "r+") do |min| - min.write(File.read(path)) - - min.close_write - - File.open(path, "w") do |fp| - fp.write(LICENSE) - fp.write(min.read) - end + puts "Minifying #{File.basename(path)}..." + + output = compiler.compile_files([path]) + + File.open(path, "w") do |file| + file.write(LICENSE) + file.write(output) end end end -task :setup_prefix do +def setup_prefix if ENV['CONFIG'] config_path = BASE_PATH + ENV['CONFIG'] else @@ -160,51 +164,56 @@ end puts "Using configuration #{config_path}" - $config = YAML::load_file(config_path) + @config = YAML::load_file(config_path) - if $config['prefix'] && !ENV['PREFIX'] - ENV['PREFIX'] = config_path.dirname + ($config['prefix'] || 'public') + if @config['prefix'] && !ENV['PREFIX'] + prefix = config_path.dirname + (@config['prefix'] || DIST_PATH) elsif ENV['PREFIX'] - ENV['PREFIX'] = BASE_PATH + ENV['PREFIX'] + prefix = BASE_PATH + ENV['PREFIX'] else - ENV['PREFIX'] = BASE_PATH + 'public' + prefix = BASE_PATH + DIST_PATH end - prefix = Pathname.new(ENV['PREFIX']) prefix.mkpath - Dir.chdir(prefix) + ENV['PREFIX'] = prefix.to_s + puts "Working in #{Dir.getwd}..." end -task :install => :setup_prefix do |task, arguments| - Rake::Task[:clean].invoke(arguments[:config]) +def install + self.setup_prefix + self.clean - $config['themes'].each do |theme| - Rake::Task[:generate_stylesheets].execute(:theme => theme) + @config['themes'].each do |theme| + self.generate_stylesheets(theme: theme) end js_files = Dir[BASE_PATH + "source/jquery.syntax*.js"] js_files.each do |path| - # $stderr.puts "Copying #{File.basename(path)}..." + $stderr.puts "Copying #{File.basename(path)}..." output_path = File.basename(path) FileUtils.cp(path, output_path) end - Rake::Task[:build_combined].invoke - Rake::Task[:compress_all].invoke if $config['minify'] + self.build_combined + self.compress_all if @config['minify'] puts "Install into #{Dir.getwd} finished." end -task :clean => :setup_prefix do |task, arguments| +def clean + self.setup_prefix + Dir.glob("*") do |path| FileUtils.rm_r path end end -task :default => :install +def default + self.install +end \ No newline at end of file diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..afabbab --- /dev/null +++ b/config.ru @@ -0,0 +1,6 @@ + +require 'rack/static' + +use Rack::Static, :urls => ["/"], :root => "./" + +run lambda { |env| $stderr.puts("404 #{env['REQUEST_PATH']}"); [404, {}, []] } diff --git a/dist/base/jquery.syntax.brush.apache.css b/dist/base/jquery.syntax.brush.apache.css new file mode 100644 index 0000000..dfe774f --- /dev/null +++ b/dist/base/jquery.syntax.brush.apache.css @@ -0,0 +1,12 @@ +.syntax-theme-base .apache .tag { + color: #00c; } +.syntax-theme-base .apache .tag-name { + color: #00f; } +.syntax-theme-base .apache .tag-name { + font-weight: bold; } + +@media (prefers-color-scheme: dark) { + .syntax-theme-base .apache .tag { + color: #6666ff; } + .syntax-theme-base .apache .tag-name { + color: #9999ff; } } diff --git a/dist/base/jquery.syntax.brush.applescript.css b/dist/base/jquery.syntax.brush.applescript.css new file mode 100644 index 0000000..7e873a3 --- /dev/null +++ b/dist/base/jquery.syntax.brush.applescript.css @@ -0,0 +1,5 @@ +.syntax-theme-base .applescript { + font-family: Geneva, Helvetica, sans-serif; } + .syntax-theme-base .applescript .keyword { + color: #00f; + font-weight: bold; } diff --git a/dist/base/jquery.syntax.brush.assembly.css b/dist/base/jquery.syntax.brush.assembly.css new file mode 100644 index 0000000..3530f26 --- /dev/null +++ b/dist/base/jquery.syntax.brush.assembly.css @@ -0,0 +1,8 @@ +.syntax-theme-base .assembly .register { + color: #3caa20; + font-style: italic; } +.syntax-theme-base .assembly .label { + font-weight: bold; + color: #2a85b3; } +.syntax-theme-base .assembly .directive { + color: #828a3d; } diff --git a/dist/base/jquery.syntax.brush.bash-script.css b/dist/base/jquery.syntax.brush.bash-script.css new file mode 100644 index 0000000..6105a18 --- /dev/null +++ b/dist/base/jquery.syntax.brush.bash-script.css @@ -0,0 +1,4 @@ +.syntax-theme-base .bash-script .option { + color: #03f; } +.syntax-theme-base .bash-script .env { + font-style: italic; } diff --git a/dist/base/jquery.syntax.brush.bash.css b/dist/base/jquery.syntax.brush.bash.css new file mode 100644 index 0000000..3c69f7e --- /dev/null +++ b/dist/base/jquery.syntax.brush.bash.css @@ -0,0 +1,2 @@ +.syntax-theme-base .bash .stderr { + color: red; } diff --git a/dist/base/jquery.syntax.brush.clang.css b/dist/base/jquery.syntax.brush.clang.css new file mode 100644 index 0000000..012433b --- /dev/null +++ b/dist/base/jquery.syntax.brush.clang.css @@ -0,0 +1,6 @@ +.syntax-theme-base .preprocessor { + color: #63381f; } + +@media (prefers-color-scheme: dark) { + .syntax-theme-base .preprocessor { + color: #c97e52; } } diff --git a/dist/base/jquery.syntax.brush.css.css b/dist/base/jquery.syntax.brush.css.css new file mode 100644 index 0000000..6ea2994 --- /dev/null +++ b/dist/base/jquery.syntax.brush.css.css @@ -0,0 +1,14 @@ +.syntax-theme-base .css .selector { + color: #458; + font-weight: bold; } +.syntax-theme-base .css .property { + color: teal; } +.syntax-theme-base .css .color-box { + position: relative; } + .syntax-theme-base .css .color-box .sample { + border: 1px solid #000; + position: absolute; + left: 0.2em; + right: 0.2em; + top: 0.2em; + bottom: 0.2em; } diff --git a/dist/base/jquery.syntax.brush.diff.css b/dist/base/jquery.syntax.brush.diff.css new file mode 100644 index 0000000..1cfc36a --- /dev/null +++ b/dist/base/jquery.syntax.brush.diff.css @@ -0,0 +1,16 @@ +.syntax-theme-base .add { + color: green; } +.syntax-theme-base .del { + color: red; } +.syntax-theme-base .insert { + color: green; } +.syntax-theme-base .insert-line { + background-color: #cfc !important; } +.syntax-theme-base .remove { + color: red; } +.syntax-theme-base .remove-line { + background-color: #fcc !important; } +.syntax-theme-base .offset { + color: blue; } +.syntax-theme-base .offset-line { + background-color: #ccf !important; } diff --git a/dist/base/jquery.syntax.brush.html.css b/dist/base/jquery.syntax.brush.html.css new file mode 100644 index 0000000..f720801 --- /dev/null +++ b/dist/base/jquery.syntax.brush.html.css @@ -0,0 +1,3 @@ +.syntax-theme-base .html .doctype { + font-weight: bold; + color: #938; } diff --git a/public/base/jquery.syntax.brush.ocaml.css b/dist/base/jquery.syntax.brush.ocaml.css similarity index 73% rename from public/base/jquery.syntax.brush.ocaml.css rename to dist/base/jquery.syntax.brush.ocaml.css index c2172fb..6bde078 100644 --- a/public/base/jquery.syntax.brush.ocaml.css +++ b/dist/base/jquery.syntax.brush.ocaml.css @@ -1,3 +1,3 @@ .syntax .ocaml .operator { - color: #0066cc; + color: #06C; font-weight: bold; } diff --git a/public/base/jquery.syntax.brush.protobuf.css b/dist/base/jquery.syntax.brush.protobuf.css similarity index 100% rename from public/base/jquery.syntax.brush.protobuf.css rename to dist/base/jquery.syntax.brush.protobuf.css diff --git a/dist/base/jquery.syntax.brush.python.css b/dist/base/jquery.syntax.brush.python.css new file mode 100644 index 0000000..cfd9805 --- /dev/null +++ b/dist/base/jquery.syntax.brush.python.css @@ -0,0 +1,6 @@ +.syntax-theme-base .python .decorator { + color: #ffb600; + font-weight: bold; } +.syntax-theme-base .python .builtin { + color: #33f; + font-style: italic; } diff --git a/dist/base/jquery.syntax.brush.ruby.css b/dist/base/jquery.syntax.brush.ruby.css new file mode 100644 index 0000000..97c50cf --- /dev/null +++ b/dist/base/jquery.syntax.brush.ruby.css @@ -0,0 +1,2 @@ +.syntax-theme-base .ruby .string .ruby { + color: #808080; } diff --git a/dist/base/jquery.syntax.brush.xml.css b/dist/base/jquery.syntax.brush.xml.css new file mode 100644 index 0000000..0d3f20e --- /dev/null +++ b/dist/base/jquery.syntax.brush.xml.css @@ -0,0 +1,35 @@ +.syntax-theme-base .xml .cdata-content { + color: #046; + border-radius: 0.5em; } +.syntax-theme-base .xml .xml-tag, .syntax-theme-base .xml .cdata { + color: #00c; } +.syntax-theme-base .xml .tag-name, .syntax-theme-base .xml .cdata-tag { + color: #00f; + font-weight: bold; } +.syntax-theme-base .xml .namespace { + color: #00c; } +.syntax-theme-base .xml .attribute { + color: #00c; } +.syntax-theme-base .xml .instruction { + color: #00c; } +.syntax-theme-base .xml .entity, .syntax-theme-base .xml .percent-escape { + color: #666; + background-color: #ddd; + border-radius: 0.5em; } + +@media (prefers-color-scheme: dark) { + .syntax-theme-base .xml .cdata-content { + color: #a46; } + .syntax-theme-base .xml .xml-tag, .syntax-theme-base .xml .cdata { + color: #c59de7; } + .syntax-theme-base .xml .tag-name, .syntax-theme-base .xml .cdata-tag { + color: #9ae; } + .syntax-theme-base .xml .namespace { + color: #c59de7; } + .syntax-theme-base .xml .attribute { + color: #c59de7; } + .syntax-theme-base .xml .instruction { + color: #c59de7; } + .syntax-theme-base .xml .entity, .syntax-theme-base .xml .percent-escape { + color: #999; + background-color: #333; } } diff --git a/dist/base/jquery.syntax.core.css b/dist/base/jquery.syntax.core.css new file mode 100644 index 0000000..1d1f2bc --- /dev/null +++ b/dist/base/jquery.syntax.core.css @@ -0,0 +1,58 @@ +pre code.syntax-theme-base { + display: block; } + pre code.syntax-theme-base > span { + display: flex; } + pre code.syntax-theme-base .indent { + flex-grow: 0; + flex-shrink: 0; } + pre code.syntax-theme-base .text { + white-space: pre-wrap; + padding-left: 2ch; + text-indent: -2ch; } + +.syntax-theme-base a { + text-decoration: none; + color: inherit; } +.syntax-theme-base .function { + color: #33f; } +.syntax-theme-base .keyword, .syntax-theme-base .access, .syntax-theme-base .option { + color: #7a0968; } +.syntax-theme-base .type { + color: #3239D6; } +.syntax-theme-base .comment { + color: #6ac; } +.syntax-theme-base .constant { + color: #1c00ce; } +.syntax-theme-base .string, .syntax-theme-base .symbol { + color: #c41a15; } +.syntax-theme-base .string .escape { + color: #f99; } +.syntax-theme-base .operator { + color: black; } +.syntax-theme-base .href { + color: #0e0eff; + text-decoration: underline; } +.syntax-theme-base .variable { + color: #466997; } +.syntax-theme-base .highlight { + background-color: #fdfdba; } + +@media (prefers-color-scheme: dark) { + .syntax-theme-base .operator { + color: white; } + .syntax-theme-base .function { + color: #c59de7; } + .syntax-theme-base .keyword, .syntax-theme-base .access, .syntax-theme-base .option { + color: #328eff; } + .syntax-theme-base .type { + color: #37a4ff; } + .syntax-theme-base .comment { + color: #849fca; } + .syntax-theme-base .constant { + color: #c9a452; } + .syntax-theme-base .string, .syntax-theme-base .symbol { + color: #ed7f7d; } + .syntax-theme-base .string .escape { + color: #f99; } + .syntax-theme-base .variable { + color: #6e6dff; } } diff --git a/public/base/jquery.syntax.layout.editor.css b/dist/base/jquery.syntax.editor.css similarity index 79% rename from public/base/jquery.syntax.layout.editor.css rename to dist/base/jquery.syntax.editor.css index 9c8030f..04ab4da 100644 --- a/public/base/jquery.syntax.layout.editor.css +++ b/dist/base/jquery.syntax.editor.css @@ -1,6 +1,4 @@ .syntax-container.syntax-theme-base div.editor.syntax { - background-color: white; - border: 1px inset #aaaaaa; padding: 0.2em !important; margin: 0 !important; white-space: pre; } diff --git a/public/base/theme.js b/dist/base/theme.js similarity index 100% rename from public/base/theme.js rename to dist/base/theme.js diff --git a/public/bright/jquery.syntax.core.css b/dist/bright/jquery.syntax.core.css similarity index 82% rename from public/bright/jquery.syntax.core.css rename to dist/bright/jquery.syntax.core.css index 28ca51e..f268c77 100644 --- a/public/bright/jquery.syntax.core.css +++ b/dist/bright/jquery.syntax.core.css @@ -2,26 +2,26 @@ font-family: Menlo, Monaco, Consolas, monospace; line-height: 1.5em; } .syntax-container.syntax-theme-bright .syntax .function { - color: #3333ff; } + color: #33f; } .syntax-container.syntax-theme-bright .syntax .keyword { - color: #33cc33; } + color: #3c3; } .syntax-container.syntax-theme-bright .syntax .access { color: #ffb600; font-weight: bold; } .syntax-container.syntax-theme-bright .syntax .type { - color: #119911; + color: #191; font-weight: bold; } .syntax-container.syntax-theme-bright .syntax .comment { - color: #66aacc; + color: #6ac; font-style: italic; } .syntax-container.syntax-theme-bright .syntax .string, .syntax-container.syntax-theme-bright .syntax .constant { - color: #ff3333; } + color: #f33; } .syntax-container.syntax-theme-bright .syntax .string .escape { - color: #ff9999; } + color: #f99; } .syntax-container.syntax-theme-bright .syntax .operator { - color: #cc0000; } + color: #c00; } .syntax-container.syntax-theme-bright .syntax .href { - color: blue; + color: #00f; text-decoration: underline; } .syntax-container.syntax-theme-bright .syntax .variable { - color: #2222cc; } + color: #22c; } diff --git a/public/bright/theme.js b/dist/bright/theme.js similarity index 100% rename from public/bright/theme.js rename to dist/bright/theme.js diff --git a/dist/jquery.syntax.brush.apache.js b/dist/jquery.syntax.brush.apache.js new file mode 100644 index 0000000..3a12786 --- /dev/null +++ b/dist/jquery.syntax.brush.apache.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("apache",function(a){a.push({pattern:/(<(\w+).*?>)/gi,matches:Syntax.extractMatches({klass:"tag",allow:["attribute","tag-name","string"]},{klass:"tag-name",process:Syntax.lib.webLinkProcess("site:http://httpd.apache.org/docs/trunk/ directive",!0)})});a.push({pattern:/(<\/(\w+).*?>)/gi,matches:Syntax.extractMatches({klass:"tag",allow:["tag-name"]},{klass:"tag-name"})});a.push({pattern:/^\s+([A-Z][\w]+)/gm,matches:Syntax.extractMatches({klass:"function",allow:["attribute"],process:Syntax.lib.webLinkProcess("site:http://httpd.apache.org/docs/trunk/ directive", +!0)})});a.push(Syntax.lib.perlStyleComment);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.brush.applescript.js b/dist/jquery.syntax.brush.applescript.js new file mode 100644 index 0000000..56e2fc2 --- /dev/null +++ b/dist/jquery.syntax.brush.applescript.js @@ -0,0 +1,5 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("applescript",function(a){a.push("after before beginning continue copy each end every from get global in local named of return set some that the then times to where whose with without".split(" "),{klass:"keyword"});a.push("first second third fourth fifth sixth seventh eighth ninth tenth last front back middle".split(" "),{klass:"keyword"});a.push("activate add alias AppleScript ask attachment boolean class constant delete duplicate empty exists false id integer list make message modal modified new no paragraph pi properties quit real record remove rest result reveal reverse run running save string true word yes".split(" "), +{klass:"keyword"});var b=[/(\-\-|#).*$/gm,/\(\*(?:[\s\S]*?\(\*[\s\S]*?\*\))*[\s\S]*?\*\)/gm,Syntax.lib.perlStyleComment.pattern];a.push(Syntax.lib.webLink);a.push(b,{klass:"comment",allow:["href"]});a.push(Syntax.lib.doubleQuotedString);a.push([/\b\d+(st|nd|rd|th)\b/g,/(-)?(\d)+(\.(\d)?)?(E\+(\d)+)?/g],{klass:"constant"});a.push({pattern:/&|\u00ac|=|\u2260|>|<|\u2265|>=|\u2264|<=|\*|\+|-|\/|\u00f7|\^/g,klass:"operator"});a.push({pattern:/\b(?:and|as|div|mod|not|or|return(?!\s&)(ing)?|equals|(is(n't| not)? )?equal( to)?|does(n't| not) equal|(is(n't| not)? )?(greater|less) than( or equal( to)?)?|(comes|does(n't| not) come) (after|before)|is(n't| not)?( in)? (back|front) of|is(n't| not)? behind|is(n't| not)?( (in|contained by))?|does(n't| not) contain|contain(s)?|(start|begin|end)(s)? with|((but|end) )?(consider|ignor)ing|prop(erty)?|(a )?ref(erence)?( to)?|repeat (until|while|with)|((end|exit) )?repeat|((else|end) )?if|else|(end )?(script|tell|try)|(on )?error|(put )?into|(of )?(it|me)|its|my|with (timeout( of)?|transaction)|end (timeout|transaction))\b/g, +klass:"keyword"});a.push({pattern:/\b(?:about|above|against|around|at|below|beneath|beside|between|by|(apart|aside) from|(instead|out) of|into|on(to)?|over|since|thr(ough|u)|under)\b/g,klass:"keyword"});a.push({pattern:/\b(?:adding folder items to|after receiving|choose( ((remote )?application|color|folder|from list|URL))?|clipboard info|set the clipboard to|(the )?clipboard|entire contents|display(ing| (alert|dialog|mode))?|document( (edited|file|nib name))?|file( (name|type))?|(info )?for|giving up after|(name )?extension|quoted form|return(ed)?|second(?! item)(s)?|list (disks|folder)|text item(s| delimiters)?|(Unicode )?text|(disk )?item(s)?|((current|list) )?view|((container|key) )?window|with (data|icon( (caution|note|stop))?|parameter(s)?|prompt|properties|seed|title)|case|diacriticals|hyphens|numeric strings|punctuation|white space|folder creation|application(s( folder)?| (processes|scripts position|support))?|((desktop )?(pictures )?|(documents|downloads|favorites|home|keychain|library|movies|music|public|scripts|sites|system|users|utilities|workflows) )folder|desktop|Folder Action scripts|font(s| panel)?|help|internet plugins|modem scripts|(system )?preferences|printer descriptions|scripting (additions|components)|shared (documents|libraries)|startup (disk|items)|temporary items|trash|on server|in AppleTalk zone|((as|long|short) )?user name|user (ID|locale)|(with )?password|in (bundle( with identifier)?|directory)|(close|open for) access|read|write( permission)?|(g|s)et eof|using( delimiters)?|starting at|default (answer|button|color|country code|entr(y|ies)|identifiers|items|name|location|script editor)|hidden( answer)?|open(ed| (location|untitled))?|error (handling|reporting)|(do( shell)?|load|run|store) script|administrator privileges|altering line endings|get volume settings|(alert|boot|input|mount|output|set) volume|output muted|(fax|random )?number|round(ing)?|up|down|toward zero|to nearest|as taught in school|system (attribute|info)|((AppleScript( Studio)?|system) )?version|(home )?directory|(IPv4|primary Ethernet) address|CPU (type|speed)|physical memory|time (stamp|to GMT)|replacing|ASCII (character|number)|localized string|from table|offset|summarize|beep|delay|say|(empty|multiple) selections allowed|(of|preferred) type|invisibles|showing( package contents)?|editable URL|(File|FTP|News|Media|Web) [Ss]ervers|Telnet hosts|Directory services|Remote applications|waiting until completion|saving( (in|to))?|path (for|to( (((current|frontmost) )?application|resource))?)|POSIX (file|path)|(background|RGB) color|(OK|cancel) button name|cancel button|button(s)?|cubic ((centi)?met(re|er)s|yards|feet|inches)|square ((kilo)?met(re|er)s|miles|yards|feet)|(centi|kilo)?met(re|er)s|miles|yards|feet|inches|lit(re|er)s|gallons|quarts|(kilo)?grams|ounces|pounds|degrees (Celsius|Fahrenheit|Kelvin)|print( (dialog|settings))?|clos(e(able)?|ing)|(de)?miniaturized|miniaturizable|zoom(ed|able)|attribute run|action (method|property|title)|phone|email|((start|end)ing|home) page|((birth|creation|current|custom|modification) )?date|((((phonetic )?(first|last|middle))|computer|host|maiden|related) |nick)?name|aim|icq|jabber|msn|yahoo|address(es)?|save addressbook|should enable action|city|country( code)?|formatte(r|d address)|(palette )?label|state|street|zip|AIM [Hh]andle(s)?|my card|select(ion| all)?|unsaved|(alpha )?value|entr(y|ies)|group|(ICQ|Jabber|MSN) handle|person|people|company|department|icon image|job title|note|organization|suffix|vcard|url|copies|collating|pages (across|down)|request print time|target( printer)?|((GUI Scripting|Script menu) )?enabled|show Computer scripts|(de)?activated|awake from nib|became (key|main)|call method|of (class|object)|center|clicked toolbar item|closed|for document|exposed|(can )?hide|idle|keyboard (down|up)|event( (number|type))?|launch(ed)?|load (image|movie|nib|sound)|owner|log|mouse (down|dragged|entered|exited|moved|up)|move|column|localization|resource|script|register|drag (info|types)|resigned (active|key|main)|resiz(e(d)?|able)|right mouse (down|dragged|up)|scroll wheel|(at )?index|should (close|open( untitled)?|quit( after last window closed)?|zoom)|((proposed|screen) )?bounds|show(n)?|behind|in front of|size (mode|to fit)|update(d| toolbar item)?|was (hidden|miniaturized)|will (become active|close|finish launching|hide|miniaturize|move|open|quit|(resign )?active|((maximum|minimum|proposed) )?size|show|zoom)|bundle|data source|movie|pasteboard|sound|tool(bar| tip)|(color|open|save) panel|coordinate system|frontmost|main( (bundle|menu|window))?|((services|(excluded from )?windows) )?menu|((executable|frameworks|resource|scripts|shared (frameworks|support)) )?path|(selected item )?identifier|data|content(s| view)?|character(s)?|click count|(command|control|option|shift) key down|context|delta (x|y|z)|key( code)?|location|pressure|unmodified characters|types|(first )?responder|playing|(allowed|selectable) identifiers|allows customization|(auto saves )?configuration|visible|image( name)?|menu form representation|tag|user(-| )defaults|associated file name|(auto|needs) display|current field editor|floating|has (resize indicator|shadow)|hides when deactivated|level|minimized (image|title)|opaque|position|release when closed|sheet|title(d)?)\b/g, +klass:"keyword"})}); diff --git a/dist/jquery.syntax.brush.assembly.js b/dist/jquery.syntax.brush.assembly.js new file mode 100644 index 0000000..f3013d7 --- /dev/null +++ b/dist/jquery.syntax.brush.assembly.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("assembly",function(a){a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push({pattern:/\.[a-zA-Z_][a-zA-Z0-9_]*/gm,klass:"directive"});a.push({pattern:/^[a-zA-Z_][a-zA-Z0-9_]*:/gm,klass:"label"});a.push({pattern:/^\s*([a-zA-Z]+)/gm,matches:Syntax.extractMatches({klass:"function"})});a.push({pattern:/(-[0-9]+)|(\b[0-9]+)|(\$[0-9]+)/g,klass:"constant"});a.push({pattern:/(\-|\b|\$)(0x[0-9a-f]+|[0-9]+|[a-z0-9_]+)/gi,klass:"constant"});a.push({pattern:/%\w+/g,klass:"register"}); +a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.perlStyleComment);a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.brush.bash-script.js b/dist/jquery.syntax.brush.bash-script.js new file mode 100644 index 0000000..1da775d --- /dev/null +++ b/dist/jquery.syntax.brush.bash-script.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("bash-script",function(a){a.push(["&&","|",";","{","}"],{klass:"operator"});a.push({pattern:/(?:^|\||;|&&)\s*((?:"([^"]|\\")+"|'([^']|\\')+'|\\\n|.|[ \t])+?)(?=$|\||;|&&)/gmi,matches:Syntax.extractMatches({brush:"bash-statement"})})}); +Syntax.register("bash-statement",function(a){a.push("break case continue do done elif else eq fi for function ge gt if in le lt ne return then until while".split(" "),{klass:"keyword"});a.push("> < = ` -- { } ( ) [ ]".split(" "),{klass:"operator"});a.push({pattern:/\(\((.*?)\)\)/gmi,klass:"expression",allow:["variable","string","operator","constant"]});a.push({pattern:/`([\s\S]+?)`/gmi,matches:Syntax.extractMatches({brush:"bash-script",debug:!0})});a.push(Syntax.lib.perlStyleComment);a.push({pattern:/^\s*((?:\S+?=\$?(?:\[[^\]]+\]|\(\(.*?\)\)|"(?:[^"]|\\")+"|'(?:[^']|\\')+'|\S+)\s*)*)((?:(\\ |\S)+)?)/gmi, +matches:Syntax.extractMatches({klass:"env",allow:["variable","string","operator","constant","expression"]},{klass:"function",allow:["variable","string"]})});a.push({pattern:/(\S+?)=/gmi,matches:Syntax.extractMatches({klass:"variable"}),only:["env"]});a.push({pattern:/\$\w+/g,klass:"variable"});a.push({pattern:/\s\-+[\w-]+/g,klass:"option"});a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.brush.bash.js b/dist/jquery.syntax.brush.bash.js new file mode 100644 index 0000000..04efaba --- /dev/null +++ b/dist/jquery.syntax.brush.bash.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.brushes.dependency("bash","bash-script");Syntax.register("bash",function(a){a.push({pattern:/^([\w@:~ ]*?[\$|#])\s+(.*?)$/gm,matches:Syntax.extractMatches({klass:"prompt"},{brush:"bash-script"})});a.push({pattern:/^\-\- .*$/gm,klass:"comment",allow:["href"]});a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.webLink);a.push({klass:"stderr",allow:["string","comment","constant","href"]})}); diff --git a/dist/jquery.syntax.brush.basic.js b/dist/jquery.syntax.brush.basic.js new file mode 100644 index 0000000..e8ac3df --- /dev/null +++ b/dist/jquery.syntax.brush.basic.js @@ -0,0 +1,5 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.lib.vbStyleComment={pattern:/' .*$/gm,klass:"comment",allow:["href"]}; +Syntax.register("basic",function(a){var b="- & &= * *= / /= \\ = ^ ^= + += = -=".split(" ");b="+ - * / += -= *= /= = := == != ! % ? > < >= <= && || & | ^ . ~ .. >> << >>> <<< >>= <<= >>>= <<<= %= ^= @".split(" ");a.push("CBool CByte CChar CDate CDec CDbl Char CInt CLng CObj Const CShort CSng CStr CType Date Decimal Variant String Short Long Single Double Object Integer Boolean Byte Char".split(" "),{klass:"type"});a.push("AddHandler AddressOf Alias And AndAlso Ansi As Assembly Auto ByRef ByVal Call Case Catch Declare Default Delegate Dim DirectCast Do Each Else ElseIf End Enum Erase Error Event Exit Finally For Function Get GetType GoSub GoTo Handles If Implements Imports In Inherits Interface Is Let Lib Like Loop Mod Module MustOverride Namespace New Next Not On Option Optional Or OrElse Overloads Overridable Overrides ParamArray Preserve Property RaiseEvent ReadOnly ReDim REM RemoveHandler Resume Return Select Set Static Step Stop Structure Sub SyncLock Then Throw To Try TypeOf Unicode Until When While With WithEvents WriteOnly Xor ExternalSource Region Print Class".split(" "),{klass:"keyword", +options:"gi"});a.push(b,{klass:"operator"});a.push("Public Protected Private Shared Friend Shadows MustInherit NotInheritable NotOverridable".split(" "),{klass:"access"});a.push(["Me","MyClass","MyBase","super","True","False","Nothing",/[A-Z][A-Z0-9_]+/g],{klass:"constant"});a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.vbStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.postprocess=function(a,b,c){jQuery(".function", +b).each(function(){var a=jQuery(this).text();jQuery(this).replaceWith(jQuery("").attr("href","http://social.msdn.microsoft.com/Search/en-us?query="+encodeURIComponent(a)).text(a))});return b}}); diff --git a/dist/jquery.syntax.brush.clang.js b/dist/jquery.syntax.brush.clang.js new file mode 100644 index 0000000..7719237 --- /dev/null +++ b/dist/jquery.syntax.brush.clang.js @@ -0,0 +1,5 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("clang",function(a){a.push("this true false NULL YES NO nil".split(" "),{klass:"constant"});a.push("mutable auto const register typename abstract".split(" "),{klass:"keyword"});a.push("double float int short char long signed unsigned bool void id".split(" "),{klass:"type"});a.push("@interface @implementation @protocol @end @try @throw @catch @finally @class @selector @encode @synchronized @property @synthesize @dynamic struct break continue else for switch case default enum goto register sizeof typedef volatile do extern if return static union while asm dynamic_cast namespace reinterpret_cast try explicit static_cast typeid catch operator template class const_cast inline throw virtual IBOutlet".split(" "), +{klass:"keyword"});a.push("+ * / - & | ~ ! % < = > [ ] new delete in".split(" "),{klass:"operator"});a.push("@private @protected @public @required @optional private protected public friend using".split(" "),{klass:"access"});a.push({pattern:/@property\((.*)\)[^;]+;/gmi,klass:"objective-c-property",allow:"*"});a.push("getter setter readwrite readonly assign retain copy nonatomic".split(" "),{klass:"keyword",only:["objective-c-property"]});a.push({pattern:/@(?=")/g,klass:"string"});a.push(Syntax.lib.camelCaseType); +a.push(Syntax.lib.cStyleType);a.push({pattern:/(?:class|struct|enum|namespace)\s+([^{;\s]+)/gmi,matches:Syntax.extractMatches({klass:"type"})});a.push({pattern:/#.*$/gmi,klass:"preprocessor",allow:["string"]});a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.webLink);a.push({pattern:/\w+:(?=.*(\]|;|\{))(?!:)/g,klass:"function"});a.push({pattern:/[^:\[]\s+(\w+)(?=\])/g,matches:Syntax.extractMatches({klass:"function"})});a.push({pattern:/-\s*(\([^\)]+?\))?\s*(\w+)\s*\{/g, +matches:Syntax.extractMatches({index:2,klass:"function"})});a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.cStyleFunction)}); diff --git a/dist/jquery.syntax.brush.csharp.js b/dist/jquery.syntax.brush.csharp.js new file mode 100644 index 0000000..6c1daf2 --- /dev/null +++ b/dist/jquery.syntax.brush.csharp.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("csharp",function(a){a.push(["this","true","false","null"],{klass:"constant"});a.push("object bool byte fixed float uint char ulong ushort decimal int sbyte short void long string double".split(" "),{klass:"type"});a.push("abstract add alias ascending base break case catch class const continue default delegate descending do dynamic else enum event explicit extern finally for foreach from get global goto group if implicit in interface into join let lock namespace new operator orderby out override params partial readonly ref remove return sealed select set stackalloc static struct switch throw try unsafe using value var virtual volatile where while yield".split(" "), +{klass:"keyword"});a.push("+ - * / % & | ^ ! ~ && || ++ -- << >> == != < > <= >= = ? new as is sizeof typeof checked unchecked".split(" "),{klass:"operator"});a.push(["public","private","internal","protected"],{klass:"access"});a.push(Syntax.lib.cStyleFunction);a.push({pattern:/(?:\.)([a-z_][a-z0-9_]+)/gi,matches:Syntax.extractMatches({klass:"function"})});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString); +a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber)}); diff --git a/dist/jquery.syntax.brush.css.js b/dist/jquery.syntax.brush.css.js new file mode 100644 index 0000000..0aa079e --- /dev/null +++ b/dist/jquery.syntax.brush.css.js @@ -0,0 +1,5 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("css",function(a){var e=[].concat(jQuery.map("AliceBlue AntiqueWhite Aqua Aquamarine Azure Beige Bisque Black BlanchedAlmond Blue BlueViolet Brown BurlyWood CadetBlue Chartreuse Chocolate Coral CornflowerBlue Cornsilk Crimson Cyan DarkBlue DarkCyan DarkGoldenRod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen Darkorange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DimGray DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod Gray Green GreenYellow HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan LightGoldenRodYellow LightGrey LightGreen LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquaMarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple Red RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen SeaShell Sienna Silver SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke Yellow YellowGreen".split(" "), +function(a){return"("+Syntax.Brush.convertStringToTokenPattern(a,!0)+")"}),jQuery.map(["#[0-9a-f]{3,6}","rgba?\\(.+?\\)","hsla?\\(.+?\\)"],function(a){return"("+Syntax.Brush.convertStringToTokenPattern(a,!1)+")"}));a.push({pattern:/\(.*?\)/g,allow:"*",disallow:["property"]});a.push({pattern:/\s*([:\.\[\]"'=\s\w#\.\-,]+)\s+\{/gm,matches:Syntax.extractMatches({klass:"selector",allow:["string"]})});a.push({pattern:new RegExp(e.join("|"),"gi"),klass:"color",process:function(a,d){d=Syntax.innerText(a); +var c=document.createElement("span");c.className="colour-box";var b=document.createElement("span");b.className="sample";b.style.backgroundColor=d;b.appendChild(document.createTextNode(" "));c.appendChild(b);a.appendChild(c);return a}});a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.webLink);a.push({pattern:/\{(.|\n)*?\}/g,klass:"properties",allow:"*"});a.push({pattern:/:(.*?(?=\})|(.|\n)*?(?=(\}|;)))/g,matches:Syntax.extractMatches({klass:"value",allow:["color"],only:["properties"]})});a.push({pattern:/([\-\w]+):/g, +matches:Syntax.extractMatches({klass:"property",process:Syntax.lib.webLinkProcess("http://cssdocs.org/")})});a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.cStyleFunction)}); diff --git a/dist/jquery.syntax.brush.diff.js b/dist/jquery.syntax.brush.diff.js new file mode 100644 index 0000000..7173edc --- /dev/null +++ b/dist/jquery.syntax.brush.diff.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("diff",function(a){a.push({pattern:/^\+\+\+.*$/gm,klass:"add"});a.push({pattern:/^\-\-\-.*$/gm,klass:"del"});a.push({pattern:/^@@.*@@/gm,klass:"offset"});a.push({pattern:/^\+[^\+]{1}.*$/gm,klass:"insert"});a.push({pattern:/^\-[^\-]{1}.*$/gm,klass:"remove"});a.postprocess=function(a,b,c){$(".insert",b).closest(".source").addClass("insert-line");$(".remove",b).closest(".source").addClass("remove-line");$(".offset",b).closest(".source").addClass("offset-line");return b}}); diff --git a/dist/jquery.syntax.brush.go.js b/dist/jquery.syntax.brush.go.js new file mode 100644 index 0000000..12a8a49 --- /dev/null +++ b/dist/jquery.syntax.brush.go.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("go",function(a){a.push(["true","false","iota","nil"],{klass:"constant"});a.push([/u?int\d*/g,/float\d+/g,/complex\d+/g,"byte","uintptr","string"],{klass:"type"});a.push("break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var".split(" "),{klass:"keyword"});a.push("+ & += &= && == != - | -= |= || < <= * ^ *= ^= <- > >= / << /= <<= ++ = := , ; % >> %= >>= -- ! ... . : &^ &^=".split(" "), +{klass:"operator"});a.push("append cap close complex copy imag len make new panic print println real recover".split(" "),{klass:"function"});a.push(Syntax.lib.cStyleFunction);a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber)}); diff --git a/dist/jquery.syntax.brush.haskell.js b/dist/jquery.syntax.brush.haskell.js new file mode 100644 index 0000000..b56f3ae --- /dev/null +++ b/dist/jquery.syntax.brush.haskell.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("haskell",function(a){a.push(["True","False"],{klass:"constant"});a.push("as;case;of;class;data;data family;data instance;default;deriving;deriving instance;do;forall;foreign;hiding;if;then;else;import;infix;infixl;infixr;instance;let;in;mdo;module;newtype;proc;qualified;rec;type;type family;type instance;where".split(";"),{klass:"keyword"});a.push("` | \\ - -< -<< -> * ? ?? # <- @ ! :: _ ~ > ; { }".split(" "),{klass:"operator"});a.push(Syntax.lib.camelCaseType);a.push({pattern:/\-\-.*$/gm, +klass:"comment",allow:["href"]});a.push({pattern:/\{\-[\s\S]*?\-\}/gm,klass:"comment",allow:["href"]});a.push(Syntax.lib.webLink);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape)}); diff --git a/dist/jquery.syntax.brush.html.js b/dist/jquery.syntax.brush.html.js new file mode 100644 index 0000000..8d40e8d --- /dev/null +++ b/dist/jquery.syntax.brush.html.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.brushes.dependency("html","xml");Syntax.brushes.dependency("html","javascript");Syntax.brushes.dependency("html","css");Syntax.brushes.dependency("html","php-script");Syntax.brushes.dependency("html","ruby"); +Syntax.register("html",function(a){a.push({pattern:/((.|\n)*?)<\/script>/gmi,matches:Syntax.extractMatches({brush:"javascript"})});a.push({pattern:/((.|\n)*?)<\/style>/gmi,matches:Syntax.extractMatches({brush:"css"})});a.push({pattern:/((<\?php)([\s\S]*?)(\?>))/gm,matches:Syntax.extractMatches({klass:"php-tag",allow:["keyword","php-script"]},{klass:"keyword"},{brush:"php-script"},{klass:"keyword"})});a.push({pattern:/((<\?rb?)([\s\S]*?)(\?>))/gm, +matches:Syntax.extractMatches({klass:"ruby-tag",allow:["keyword","ruby"]},{klass:"keyword"},{brush:"ruby"},{klass:"keyword"})});a.push({pattern:/<%=?(.*?)(%>)/g,klass:"instruction",allow:["string"]});a.push({pattern://g,matches:Syntax.extractMatches({klass:"doctype"})});a.push({pattern:/(%[0-9a-f]{2})/gi,klass:"percent-escape",only:["html"]});a.derives("xml")}); diff --git a/dist/jquery.syntax.brush.io.js b/dist/jquery.syntax.brush.io.js new file mode 100644 index 0000000..c80dae6 --- /dev/null +++ b/dist/jquery.syntax.brush.io.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("io",function(a){a.push(Syntax.lib.cStyleFunction);a.push(["return"],{klass:"keywords"});a.push("::= := or and @ + * / - & | ~ ! % < = > [ ] new delete".split(" "),{klass:"operator"});a.push({pattern:/\b([ \t]+([a-z]+))/gi,matches:Syntax.extractMatches({index:2,klass:"function"})});a.push({pattern:/\)([ \t]+([a-z]+))/gi,matches:Syntax.extractMatches({index:2,klass:"function"})});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.perlStyleComment);a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment); +a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber)}); diff --git a/dist/jquery.syntax.brush.java.js b/dist/jquery.syntax.brush.java.js new file mode 100644 index 0000000..643d143 --- /dev/null +++ b/dist/jquery.syntax.brush.java.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("java",function(a){a.push(["this","true","false","null"],{klass:"constant"});a.push("void byte short int long float double boolean char".split(" "),{klass:"type"});a.push("abstract continue for switch assert default goto synchronized do if break implements throw else import throws case enum return transient catch extends try final interface static class finally strictfp volatile const native super while".split(" "),{klass:"keyword"});a.push("++ -- ++ -- + - ~ ! * / % + - << >> >>> < > <= >= == != & ^ | && || ? = += -= *= /= %= &= ^= |= <<= >>= >>>= instanceof new delete".split(" "), +{klass:"operator"});a.push(["private","protected","public","package"],{klass:"access"});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.cStyleFunction);a.processes["function"]=Syntax.lib.webLinkProcess('java "Developer Documentation"', +!0)}); diff --git a/dist/jquery.syntax.brush.javascript.js b/dist/jquery.syntax.brush.javascript.js new file mode 100644 index 0000000..4af2fa2 --- /dev/null +++ b/dist/jquery.syntax.brush.javascript.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("javascript",function(a){a.push(["this","true","false","null"],{klass:"constant"});a.push("async await break case catch class const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield".split(" "),{klass:"keyword"});a.push("+*/-&|~!%<=>".split(""),{klass:"operator"});a.push("implements package protected interface private public".split(" "),{klass:"access"});a.push(Syntax.lib.perlStyleRegularExpression); +a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.cStyleFunction)}); diff --git a/dist/jquery.syntax.brush.kai.js b/dist/jquery.syntax.brush.kai.js new file mode 100644 index 0000000..ad26dd1 --- /dev/null +++ b/dist/jquery.syntax.brush.kai.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("kai",function(a){a.push("()[]{}".split(""),{klass:"operator"});a.push(Syntax.lib.perlStyleComment);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.webLink);a.push({pattern:/\(([^\s\(\)]+)/gi,matches:Syntax.extractMatches({klass:"function"})});a.push({pattern:/`[a-z]*/gi,klass:"constant"});a.push(Syntax.lib.multiLineDoubleQuotedString);a.push(Syntax.lib.stringEscape)}); diff --git a/dist/jquery.syntax.brush.lisp.js b/dist/jquery.syntax.brush.lisp.js new file mode 100644 index 0000000..c58e79a --- /dev/null +++ b/dist/jquery.syntax.brush.lisp.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.lib.lispStyleComment={pattern:/(;+) .*$/gm,klass:"comment",allow:["href"]};Syntax.register("lisp",function(a){a.push(["(",")"],{klass:"operator"});a.push(Syntax.lib.lispStyleComment);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.webLink);a.push({pattern:/\(\s*([^\s\(\)]+)/gmi,matches:Syntax.extractMatches({klass:"function"})});a.push({pattern:/#[a-z]+/gi,klass:"constant"});a.push(Syntax.lib.multiLineDoubleQuotedString);a.push(Syntax.lib.stringEscape)}); diff --git a/dist/jquery.syntax.brush.lua.js b/dist/jquery.syntax.brush.lua.js new file mode 100644 index 0000000..d113a6b --- /dev/null +++ b/dist/jquery.syntax.brush.lua.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("lua",function(a){a.push(["self","true","false","nil"],{klass:"constant"});a.push("and break do else elseif end false for function if in local nil not or repeat return then true until while".split(" "),{klass:"keyword"});a.push("+ - * / % ^ # .. = == ~= < > <= >= ? :".split(" "),{klass:"operator"});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleFunction);a.push({pattern:/\-\-.*$/gm,klass:"comment",allow:["href"]});a.push({pattern:/\-\-\[\[(\n|.)*?\]\]\-\-/gm,klass:"comment", +allow:["href"]});a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.brush.nginx.js b/dist/jquery.syntax.brush.nginx.js new file mode 100644 index 0000000..76f494a --- /dev/null +++ b/dist/jquery.syntax.brush.nginx.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("nginx",function(a){a.push({pattern:/((\w+).*?);/g,matches:Syntax.extractMatches({klass:"directive",allow:"*"},{klass:"function",process:Syntax.lib.webLinkProcess("http://nginx.org/r/")})});a.push({pattern:/(\w+).*?{/g,matches:Syntax.extractMatches({klass:"keyword"})});a.push({pattern:/(\$)[\w]+/g,klass:"variable"});a.push(Syntax.lib.perlStyleComment);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.brush.ocaml.js b/dist/jquery.syntax.brush.ocaml.js new file mode 100644 index 0000000..ce40494 --- /dev/null +++ b/dist/jquery.syntax.brush.ocaml.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("ocaml",function(a){a.push(["private","public"],{klass:"access"});a.push(["true","false"],{klass:"constant"});a.push(["bool","byte","sbyte",/\bu?int\d*\b/g,"nativeint","unativeint","char","string","decimal","unit","void","float32","single","float64","double","list","array","exn","format","fun","option","ref"],{klass:"type"});a.push("abstract and as assert begin class default delegate do done downcast downto elif else end exception extern finally for fun function if in inherit inline interface internal lazy let match member module mutable namespace new null of open or override rec return static struct then to try type upcast use val when while with yield asr land lor lsl lsr lxor mod sig atomic break checked component const constraint constructor continue eager event external fixed functor global include method mixin object parallel process protected pure sealed trait virtual volatile val".split(" "), +{klass:"keyword"});a.push("! <> % & * + - -> / :: := :> :? :?> < = > ? @ ^ _ ` | ~ ' [< >] <| |> [| |] (| |) (* *) in".split(" "),{klass:"operator"});a.push({pattern:/(?:open|new)\s+((?:\.?[a-z][a-z0-9]*)+)/gi,matches:Syntax.extractMatches({klass:"type"})});a.push({pattern:/(?:\.)([a-z_][a-z0-9_]+)/gi,matches:Syntax.extractMatches({klass:"function"})});a.push({pattern:/(?:\(|,)\s*(\w+\s*=)/g,matches:Syntax.extractMatches({klass:"keyword-argument"})});a.push({pattern:/([a-z_][a-z0-9_]*)\s*\((?!\*)/gi, +matches:Syntax.extractMatches({klass:"function"})});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.webLink);a.push({pattern:/\(\*[\s\S]*?\*\)/g,klass:"comment"});a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber)}); diff --git a/dist/jquery.syntax.brush.ooc.js b/dist/jquery.syntax.brush.ooc.js new file mode 100644 index 0000000..50106db --- /dev/null +++ b/dist/jquery.syntax.brush.ooc.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("ooc",function(a){a.push(["this","super","true","false","null",/[A-Z][A-Z0-9_]+/g],{klass:"constant"});a.push("Int Int8 Int16 Int32 Int64 Int80 Int128 UInt UInt8 UInt16 UInt32 UInt64 UInt80 UInt128 Octet Short UShort Long ULong LLong ULLong Float Double LDouble Float32 Float64 Float128 Char UChar WChar String Void Pointer Bool SizeT This".split(" "),{klass:"type"});a.push("class interface implement abstract extends from const final static import use extern inline proto break continue fallthrough operator if else for while do switch case as in version return include cover func".split(" "), +{klass:"keyword"});a.push("+ - * / += -= *= /= = := == != ! % ? > < >= <= && || & | ^ . ~ .. >> << >>> <<< >>= <<= >>>= <<<= %= ^= @".split(" "),{klass:"operator"});a.push({pattern:/0[xcb][0-9a-fA-F]+/g,klass:"constant"});a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleType);a.push(Syntax.lib.cStyleFunction);a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString); +a.push(Syntax.lib.stringEscape);a.processes["function"]=Syntax.lib.webLinkProcess("http://docs.ooc-lang.org/search.html?q=")}); diff --git a/dist/jquery.syntax.brush.pascal.js b/dist/jquery.syntax.brush.pascal.js new file mode 100644 index 0000000..4ed199a --- /dev/null +++ b/dist/jquery.syntax.brush.pascal.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("pascal",function(a){a.push(["true","false","nil"],{klass:"constant",options:"gi"});a.push("absolute abstract all and_then as asm asmname attribute begin bindable c c_language case class const constructor destructor dispose do downto else end except exit export exports external far file finalization finally for forward function goto if implementation import inherited initialization inline interface interrupt is keywords label library module name near new object of on only operator or_else otherwise packed pascal pow private procedure program property protected public published qualified raise record repeat resident restricted segment set then threadvar to try type unit until uses value var view virtual while with".split(" "), +{klass:"keyword",options:"gi"});a.push("+ - * / div mod and or xor shl shr not = >= > <> <= < in :=".split(" "),{klass:"operator",options:"gi"});a.push(Syntax.lib.camelCaseType);a.push({pattern:/\{[\s\S]*?\}/gm,klass:"comment",allow:["href"]});a.push({pattern:/\(\*[\s\S]*?\*\)/gm,klass:"comment",allow:["href"]});a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber); +a.push(Syntax.lib.cStyleFunction)}); diff --git a/dist/jquery.syntax.brush.perl5.js b/dist/jquery.syntax.brush.perl5.js new file mode 100644 index 0000000..9da04dd --- /dev/null +++ b/dist/jquery.syntax.brush.perl5.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("perl5",function(a){a.push(["this","true","false"],{klass:"constant"});a.push("bless caller continue die do dump else elsif eval exit for foreach goto if import last local my next no our package redo ref require return sub tie tied unless untie until use wantarray while".split(" "),{klass:"keyword"});a.push("-> ++ -- ** ! ~ \\ + - =~ !~ * / % x + - . << >> < > <= >= lt gt le ge == != <=> eq ne cmp ~~ & | ^ && || // .. ... ?: = , => not and or xor".split(" "),{klass:"operator"});a.push("abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr chroot close closedir connect cos crypt defined delete each endgrent endhostent endnetent endprotoent endpwent endservent eof exec exists exp fcntl fileno flock fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime grep hex index int ioctl join keys kill lc lcfirst length link listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd oct open opendir ord pack pipe pop pos print printf prototype push quotemeta rand read readdir readline readlink readpipe recv rename reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study substr symlink syscall sysopen sysread sysseek system syswrite tell telldir time times tr truncate uc ucfirst umask undef unlink unpack unshift utime values vec wait waitpid warn write".split(" "), +{klass:"function"});a.push(Syntax.lib.perlStyleRegularExpression);a.push(Syntax.lib.perlStyleComment);a.push(Syntax.lib.webLink);a.push({pattern:/(\$|@|%)\w+/gi,klass:"variable"});a.push({pattern:/__END__[\s\S]*/gm,klass:"comment"});a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.cStyleFunction)}); diff --git a/dist/jquery.syntax.brush.php-script.js b/dist/jquery.syntax.brush.php-script.js new file mode 100644 index 0000000..6e77b76 --- /dev/null +++ b/dist/jquery.syntax.brush.php-script.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("php-script",function(a){a.push(["this","true","false"],{klass:"constant"});a.push("abstract and as break case cfunction class const continue declare default die do echo else elseif enddeclare endfor endforeach endif endswitch endwhile extends extends for foreach function global if implements include include_once interface old_function or require require_once return static switch throw use var while xor".split(" "),{klass:"keyword"});a.push("+ * / - & | ~ ! % < = > [ ] new".split(" "), +{klass:"operator"});a.push(["private","protected","public"],{klass:"access"});a.push({pattern:/\$[a-z_][a-z0-9]*/gi,klass:"variable"});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleFunction);a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.perlStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber); +a.processes["function"]=Syntax.lib.webLinkProcess("http://www.php.net/manual-lookup.php?pattern=")}); diff --git a/dist/jquery.syntax.brush.php.js b/dist/jquery.syntax.brush.php.js new file mode 100644 index 0000000..32336fd --- /dev/null +++ b/dist/jquery.syntax.brush.php.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.brushes.dependency("php","php-script");Syntax.register("php",function(a){a.push({pattern:/(<\?(php)?)((.|\n)*?)(\?>)/gm,matches:Syntax.extractMatches({klass:"keyword"},null,{brush:"php-script"},null,{klass:"keyword"})})}); diff --git a/dist/jquery.syntax.brush.plain.js b/dist/jquery.syntax.brush.plain.js new file mode 100644 index 0000000..5d7e151 --- /dev/null +++ b/dist/jquery.syntax.brush.plain.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("plain",function(a){a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.brush.protobuf.js b/dist/jquery.syntax.brush.protobuf.js new file mode 100644 index 0000000..4ee2cfe --- /dev/null +++ b/dist/jquery.syntax.brush.protobuf.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("protobuf",function(a){a.push("enum extend extensions group import max message option package returns rpc service syntax to default".split(" "),{klass:"keyword"});a.push(["true","false"],{klass:"constant"});a.push("bool bytes double fixed32 fixed64 float int32 int64 sfixed32 sfixed64 sint32 sint64 string uint32 uint64".split(" "),{klass:"type"});a.push(["optional","required","repeated"],{klass:"access"});a.push(Syntax.lib.camelCaseType);a.push({pattern:/\s+(\w+)\s*=\s*\d+/g,matches:Syntax.extractMatches({klass:"variable"})}); +a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber)}); diff --git a/dist/jquery.syntax.brush.python.js b/dist/jquery.syntax.brush.python.js new file mode 100644 index 0000000..36e73c7 --- /dev/null +++ b/dist/jquery.syntax.brush.python.js @@ -0,0 +1,5 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("python",function(a){a.push({pattern:/^\s*@\w+/gm,klass:"decorator"});a.push(["self","True","False","None"],{klass:"constant"});a.push("and as assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while with yield".split(" "),{klass:"keyword"});a.push("!= % %= & &= ( ) * ** **= *= + += , - -= . / // //= /= : ; < << <<= <= <> = == > >= >> >>= @ [ ] ^ ^= ` ` { | |= } ~".split(" "),{klass:"operator"}); +a.push("abs all any basestring bin bool callable chr classmethod cmp compile complex delattr dict dir divmod enumerate eval execfile file filter float format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len list locals long map max min next object oct open ord pow print property range raw_input reduce reload repr reversed round set setattr slice sorted staticmethod str sum super tuple type type unichr unicode vars xrange zip __import__ apply buffer coerce intern".split(" "), +{klass:"builtin"});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleFunction);a.push(Syntax.lib.perlStyleComment);a.push({pattern:/(['"]{3})([^\1])*?\1/gm,klass:"comment"});a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.processes["function"]=Syntax.lib.webLinkProcess("http://docs.python.org/search.html?q=");a.processes.type=Syntax.lib.webLinkProcess("http://docs.python.org/search.html?q="); +a.processes.builtin=Syntax.lib.webLinkProcess("http://docs.python.org/search.html?q=")}); diff --git a/dist/jquery.syntax.brush.ruby.js b/dist/jquery.syntax.brush.ruby.js new file mode 100644 index 0000000..494e5aa --- /dev/null +++ b/dist/jquery.syntax.brush.ruby.js @@ -0,0 +1,5 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.lib.rubyStyleFunction={pattern:/(?:def\s+|\.)([a-z_][a-z0-9_]+)/gi,matches:Syntax.extractMatches({klass:"function"})};Syntax.lib.rubyStyleSymbol={pattern:/([:]?):\w+/g,klass:"constant",matches:function(a,b){return""!=a[1]?[]:[new Syntax.Match(a.index,a[0].length,b,a[0])]}}; +Syntax.register("ruby",function(a){a.push(["private","protected","public"],{klass:"access"});a.push(["self","super","true","false","nil"],{klass:"constant"});a.push({pattern:/(%[\S])(\{[\s\S]*?\})/g,matches:Syntax.extractMatches({klass:"function"},{klass:"constant"})});a.push({pattern:/`[^`]+`/g,klass:"string"});a.push({pattern:/#\{([^\}]*)\}/g,matches:Syntax.extractMatches({brush:"ruby",only:["string"]})});a.push(Syntax.lib.rubyStyleRegularExpression);a.push({pattern:/(@+|\$)[\w]+/g,klass:"variable"}); +a.push(Syntax.lib.camelCaseType);a.push("alias and begin break case class def define_method defined? do else elsif end ensure false for if in module next not or raise redo rescue retry return then throw undef unless until when while yield block_given?".split(" "),{klass:"keyword"});a.push("+*/-&|~!%<=>".split(""),{klass:"operator"});a.push(Syntax.lib.rubyStyleSymbol);a.push(Syntax.lib.perlStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString); +a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.rubyStyleFunction);a.push(Syntax.lib.cStyleFunction)}); diff --git a/dist/jquery.syntax.brush.scala.js b/dist/jquery.syntax.brush.scala.js new file mode 100644 index 0000000..7373bc6 --- /dev/null +++ b/dist/jquery.syntax.brush.scala.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.brushes.dependency("scala","xml"); +Syntax.register("scala",function(a){a.push("abstract do finally import object return trait var case catch class else extends for forSome if lazy match new override package private sealed super try type while with yield def final implicit protected throw val".split(" "),{klass:"keyword"});a.push("_ : = => <- <: <% >: # @".split(" "),{klass:"operator"});a.push(["this","null","true","false"],{klass:"constant"});a.push({pattern:/"""[\s\S]*?"""/g,klass:"string"});a.push(Syntax.lib.doubleQuotedString); +a.push({pattern:/(?:def\s+|\.)([a-z_][a-z0-9_]+)/gi,matches:Syntax.extractMatches({klass:"function"})});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.cStyleFunction);a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.derives("xml")}); diff --git a/dist/jquery.syntax.brush.smalltalk.js b/dist/jquery.syntax.brush.smalltalk.js new file mode 100644 index 0000000..2ea8804 --- /dev/null +++ b/dist/jquery.syntax.brush.smalltalk.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("smalltalk",function(a){a.push(["self","super","true","false","nil"],{klass:"constant"});a.push(["[","]","|",":=","."],{klass:"operator"});a.push({pattern:/\w+:/g,klass:"function"});a.push(Syntax.lib.camelCaseType);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber)}); diff --git a/dist/jquery.syntax.brush.sql.js b/dist/jquery.syntax.brush.sql.js new file mode 100644 index 0000000..e4c938b --- /dev/null +++ b/dist/jquery.syntax.brush.sql.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.lib.sqlStyleComment={pattern:/-- .*$/gm,klass:"comment",allow:["href"]}; +Syntax.register("sql",function(a){a.push("= != < > <= >= + - * / %".split(" "),{klass:"operator"});a.push(Syntax.lib.sqlStyleComment);a.push("A ABORT ABS ABSOLUTE ACCESS ACTION ADA ADD ADMIN AFTER AGGREGATE ALIAS ALL ALLOCATE ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY ARE ARRAY AS ASC ASENSITIVE ASSERTION ASSIGNMENT ASYMMETRIC AT ATOMIC ATTRIBUTE ATTRIBUTES AUDIT AUTHORIZATION AUTO_INCREMENT AVG AVG_ROW_LENGTH BACKUP BACKWARD BEFORE BEGIN BERNOULLI BETWEEN BIGINT BINARY BIT BIT_LENGTH BITVAR BLOB BOOL BOOLEAN BOTH BREADTH BREAK BROWSE BULK BY C CACHE CALL CALLED CARDINALITY CASCADE CASCADED CASE CAST CATALOG CATALOG_NAME CEIL CEILING CHAIN CHANGE CHAR CHAR_LENGTH CHARACTER CHARACTER_LENGTH CHARACTER_SET_CATALOG CHARACTER_SET_NAME CHARACTER_SET_SCHEMA CHARACTERISTICS CHARACTERS CHECK CHECKED CHECKPOINT CHECKSUM CLASS CLASS_ORIGIN CLOB CLOSE CLUSTER CLUSTERED COALESCE COBOL COLLATE COLLATION COLLATION_CATALOG COLLATION_NAME COLLATION_SCHEMA COLLECT COLUMN COLUMN_NAME COLUMNS COMMAND_FUNCTION COMMAND_FUNCTION_CODE COMMENT COMMIT COMMITTED COMPLETION COMPRESS COMPUTE CONDITION CONDITION_NUMBER CONNECT CONNECTION CONNECTION_NAME CONSTRAINT CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONSTRAINTS CONSTRUCTOR CONTAINS CONTAINSTABLE CONTINUE CONVERSION CONVERT COPY CORR CORRESPONDING COUNT COVAR_POP COVAR_SAMP CREATE CREATEDB CREATEROLE CREATEUSER CROSS CSV CUBE CUME_DIST CURRENT CURRENT_DATE CURRENT_DEFAULT_TRANSFORM_GROUP CURRENT_PATH CURRENT_ROLE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_TRANSFORM_GROUP_FOR_TYPE CURRENT_USER CURSOR CURSOR_NAME CYCLE DATA DATABASE DATABASES DATE DATETIME DATETIME_INTERVAL_CODE DATETIME_INTERVAL_PRECISION DAY DAY_HOUR DAY_MICROSECOND DAY_MINUTE DAY_SECOND DAYOFMONTH DAYOFWEEK DAYOFYEAR DBCC DEALLOCATE DEC DECIMAL DECLARE DEFAULT DEFAULTS DEFERRABLE DEFERRED DEFINED DEFINER DEGREE DELAY_KEY_WRITE DELAYED DELETE DELIMITER DELIMITERS DENSE_RANK DENY DEPTH DEREF DERIVED DESC DESCRIBE DESCRIPTOR DESTROY DESTRUCTOR DETERMINISTIC DIAGNOSTICS DICTIONARY DISABLE DISCONNECT DISK DISPATCH DISTINCT DISTINCTROW DISTRIBUTED DIV DO DOMAIN DOUBLE DROP DUAL DUMMY DUMP DYNAMIC DYNAMIC_FUNCTION DYNAMIC_FUNCTION_CODE EACH ELEMENT ELSE ELSEIF ENABLE ENCLOSED ENCODING ENCRYPTED END END-EXEC ENUM EQUALS ERRLVL ESCAPE ESCAPED EVERY EXCEPT EXCEPTION EXCLUDE EXCLUDING EXCLUSIVE EXEC EXECUTE EXISTING EXISTS EXIT EXP EXPLAIN EXTERNAL EXTRACT FALSE FETCH FIELDS FILE FILLFACTOR FILTER FINAL FIRST FLOAT FLOAT4 FLOAT8 FLOOR FLUSH FOLLOWING FOR FORCE FOREIGN FORTRAN FORWARD FOUND FREE FREETEXT FREETEXTTABLE FREEZE FROM FULL FULLTEXT FUNCTION FUSION G GENERAL GENERATED GET GLOBAL GO GOTO GRANT GRANTED GRANTS GREATEST GROUP GROUPING HANDLER HAVING HEADER HEAP HIERARCHY HIGH_PRIORITY HOLD HOLDLOCK HOST HOSTS HOUR HOUR_MICROSECOND HOUR_MINUTE HOUR_SECOND IDENTIFIED IDENTITY IDENTITY_INSERT IDENTITYCOL IF IGNORE ILIKE IMMEDIATE IMMUTABLE IMPLEMENTATION IMPLICIT IN INCLUDE INCLUDING INCREMENT INDEX INDICATOR INFILE INFIX INHERIT INHERITS INITIAL INITIALIZE INITIALLY INNER INOUT INPUT INSENSITIVE INSERT INSERT_ID INSTANCE INSTANTIABLE INSTEAD INT INT1 INT2 INT3 INT4 INT8 INTEGER INTERSECT INTERSECTION INTERVAL INTO INVOKER IS ISAM ISNULL ISOLATION ITERATE JOIN K KEY KEY_MEMBER KEY_TYPE KEYS KILL LANCOMPILER LANGUAGE LARGE LAST LAST_INSERT_ID LATERAL LEADING LEAST LEAVE LEFT LENGTH LESS LEVEL LIKE LIMIT LINENO LINES LISTEN LN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION LOCATOR LOCK LOGIN LOGS LONG LONGBLOB LONGTEXT LOOP LOW_PRIORITY LOWER M MAP MATCH MATCHED MAX MAX_ROWS MAXEXTENTS MAXVALUE MEDIUMBLOB MEDIUMINT MEDIUMTEXT MEMBER MERGE MESSAGE_LENGTH MESSAGE_OCTET_LENGTH MESSAGE_TEXT METHOD MIDDLEINT MIN MIN_ROWS MINUS MINUTE MINUTE_MICROSECOND MINUTE_SECOND MINVALUE MLSLABEL MOD MODE MODIFIES MODIFY MODULE MONTH MONTHNAME MORE MOVE MULTISET MUMPS MYISAM NAMES NATIONAL NATURAL NCHAR NCLOB NESTING NEW NEXT NO NO_WRITE_TO_BINLOG NOAUDIT NOCHECK NOCOMPRESS NOCREATEDB NOCREATEROLE NOCREATEUSER NOINHERIT NOLOGIN NONCLUSTERED NONE NORMALIZE NORMALIZED NOSUPERUSER NOT NOTHING NOTIFY NOTNULL NOWAIT NULL NULLABLE NULLIF NULLS NUMBER NUMERIC OBJECT OCTET_LENGTH OCTETS OF OFF OFFLINE OFFSET OFFSETS OIDS OLD ON ONLINE ONLY OPEN OPENDATASOURCE OPENQUERY OPENROWSET OPENXML OPERATION OPERATOR OPTIMIZE OPTION OPTIONALLY OPTIONS OR ORDER ORDERING ORDINALITY OTHERS OUT OUTER OUTFILE OUTPUT OVER OVERLAPS OVERLAY OVERRIDING OWNER PACK_KEYS PAD PARAMETER PARAMETER_MODE PARAMETER_NAME PARAMETER_ORDINAL_POSITION PARAMETER_SPECIFIC_CATALOG PARAMETER_SPECIFIC_NAME PARAMETER_SPECIFIC_SCHEMA PARAMETERS PARTIAL PARTITION PASCAL PASSWORD PATH PCTFREE PERCENT PERCENT_RANK PERCENTILE_CONT PERCENTILE_DISC PLACING PLAN PLI POSITION POSTFIX POWER PRECEDING PRECISION PREFIX PREORDER PREPARE PREPARED PRESERVE PRIMARY PRINT PRIOR PRIVILEGES PROC PROCEDURAL PROCEDURE PROCESS PROCESSLIST PUBLIC PURGE QUOTE RAID0 RAISERROR RANGE RANK RAW READ READS READTEXT REAL RECHECK RECONFIGURE RECURSIVE REF REFERENCES REFERENCING REGEXP REGR_AVGX REGR_AVGY REGR_COUNT REGR_INTERCEPT REGR_R2 REGR_SLOPE REGR_SXX REGR_SXY REGR_SYY REINDEX RELATIVE RELEASE RELOAD RENAME REPEAT REPEATABLE REPLACE REPLICATION REQUIRE RESET RESIGNAL RESOURCE RESTART RESTORE RESTRICT RESULT RETURN RETURNED_CARDINALITY RETURNED_LENGTH RETURNED_OCTET_LENGTH RETURNED_SQLSTATE RETURNS REVOKE RIGHT RLIKE ROLE ROLLBACK ROLLUP ROUTINE ROUTINE_CATALOG ROUTINE_NAME ROUTINE_SCHEMA ROW ROW_COUNT ROW_NUMBER ROWCOUNT ROWGUIDCOL ROWID ROWNUM ROWS RULE SAVE SAVEPOINT SCALE SCHEMA SCHEMA_NAME SCHEMAS SCOPE SCOPE_CATALOG SCOPE_NAME SCOPE_SCHEMA SCROLL SEARCH SECOND SECOND_MICROSECOND SECTION SECURITY SELECT SELF SENSITIVE SEPARATOR SEQUENCE SERIALIZABLE SERVER_NAME SESSION SESSION_USER SET SETOF SETS SETUSER SHARE SHOW SHUTDOWN SIGNAL SIMILAR SIMPLE SIZE SMALLINT SOME SONAME SOURCE SPACE SPATIAL SPECIFIC SPECIFIC_NAME SPECIFICTYPE SQL SQL_BIG_RESULT SQL_BIG_SELECTS SQL_BIG_TABLES SQL_CALC_FOUND_ROWS SQL_LOG_OFF SQL_LOG_UPDATE SQL_LOW_PRIORITY_UPDATES SQL_SELECT_LIMIT SQL_SMALL_RESULT SQL_WARNINGS SQLCA SQLCODE SQLERROR SQLEXCEPTION SQLSTATE SQLWARNING SQRT SSL STABLE START STARTING STATE STATEMENT STATIC STATISTICS STATUS STDDEV_POP STDDEV_SAMP STDIN STDOUT STORAGE STRAIGHT_JOIN STRICT STRING STRUCTURE STYLE SUBCLASS_ORIGIN SUBLIST SUBMULTISET SUBSTRING SUCCESSFUL SUM SUPERUSER SYMMETRIC SYNONYM SYSDATE SYSID SYSTEM SYSTEM_USER TABLE TABLE_NAME TABLES TABLESAMPLE TABLESPACE TEMP TEMPLATE TEMPORARY TERMINATE TERMINATED TEXT TEXTSIZE THAN THEN TIES TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TINYBLOB TINYINT TINYTEXT TO TOAST TOP TOP_LEVEL_COUNT TRAILING TRAN TRANSACTION TRANSACTION_ACTIVE TRANSACTIONS_COMMITTED TRANSACTIONS_ROLLED_BACK TRANSFORM TRANSFORMS TRANSLATE TRANSLATION TREAT TRIGGER TRIGGER_CATALOG TRIGGER_NAME TRIGGER_SCHEMA TRIM TRUE TRUNCATE TRUSTED TSEQUAL TYPE UESCAPE UID UNBOUNDED UNCOMMITTED UNDER UNDO UNENCRYPTED UNION UNIQUE UNKNOWN UNLISTEN UNLOCK UNNAMED UNNEST UNSIGNED UNTIL UPDATE UPDATETEXT UPPER USAGE USE USER USER_DEFINED_TYPE_CATALOG USER_DEFINED_TYPE_CODE USER_DEFINED_TYPE_NAME USER_DEFINED_TYPE_SCHEMA USING UTC_DATE UTC_TIME UTC_TIMESTAMP VACUUM VALID VALIDATE VALIDATOR VALUE VALUES VAR_POP VAR_SAMP VARBINARY VARCHAR VARCHAR2 VARCHARACTER VARIABLE VARIABLES VARYING VERBOSE VIEW VOLATILE WAITFOR WHEN WHENEVER WHERE WHILE WIDTH_BUCKET WINDOW WITH WITHIN WITHOUT WORK WRITE WRITETEXT X509 XOR YEAR YEAR_MONTH ZEROFILL ZONE".split(" "),{klass:"keyword", +options:"gi"});a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.brush.super-collider.js b/dist/jquery.syntax.brush.super-collider.js new file mode 100644 index 0000000..e59faa5 --- /dev/null +++ b/dist/jquery.syntax.brush.super-collider.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("super-collider",function(a){a.push(["const","arg","classvar","var"],{klass:"keyword"});a.push("`+@:*/-&|~!%<=>".split(""),{klass:"operator"});a.push("thisFunctionDef thisFunction thisMethod thisProcess thisThread this super true false nil inf".split(" "),{klass:"constant"});a.push(Syntax.lib.camelCaseType);a.push({pattern:/\$(\\)?./g,klass:"constant"});a.push({pattern:/\\[a-z_][a-z0-9_]*/gi,klass:"symbol"});a.push({pattern:/'[^']+'/g,klass:"symbol"});a.push(Syntax.lib.cStyleComment); +a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push({pattern:/(?:\.)([a-z_][a-z0-9_]*)/gi,matches:Syntax.extractMatches({klass:"function"})});a.push(Syntax.lib.cStyleFunction)}); diff --git a/dist/jquery.syntax.brush.swift.js b/dist/jquery.syntax.brush.swift.js new file mode 100644 index 0000000..e800c16 --- /dev/null +++ b/dist/jquery.syntax.brush.swift.js @@ -0,0 +1,3 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("swift",function(a){a.push(["fileprivate","open","private","public"],{klass:"access"});a.push(["self","super","true","false","nil"],{klass:"constant"});a.push({pattern:/`[^`]+`/g,klass:"identifier"});a.push({pattern:/\\\(([^)]*)\)/g,matches:Syntax.extractMatches({brush:"swift",only:["string"]})});a.push(Syntax.lib.camelCaseType);a.push("associatedtype class deinit enum extension fileprivate func import init inout internal let operator private protocol static struct subscript typealias var break case continue default defer do else fallthrough for guard if in repeat return switch where while as catch is rethrows throw throws try _ #available #colorLiteral #column #else #elseif #endif #file #fileLiteral #function #if #imageLiteral #line #selector #sourceLocation associativity convenience dynamic didSet final get infix indirect lazy left mutating none nonmutating optional override postfix precedence prefix Protocol required right set Type unowned weak willSet".split(" "), +{klass:"keyword"});a.push("+ * / - & | ~ ! % < = > ( ) { } [ ] . , : ; = @ # -> ` ? !".split(" "),{klass:"operator"});a.push(Syntax.lib.cStyleComment);a.push(Syntax.lib.cppStyleComment);a.push(Syntax.lib.webLink);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push(Syntax.lib.stringEscape);a.push(Syntax.lib.decimalNumber);a.push(Syntax.lib.hexNumber);a.push(Syntax.lib.cStyleFunction)}); diff --git a/dist/jquery.syntax.brush.xml.js b/dist/jquery.syntax.brush.xml.js new file mode 100644 index 0000000..a3ba225 --- /dev/null +++ b/dist/jquery.syntax.brush.xml.js @@ -0,0 +1,4 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.lib.xmlEntity={pattern:/&\w+;/g,klass:"entity"};Syntax.lib.xmlPercentEscape={pattern:/(%[0-9a-f]{2})/gi,klass:"percent-escape",only:["string"]}; +Syntax.register("xml-tag",function(a){a.push({pattern:/<\/?((?:[^:\s>]+:)?)([^\s>]+)(\s[^>]*)?\/?>/g,matches:Syntax.extractMatches({klass:"namespace"},{klass:"tag-name"})});a.push({pattern:/([^=\s]+)=(".*?"|'.*?'|[^\s>]+)/g,matches:Syntax.extractMatches({klass:"attribute",only:["tag"]},{klass:"string",only:["tag"]})});a.push(Syntax.lib.xmlEntity);a.push(Syntax.lib.xmlPercentEscape);a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString)}); +Syntax.register("xml",function(a){a.push({pattern:/()/gm,matches:Syntax.extractMatches({klass:"cdata",allow:["cdata-content","cdata-tag"]},{klass:"cdata-tag"},{klass:"cdata-content"},{klass:"cdata-tag"})});a.push(Syntax.lib.xmlComment);a.push({pattern:/<[^>\-\s]([^>'"!\/;\?@\[\]^`\{\}\|]|"[^"]*"|'[^']')*[\/?]?>/g,brush:"xml-tag"});a.push(Syntax.lib.xmlEntity);a.push(Syntax.lib.xmlPercentEscape);a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.brush.xrb.js b/dist/jquery.syntax.brush.xrb.js new file mode 100644 index 0000000..6a4fb0c --- /dev/null +++ b/dist/jquery.syntax.brush.xrb.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.brushes.dependency("xrb","xml");Syntax.brushes.dependency("xrb","ruby");Syntax.register("xrb",function(a){a.push({pattern:/((<\?r)([\s\S]*?)(\?>))/gm,matches:Syntax.extractMatches({klass:"ruby-tag",allow:["keyword","ruby"]},{klass:"keyword"},{brush:"ruby"},{klass:"keyword"})});a.push({pattern:/((#{)([\s\S]*?)(}))/gm,matches:Syntax.extractMatches({klass:"ruby-tag",allow:["keyword","ruby"]},{klass:"keyword"},{brush:"ruby"},{klass:"keyword"})});a.derives("xml")}); diff --git a/dist/jquery.syntax.brush.yaml.js b/dist/jquery.syntax.brush.yaml.js new file mode 100644 index 0000000..0b04f4e --- /dev/null +++ b/dist/jquery.syntax.brush.yaml.js @@ -0,0 +1,2 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.register("yaml",function(a){a.push({pattern:/^\s*#.*$/gm,klass:"comment",allow:["href"]});a.push(Syntax.lib.singleQuotedString);a.push(Syntax.lib.doubleQuotedString);a.push({pattern:/(&|\*)[a-z0-9]+/gi,klass:"constant"});a.push({pattern:/(.*?):/gi,matches:Syntax.extractMatches({klass:"keyword"})});a.push(Syntax.lib.webLink)}); diff --git a/dist/jquery.syntax.cache.js b/dist/jquery.syntax.cache.js new file mode 100644 index 0000000..fcbb3e9 --- /dev/null +++ b/dist/jquery.syntax.cache.js @@ -0,0 +1,7 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Syntax.alias("apache",[]);Syntax.alias("applescript",[]);Syntax.alias("assembly",["asm"]);Syntax.alias("bash-script",[]);Syntax.alias("bash",[]);Syntax.alias("basic",["vb"]);Syntax.alias("clang",["cpp","c++","c","objective-c"]);Syntax.alias("csharp",["c-sharp","c#"]);Syntax.alias("css",[]);Syntax.alias("diff",["patch"]);Syntax.alias("go",[]);Syntax.alias("haskell",[]);Syntax.alias("html",[]);Syntax.alias("io",[]);Syntax.alias("java",[]);Syntax.alias("javascript",["js","actionscript"]); +Syntax.alias("kai",[]);Syntax.alias("lisp",["scheme","clojure"]);Syntax.alias("lua",[]);Syntax.alias("nginx",[]);Syntax.alias("ocaml",["ml","sml","fsharp"]);Syntax.alias("ooc",[]);Syntax.alias("pascal",["delphi"]);Syntax.alias("perl5",[]);Syntax.alias("php-script",[]);Syntax.alias("php",[]);Syntax.alias("plain",["text"]);Syntax.alias("protobuf",[]);Syntax.alias("python",[]);Syntax.alias("ruby",[]);Syntax.alias("scala",[]);Syntax.alias("smalltalk",[]);Syntax.alias("sql",[]); +Syntax.alias("super-collider",["sc"]);Syntax.alias("swift",[]);Syntax.alias("xml",[]);Syntax.alias("xrb",["trenni"]);Syntax.alias("yaml",[]);Syntax.styles["jquery.syntax.brush.apache"]=["base/jquery.syntax.brush.apache.css"];Syntax.styles["jquery.syntax.brush.applescript"]=["base/jquery.syntax.brush.applescript.css"];Syntax.styles["jquery.syntax.brush.assembly"]=["base/jquery.syntax.brush.assembly.css"];Syntax.styles["jquery.syntax.brush.bash-script"]=["base/jquery.syntax.brush.bash-script.css"]; +Syntax.styles["jquery.syntax.brush.bash"]=["base/jquery.syntax.brush.bash.css"];Syntax.styles["jquery.syntax.brush.clang"]=["base/jquery.syntax.brush.clang.css"];Syntax.styles["jquery.syntax.brush.css"]=["base/jquery.syntax.brush.css.css"];Syntax.styles["jquery.syntax.brush.diff"]=["base/jquery.syntax.brush.diff.css"];Syntax.styles["jquery.syntax.brush.html"]=["base/jquery.syntax.brush.html.css"];Syntax.styles["jquery.syntax.brush.ocaml"]=["base/jquery.syntax.brush.ocaml.css"]; +Syntax.styles["jquery.syntax.brush.protobuf"]=["base/jquery.syntax.brush.protobuf.css"];Syntax.styles["jquery.syntax.brush.python"]=["base/jquery.syntax.brush.python.css"];Syntax.styles["jquery.syntax.brush.ruby"]=["base/jquery.syntax.brush.ruby.css"];Syntax.styles["jquery.syntax.brush.xml"]=["base/jquery.syntax.brush.xml.css"];Syntax.styles["jquery.syntax.core"]=["base/jquery.syntax.core.css","bright/jquery.syntax.core.css","paper/jquery.syntax.core.css"];Syntax.styles["jquery.syntax.editor"]=["base/jquery.syntax.editor.css"]; +Syntax.themes.base=[];Syntax.themes.bright=["base"];Syntax.themes.paper=["base"]; diff --git a/dist/jquery.syntax.core.js b/dist/jquery.syntax.core.js new file mode 100644 index 0000000..a3025ce --- /dev/null +++ b/dist/jquery.syntax.core.js @@ -0,0 +1,34 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +RegExp.prototype.indexOf||(RegExp.indexOf=function(b,a){return b[0].indexOf(b[a])+b.index});RegExp.prototype.escape||(RegExp.escape=function(b){return b.replace(/[\-\[\]{}()*+?.\\\^$|,#\s]/g,"\\$&")});String.prototype.repeat||(String.prototype.repeat=function(b){return Array(b+1).join(this)});Syntax.innerText=function(b){if(!b)return"";if("BR"==b.nodeName)return"\n";if(b.textContent)var a=b.textContent;else document.body.innerText&&(a=b.innerText);return a.replace(/\r\n?/g,"\n")}; +Syntax.extractTextFromSelection=function(b){for(var a="",c=0;c)/gm,klass:"comment"};Syntax.lib.webLink={pattern:/\w+:\/\/[\w\-.\/?%&=@:;#]*/g,klass:"href"};Syntax.lib.hexNumber={pattern:/\b0x[0-9a-fA-F]+/g,klass:"constant"};Syntax.lib.decimalNumber={pattern:/\b[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/g,klass:"constant"}; +Syntax.lib.doubleQuotedString={pattern:/"([^\\"\n]|\\.)*"/g,klass:"string"};Syntax.lib.singleQuotedString={pattern:/'([^\\'\n]|\\.)*'/g,klass:"string"};Syntax.lib.multiLineDoubleQuotedString={pattern:/"([^\\"]|\\.)*"/g,klass:"string"};Syntax.lib.multiLineSingleQuotedString={pattern:/'([^\\']|\\.)*'/g,klass:"string"};Syntax.lib.stringEscape={pattern:/\\./g,klass:"escape",only:["string"]}; +Syntax.Match=function(b,a,c,d){this.offset=b;this.endOffset=b+a;this.length=a;this.expression=c;this.value=d;this.children=[];this.next=this.parent=null};Syntax.Match.prototype.shift=function(b,a){this.adjust(b,null,a);for(var c=0;c=this.offset&&b.endOffset<=this.endOffset};Syntax.Match.defaultReduceCallback=function(b,a){"string"===typeof b&&(b=document.createTextNode(b));a.appendChild(b)}; +Syntax.Match.prototype.reduce=function(b,a){var c=this.offset;var d=this.expression&&this.expression.element?this.expression.element.cloneNode(!1):document.createElement("span");b=b||Syntax.Match.defaultReduceCallback;this.expression&&this.expression.klass&&(0this.endOffset&&console.log("Syntax Warning: Start position "+c+" exceeds end of value "+this.endOffset);a&&(d=a(d,this));return d}; +Syntax.Match.prototype.canContain=function(b){return b.expression.force?!0:this.complete?!1:b.expression.only?!0:"undefined"===typeof this.expression.allow||jQuery.isArray(this.expression.disallow)&&-1!==jQuery.inArray(b.expression.klass,this.expression.disallow)?!1:"*"===this.expression.allow||jQuery.isArray(this.expression.allow)&&-1!==jQuery.inArray(b.expression.klass,this.expression.allow)?!0:!1}; +Syntax.Match.prototype.canHaveChild=function(b){if(b=b.expression.only){for(var a=this;null!==a;){if(-1!==jQuery.inArray(a.expression.klass,b))return!0;if((a=a.parent)&&a.complete)break}return!1}return!0};Syntax.Match.prototype._splice=function(b,a){return this.canHaveChild(a)?(this.children.splice(b,0,a),a.parent=this,a.expression.owner||(a.expression.owner=this.expression.owner),this):null}; +Syntax.Match.prototype.insert=function(b,a){if(!this.contains(b))return null;if(a){a=this;for(var c=0;c<=c.endOffset?c.insertAtEnd(b):b.force?this._insert(b):null:this._splice(a+1,b)}return this._splice(0,b)}; +Syntax.Match.prototype._insert=function(b){if(0==this.children.length)return this._splice(0,b);for(var a=0;a=c.endOffset)){if(c.contains(b))return c._insert(b);b=b.bisectAtOffsets([c.offset,c.endOffset]);b[0]&&this._splice(a,b[0]);b[1]&&c.insert(b[1]);if(b[2])b=b[2];else return this}}this._splice(this.children.length,b)}; +Syntax.Match.prototype.bisectAtOffsets=function(b){var a=[],c=this.offset,d=null,e=jQuery.merge([],this.children);b=b.slice(0);b.push(this.endOffset);b.sort(function(a,b){return a-b});for(var f=0;fthis.endOffset)break;g").attr("href",this.innerHTML).text(this.innerHTML))});e(f,a,b,d)})}; +Syntax.extractBrushName=function(b){b=b.toLowerCase();var a=b.match(/(brush|language)-([\S]+)/);if(a)return a[2];b=b.split(/ /);if(-1!==jQuery.inArray("syntax",b))for(a=0;aa.start&&d>a.start;)if(this.current.lines[c-1]==b.lines[d-1])--c,--d;else break;a.end=d;a.originalEnd=c;for(a.difference=b.lines.length-this.current.lines.length;0< +b.lines.length-1&&b.offsets[a.end-1]!=b.offsets[a.end];)a.end+=1,a.originalEnd+=1;this.current=b;return this.changed=a};Syntax.Editor.prototype.textForLines=function(a,b){return this.current.lines.slice(a,b).join("\n")+"\n"}; +Syntax.Editor.prototype.updateLines=function(a,b){if(a.start!=a.end){var c=a.start;a=a.end;c+=this.current.offsets[c];a+=this.current.offsets[a];c=Array.prototype.slice.call(this.container.childNodes,c,a);$(c).replaceWith(b)}else 0==a.start?$(this.container).prepend(b):(c=a.start,c+=this.current.offsets[c],$(this.container.childNodes[c]).after(b))}; +Syntax.Editor.getCharacterOffset=function(a){var b=0;if("undefined"!=typeof window.getSelection){b=window.getSelection().getRangeAt(0);var c=b.cloneRange();c.selectNodeContents(a);c.setEnd(b.endContainer,b.endOffset);b=c.toString().length}else"undefined"!=typeof document.selection&&"Control"!=document.selection.type&&(b=document.selection.createRange(),c=document.body.createTextRange(),c.moveToElementText(a),c.setEndPoint("EndToEnd",b),b=c.text.length);return b}; +Syntax.Editor.getNodesForCharacterOffsets=function(a,b){b=document.createTreeWalker(b,NodeFilter.SHOW_TEXT,function(a){return NodeFilter.FILTER_ACCEPT},!1);for(var c=[],d=0,f=0;f');c.append(b.children());var d=new Syntax.Editor(c.get(0)),f=function(b){var c=d.getClientState(),e=d.updateChangedLines();0>e.difference&&0
').append(c)}; diff --git a/dist/jquery.syntax.js b/dist/jquery.syntax.js new file mode 100644 index 0000000..03cc180 --- /dev/null +++ b/dist/jquery.syntax.js @@ -0,0 +1,8 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +Function.prototype.bind||(Function.prototype.bind=function(a){var b=Array.prototype.slice.call(arguments,1),c=this;return function(){return c.apply(a,b)}});function ResourceLoader(a){this.dependencies={};this.loading={};this.loader=a}ResourceLoader.prototype._finish=function(a){var b=this.dependencies[a];if(b){a=this._loaded.bind(this,a);for(var c=0;c");jQuery("head").append(b);Syntax.cacheStyleSheets||(a=a+"?"+Math.random());b.attr({rel:"stylesheet", +type:"text/css",href:a})},getScript:function(a,b){var c=document.createElement("script");c.onload=b;c.type="text/javascript";Syntax.cacheScripts||(a=a+"?"+Math.random());c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},getResource:function(a,b,c){Syntax.detectRoot();a=a+"."+b;if(b=this.styles[a])for(var d=0;d");jQuery("head").append(b);Syntax.cacheStyleSheets||(a=a+"?"+Math.random());b.attr({rel:"stylesheet", +type:"text/css",href:a})},getScript:function(a,b){var c=document.createElement("script");c.onload=b;c.type="text/javascript";Syntax.cacheScripts||(a=a+"?"+Math.random());c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},getResource:function(a,b,c){Syntax.detectRoot();a=a+"."+b;if(b=this.styles[a])for(var d=0;d span:nth-child(odd) { + background-color: rgba(0, 0, 0, 0.05); } diff --git a/dist/paper/theme.js b/dist/paper/theme.js new file mode 100644 index 0000000..ea7e7ce --- /dev/null +++ b/dist/paper/theme.js @@ -0,0 +1 @@ +Syntax.themes["paper"] = ["base"] diff --git a/examples/ex.applescript.html b/examples/ex.applescript.html index 5e6e1ef..94a93f5 100644 --- a/examples/ex.applescript.html +++ b/examples/ex.applescript.html @@ -4,12 +4,12 @@ - - + + @@ -19,9 +19,7 @@

Syntax: AppleScript

Hello World & Mode-line Support

-

The following example does not have a class specifying the brush to use. This is extracted from the mode-line. This line also specifies other options, in this case the tab-width.

- -
(* -*- mode: applescript; tab-width: 4; -*-
+		
(*
 Copyright (C) 2009 Orion Transfer Ltd. All Rights Reserved. See http://www.oriontransfer.co.nz/ for more information.
 Drop files on top of this application to produce a zip archive on the desktop containing compressed JPEGs at a maximum size of 800px.
 *)
@@ -117,6 +115,6 @@ 

Hello World & Mode-line Support

end if end tell end resize_and_save -
+
\ No newline at end of file diff --git a/examples/ex.asm.html b/examples/ex.asm.html index 6fd4ab4..8470d7e 100644 --- a/examples/ex.asm.html +++ b/examples/ex.asm.html @@ -4,12 +4,12 @@ - - + + @@ -17,31 +17,27 @@

Syntax: Assembler

-

Hello World & Mode-line Support

- -

The following example does not have a class specifying the brush to use. This is extracted from the mode-line. This line also specifies other options, in this case the tab-width.

- -
# -*- mode: asm; tab-width: 4; -*-
+		

 .text
 	.global _start
 
 _start:
 	# ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count)
-	movl	$len,	%edx		# size_t count
-	movl	$msg,	%ecx		# const char __user * buf
-	movl	$1,		%ebx		# unsigned int fd
-	movl	$4,		%eax		# system call number (sys_write)
-	int		$0x80				# call kernel
+	movl  $len, %edx    # size_t count
+	movl  $msg, %ecx    # const char __user * buf
+	movl  $1,   %ebx    # unsigned int fd
+	movl  $4,   %eax    # system call number (sys_write)
+	int   $0x80         # call kernel
 
 	# void _exit(int status);
-	movl	$0,		%ebx		# int status
-	movl	$1,		%eax		# system call number (sys_exit)
-	int		$0x80				# call kernel
+	movl  $0,   %ebx    # int status
+	movl  $1,   %eax    # system call number (sys_exit)
+	int   $0x80         # call kernel
 
-.data							# section declaration
+.data
 
 msg:
-	.ascii	"Hello, world!\n"
-	len = . - msg
+ .ascii "Hello, world!\n" + len = . - msg
\ No newline at end of file diff --git a/examples/ex.bash.html b/examples/ex.bash.html index 3b8d189..5ce6ffd 100644 --- a/examples/ex.bash.html +++ b/examples/ex.bash.html @@ -4,12 +4,12 @@ - - + + @@ -19,7 +19,7 @@

Syntax: Bash

Bash is context-sensitive - a script could mean different things depending on what is defined in the environment. Thus, to present Bash code clearly, you will need to use inline markup, such as the last example on this page.

-
#!/bin/bash
+		
#!/bin/bash
 # Counting to 11 in 10 different ways.
 
 n=1; echo -n "$n "
@@ -70,11 +70,11 @@ 

Syntax: Bash

echo -exit 0
+exit 0

-

#!/bin/bash
+
#!/bin/bash
 
 svc_cluster_ip=10.0.0.10
 svc_priv_dsa=~/.ssh/id_dsa
@@ -116,16 +116,16 @@ 

Syntax: Bash

done | grep $WWPN #set +x -
+

This next example uses inline HTML to markup and highlight rd-resolve-test bob.

-
samuel@ayako:~$ which git
+
samuel@ayako:~$ which git
 /usr/bin/git
 samuel@ayako:~$ ls -lah
 getconf     getent      getopt      getopts     gettext     gettext.sh  gettextize  
 samuel@ayako:~# sudo rd-resolve-test bob
-/home/samuel
+/home/samuel

Here is the HTML of the above <pre>:

diff --git a/examples/ex.clang.html b/examples/ex.clang.html index 0b8e83f..d4ebb41 100644 --- a/examples/ex.clang.html +++ b/examples/ex.clang.html @@ -4,12 +4,12 @@ - - + + @@ -19,13 +19,13 @@

Syntax: C, C++, Objective-C

C++

-
#include <iostream>
+		
#include <iostream>
 
 // If we increase row by 1, the offset will increase by sz (number of elements per row i.e. number of columns)
 // If we increase col by 1, the offset will increase by 1
 unsigned rowMajorOffset(unsigned row, unsigned col, unsigned sz)
 {
-    return col + row * sz;
+	return col + row * sz;
 }
 
 // If we increase col by 1, the offset will increase by sz (number of elements per column i.e. number of rows)
@@ -142,11 +142,11 @@ 

C++

transposedMatrix.debug(); return 0; -}
+}

Objective-C Header

-
//
+	
//
 //  GHInventoryEditor.h
 //  Goblin Hacker
 //
@@ -217,11 +217,11 @@ 

Objective-C Header

- (IBAction)avatarJewelry: (id)sender; -@end
+@end

Objective-C Implementation

-
//
+	
//
 //  GPointSet.m
 //  Gocoa
 //
@@ -307,17 +307,17 @@ 

Objective-C Implementation

return result; } -@end
+@end

Strings with embedded escapes

-
+	

 const char * text = "The elephant\n was in the room.";
-	
+

Types and Functions

-
+	

 int   pthread_setcancelstate(int, int *);
 int   pthread_setcanceltype(int, int *);
 int   pthread_setconcurrency(int);
@@ -331,7 +331,7 @@ 

Types and Functions

} } -
+
\ No newline at end of file diff --git a/examples/ex.css.html b/examples/ex.css.html index 3edda72..da50837 100644 --- a/examples/ex.css.html +++ b/examples/ex.css.html @@ -4,12 +4,12 @@ - - + + @@ -21,7 +21,7 @@

Special Example

This example extracts definitions and creates example elements on the right hand side.

-
+		

 p {
 	background-color: #ccc;
 	border: 1px solid black;
@@ -43,6 +43,6 @@ 

Special Example

border-color:#ff0000 #0000ff; } -
+
\ No newline at end of file diff --git a/examples/ex.diff.html b/examples/ex.diff.html index efb6cfa..285e682 100644 --- a/examples/ex.diff.html +++ b/examples/ex.diff.html @@ -4,12 +4,12 @@ - - + + @@ -19,7 +19,7 @@

Syntax: Diff

jQuery.Syntax Diff

-
+		

 diff --git a/ex.ruby.html b/ex.ruby.html
 index a02a04e..7d42db0 100644
 --- a/ex.ruby.html
@@ -1220,7 +1220,7 @@ 

jQuery.Syntax Diff

+ +Syntax.layouts.table = Syntax.layouts.tableDOM \ No newline at end of file -
+
\ No newline at end of file diff --git a/examples/ex.editor.html b/examples/ex.editor.html index 0527f89..c1c199f 100644 --- a/examples/ex.editor.html +++ b/examples/ex.editor.html @@ -4,8 +4,8 @@ - - + + - - + + - - - + + + + + +

sally

+
			foo = bar foo = bar foo = bar foo = bar foo = bar foo = bar foo = bar foo = bar foo = bar foo = bar foo = bar
+			apples = 10
+
+

bob

+ + \ No newline at end of file diff --git a/examples/wrapping.html b/examples/wrapping.html new file mode 100644 index 0000000..fdfac03 --- /dev/null +++ b/examples/wrapping.html @@ -0,0 +1,181 @@ + + + + + + + + +

sally

+
#include <iostream>
+
+// If we increase row by 1, the offset will increase by sz (number of elements per row i.e. number of columns)
+// If we increase col by 1, the offset will increase by 1
+unsigned rowMajorOffset(unsigned row, unsigned col, unsigned sz)
+{
+    return col + row * sz;
+}
+
+// If we increase col by 1, the offset will increase by sz (number of elements per column i.e. number of rows)
+// If we increase row by 1, the offset will increase by 1
+unsigned columnMajorOffset(unsigned row, unsigned col, unsigned sz)
+{
+    return row + col * sz;
+}
+
+template <typename _ValueT, unsigned _R, unsigned _C, bool _ColumnMajor>
+class Matrix {
+protected:
+	enum { ColumnMajor = _ColumnMajor };
+	enum { R = _R };
+	enum { C = _C };
+
+	typedef _ValueT ValueT;
+
+	ValueT m_values[C*R];
+
+public:
+	const ValueT & at (unsigned r, unsigned c) const
+	{
+		if (ColumnMajor)
+			return m_values[columnMajorOffset(r, c, R)];
+		else
+			return m_values[rowMajorOffset(r, c, C)];
+	}
+
+	ValueT & at (unsigned r, unsigned c)
+	{
+		if (ColumnMajor)
+			return m_values[columnMajorOffset(r, c, R)];
+		else
+			return m_values[rowMajorOffset(r, c, C)];
+	}
+
+	void loadTestPattern ()
+	{
+		for (unsigned r = 0; r < R; r += 1)
+			for (unsigned c = 0; c < C; c += 1)
+				at(r, c) = (r+1) * 1000 + (c+1);
+	}
+
+	void debug ()
+	{
+		using namespace std;
+
+		if (ColumnMajor)
+			cout << "Column-Major Matrix " << "(" << R << "," << C << ")" << " @ " << this << endl;
+		else
+			cout << "Row-Major Matrix " << "(" << R << "," << C << ")" << " @ " << this << endl;
+
+		cout << "Memory Offset: ";
+		for (unsigned i = 0; i < (R*C); i += 1)
+			cout << i << "    ";
+		cout << endl;
+
+		cout << "       Values: ";	
+		for (unsigned i = 0; i < (R*C); i += 1)
+			cout << m_values[i] << " ";
+		cout << endl;
+
+		cout << "Standard Mathematical Notation:" << endl;
+		cout << "      ";
+		for (unsigned c = 0; c < C; c += 1)
+			cout << "Col " << c << " ";
+		cout << endl;
+
+		for (unsigned r = 0; r < R; r += 1) {
+			cout << "Row " << r << " ";
+			for (unsigned c = 0; c < C; c += 1)
+				cout << at(r, c) << "  ";
+			cout << endl;
+		}
+		cout << endl;
+	}
+
+	Matrix<ValueT, R, C, !ColumnMajor> transposeStorage () const
+	{
+		Matrix<ValueT, R, C, !ColumnMajor> result;
+
+		for (unsigned r = 0; r < R; r += 1)
+			for (unsigned c = 0; c < C; c += 1)
+				result.at(r, c) = at(r, c);
+
+		return result;
+	}
+
+	Matrix<ValueT, C, R, !ColumnMajor> transposeMatrix () const
+	{
+		Matrix<ValueT, C, R, !ColumnMajor> result;
+
+		memcpy(&result.at(0,0), m_values, sizeof(m_values));
+
+		return result;
+	}
+};
+
+int main (int argc, char * const argv[]) {
+	Matrix<float, 4, 2, false> rowMajorMatrix;
+	Matrix<float, 4, 2, true> columnMajorMatrix;
+
+	rowMajorMatrix.loadTestPattern();
+	rowMajorMatrix.debug();
+
+	columnMajorMatrix.loadTestPattern();
+	columnMajorMatrix.debug();
+
+	rowMajorMatrix = columnMajorMatrix.transposeStorage();
+	rowMajorMatrix.debug();
+
+	Matrix<float, 2, 4, false> transposedMatrix = columnMajorMatrix.transposeMatrix();
+	transposedMatrix.debug();
+
+	return 0;
+}
+

bob

+ + \ No newline at end of file diff --git a/ext/jsmin.rb b/ext/jsmin.rb deleted file mode 100755 index f0c74a5..0000000 --- a/ext/jsmin.rb +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/ruby -# jsmin.rb 2007-07-20 -# Author: Uladzislau Latynski -# This work is a translation from C to Ruby of jsmin.c published by -# Douglas Crockford. Permission is hereby granted to use the Ruby -# version under the same conditions as the jsmin.c on which it is -# based. -# -# /* jsmin.c -# 2003-04-21 -# -# Copyright (c) 2002 Douglas Crockford (www.crockford.com) -# -# 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 shall be included in all -# copies or substantial portions of the Software. -# -# The Software shall be used for Good, not Evil. -# -# 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. - -EOF = -1 -$theA = "" -$theB = "" - -# isAlphanum -- return true if the character is a letter, digit, underscore, -# dollar sign, or non-ASCII character -def isAlphanum(c) - return false if !c || c == EOF - return ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z') || c == '_' || c == '$' || - c == '\\' || c[0] > 126) -end - -# get -- return the next character from stdin. Watch out for lookahead. If -# the character is a control character, translate it to a space or linefeed. -def get() - c = $stdin.getc - return EOF if(!c) - c = c.chr - return c if (c >= " " || c == "\n" || c.unpack("c") == EOF) - return "\n" if (c == "\r") - return " " -end - -# Get the next character without getting it. -def peek() - lookaheadChar = $stdin.getc - $stdin.ungetc(lookaheadChar) - return lookaheadChar.chr -end - -# mynext -- get the next character, excluding comments. -# peek() is used to see if a '/' is followed by a '/' or '*'. -def mynext() - c = get - if (c == "/") - if(peek == "/") - while(true) - c = get - if (c <= "\n") - return c - end - end - end - if(peek == "*") - get - while(true) - case get - when "*" - if (peek == "/") - get - return " " - end - when EOF - raise "Unterminated comment" - end - end - end - end - return c -end - - -# action -- do something! What you do is determined by the argument: 1 -# Output A. Copy B to A. Get the next B. 2 Copy B to A. Get the next B. -# (Delete A). 3 Get the next B. (Delete B). action treats a string as a -# single character. Wow! action recognizes a regular expression if it is -# preceded by ( or , or =. -def action(a) - if(a==1) - $stdout.write $theA - end - if(a==1 || a==2) - $theA = $theB - if ($theA == "\'" || $theA == "\"") - while (true) - $stdout.write $theA - $theA = get - break if ($theA == $theB) - raise "Unterminated string literal" if ($theA <= "\n") - if ($theA == "\\") - $stdout.write $theA - $theA = get - end - end - end - end - if(a==1 || a==2 || a==3) - $theB = mynext - if ($theB == "/" && ($theA == "(" || $theA == "," || $theA == "=" || - $theA == ":" || $theA == "[" || $theA == "!" || - $theA == "&" || $theA == "|" || $theA == "?" || - $theA == "{" || $theA == "}" || $theA == ";" || - $theA == "\n")) - $stdout.write $theA - $stdout.write $theB - while (true) - $theA = get - if ($theA == "/") - break - elsif ($theA == "\\") - $stdout.write $theA - $theA = get - elsif ($theA <= "\n") - raise "Unterminated RegExp Literal" - end - $stdout.write $theA - end - $theB = mynext - end - end -end - -# jsmin -- Copy the input to the output, deleting the characters which are -# insignificant to JavaScript. Comments will be removed. Tabs will be -# replaced with spaces. Carriage returns will be replaced with linefeeds. -# Most spaces and linefeeds will be removed. -def jsmin - $theA = "\n" - action(3) - while ($theA != EOF) - case $theA - when " " - if (isAlphanum($theB)) - action(1) - else - action(2) - end - when "\n" - case ($theB) - when "{","[","(","+","-" - action(1) - when " " - action(3) - else - if (isAlphanum($theB)) - action(1) - else - action(2) - end - end - else - case ($theB) - when " " - if (isAlphanum($theA)) - action(1) - else - action(3) - end - when "\n" - case ($theA) - when "}","]",")","+","-","\"","\\", "'", '"' - action(1) - else - if (isAlphanum($theA)) - action(1) - else - action(3) - end - end - else - action(1) - end - end - end -end - -ARGV.each do |anArg| - $stdout.write "// #{anArg}\n" -end - -jsmin diff --git a/ext/theme.rb b/ext/theme.rb index c92a48e..cd57d78 100644 --- a/ext/theme.rb +++ b/ext/theme.rb @@ -32,7 +32,7 @@ def load_theme(theme_dir, top = true) # Is there a configuration file? if File.exist? theme_config_path - config = YAML::load_file(theme_config_path) + config = YAML::load_file(theme_config_path) || {} end # Load any dependencies recursively - if you have bad configuration this might diff --git a/gems.rb b/gems.rb new file mode 100644 index 0000000..2a6a049 --- /dev/null +++ b/gems.rb @@ -0,0 +1,10 @@ +# A sample Gemfile +source "https://rubygems.org" + +gem "bake" +gem "sass" + +gem "closure-compiler" + +gem "rack" +gem "falcon" diff --git a/install.yaml b/install.yaml index 6006943..ab1cfc8 100644 --- a/install.yaml +++ b/install.yaml @@ -1,9 +1,9 @@ -# The path to install the code -prefix: "public" +# The path to install the code - this directory should NOT contain any other files as they will be erased during the install process. +prefix: "dist" # The options for the stylesheet generation themes: - base - - modern - bright + - paper # Enable minification minify: true diff --git a/package.json b/package.json index a5985ee..bc60d4e 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,27 @@ { - name: "syntax", - version: "3.1", - title: "jQuery.Syntax", - author: { - name: "Samuel Williams", - email: "samuel@oriontransfer.org", - url: "http://www.oriontransfer.co.nz/samuel-williams" - }, - licenses: [ - {type: "MIT", url: "http://www.oriontransfer.co.nz/projects/jquery-syntax/license.en"} - ], - dependencies: { - "jquery": ">=1.4.1" - }, - description: "jQuery.Syntax is an extremely fast and lightweight syntax highlighter written in JavaScript. It has dynamic loading of syntax source files and integrates cleanly using CSS or modelines.", - keywords: ["syntax", "highlighting", "highlighter", "source", "code", "formatting"], - homepage: "http://www.oriontransfer.co.nz/projects/jquery-syntax" + "name": "jquery-syntax", + "version": "4.4.0", + "title": "jQuery.Syntax", + "author": { + "name": "Samuel Williams", + "email": "samuel@codeotaku.com", + "url": "https://www.codeotaku.com" + }, + "license": "MIT", + "repository": "https://github.com/ioquatix/jquery-syntax", + "dependencies": { + "jquery": ">=1.4.1" + }, + "description": "jQuery.Syntax is an extremely fast and lightweight syntax highlighter written in JavaScript. It has dynamic loading of syntax source files and integrates cleanly using CSS or modelines.", + "keywords": [ + "syntax", + "highlighting", + "highlighter", + "source", + "code", + "formatting", + "jquery-plugin", + "ecosystem:jquery" + ], + "homepage": "https://github.com/ioquatix/jquery-syntax" } diff --git a/public/base/jquery.syntax.brush.apache.css b/public/base/jquery.syntax.brush.apache.css deleted file mode 100644 index 5d808be..0000000 --- a/public/base/jquery.syntax.brush.apache.css +++ /dev/null @@ -1,6 +0,0 @@ -.syntax-theme-base .syntax .apache .tag { - color: #0000cc; } -.syntax-theme-base .syntax .apache .tag-name { - color: blue; } -.syntax-theme-base .syntax .apache .tag-name { - font-weight: bold; } diff --git a/public/base/jquery.syntax.brush.applescript.css b/public/base/jquery.syntax.brush.applescript.css deleted file mode 100644 index 87da0b5..0000000 --- a/public/base/jquery.syntax.brush.applescript.css +++ /dev/null @@ -1,5 +0,0 @@ -.syntax-theme-base .syntax .applescript { - font-family: Geneva, Helvetica, sans-serif; } - .syntax-theme-base .syntax .applescript .keyword { - color: blue; - font-weight: bold; } diff --git a/public/base/jquery.syntax.brush.assembly.css b/public/base/jquery.syntax.brush.assembly.css deleted file mode 100644 index 5d5e027..0000000 --- a/public/base/jquery.syntax.brush.assembly.css +++ /dev/null @@ -1,8 +0,0 @@ -.syntax-theme-base .syntax .assembly .register { - color: #3caa20; - font-style: italic; } -.syntax-theme-base .syntax .assembly .label { - font-weight: bold; - color: #2a85b3; } -.syntax-theme-base .syntax .assembly .directive { - color: #828a3d; } diff --git a/public/base/jquery.syntax.brush.bash-script.css b/public/base/jquery.syntax.brush.bash-script.css deleted file mode 100644 index 2367963..0000000 --- a/public/base/jquery.syntax.brush.bash-script.css +++ /dev/null @@ -1,6 +0,0 @@ -.syntax-theme-base .syntax .bash-script .function { - font-weight: bold; } -.syntax-theme-base .syntax .bash-script .option { - color: #0033ff; } -.syntax-theme-base .syntax .bash-script .env { - font-style: italic; } diff --git a/public/base/jquery.syntax.brush.bash.css b/public/base/jquery.syntax.brush.bash.css deleted file mode 100644 index d1a9069..0000000 --- a/public/base/jquery.syntax.brush.bash.css +++ /dev/null @@ -1,11 +0,0 @@ -.syntax-theme-base .syntax .bash { - color: #555555; - font-style: italic; } - .syntax-theme-base .syntax .bash .prompt { - color: #00cc00; - font-weight: bold; } - .syntax-theme-base .syntax .bash .bash-script { - font-style: normal; - color: black; } - .syntax-theme-base .syntax .bash .stderr { - color: red; } diff --git a/public/base/jquery.syntax.brush.clang.css b/public/base/jquery.syntax.brush.clang.css deleted file mode 100644 index 34bddbb..0000000 --- a/public/base/jquery.syntax.brush.clang.css +++ /dev/null @@ -1,3 +0,0 @@ -.syntax-theme-base .syntax .preprocessor { - color: #63381f; - font-style: italic; } diff --git a/public/base/jquery.syntax.brush.css.css b/public/base/jquery.syntax.brush.css.css deleted file mode 100644 index dc632c2..0000000 --- a/public/base/jquery.syntax.brush.css.css +++ /dev/null @@ -1,14 +0,0 @@ -.syntax-theme-base .syntax .css .selector { - color: #445588; - font-weight: bold; } -.syntax-theme-base .syntax .css .property { - color: teal; } -.syntax-theme-base .syntax .css .color-box { - position: relative; } - .syntax-theme-base .syntax .css .color-box .sample { - border: 1px solid black; - position: absolute; - left: 0.2em; - right: 0.2em; - top: 0.2em; - bottom: 0.2em; } diff --git a/public/base/jquery.syntax.brush.diff.css b/public/base/jquery.syntax.brush.diff.css deleted file mode 100644 index 1514835..0000000 --- a/public/base/jquery.syntax.brush.diff.css +++ /dev/null @@ -1,16 +0,0 @@ -.syntax-theme-base .syntax .add { - color: green; } -.syntax-theme-base .syntax .del { - color: red; } -.syntax-theme-base .syntax .insert { - color: green; } -.syntax-theme-base .syntax .insert-line { - background-color: #ccffcc !important; } -.syntax-theme-base .syntax .remove { - color: red; } -.syntax-theme-base .syntax .remove-line { - background-color: #ffcccc !important; } -.syntax-theme-base .syntax .offset { - color: blue; } -.syntax-theme-base .syntax .offset-line { - background-color: #ccccff !important; } diff --git a/public/base/jquery.syntax.brush.html.css b/public/base/jquery.syntax.brush.html.css deleted file mode 100644 index a6cfc02..0000000 --- a/public/base/jquery.syntax.brush.html.css +++ /dev/null @@ -1,5 +0,0 @@ -.syntax-theme-base .syntax .html .doctype { - font-weight: bold; - color: #993388; } -.syntax-theme-base .syntax .html .javascript, .syntax-theme-base .syntax .html .css { - font-style: italic; } diff --git a/public/base/jquery.syntax.brush.python.css b/public/base/jquery.syntax.brush.python.css deleted file mode 100644 index 11b50ed..0000000 --- a/public/base/jquery.syntax.brush.python.css +++ /dev/null @@ -1,6 +0,0 @@ -.syntax-theme-base .syntax .python .decorator { - color: #ffb600; - font-weight: bold; } -.syntax-theme-base .syntax .python .builtin { - color: #3333ff; - font-style: italic; } diff --git a/public/base/jquery.syntax.brush.ruby.css b/public/base/jquery.syntax.brush.ruby.css deleted file mode 100644 index 442fb3c..0000000 --- a/public/base/jquery.syntax.brush.ruby.css +++ /dev/null @@ -1,2 +0,0 @@ -.syntax-theme-base .syntax .ruby .string .ruby { - color: black; } diff --git a/public/base/jquery.syntax.brush.xml.css b/public/base/jquery.syntax.brush.xml.css deleted file mode 100644 index 5ff8c09..0000000 --- a/public/base/jquery.syntax.brush.xml.css +++ /dev/null @@ -1,18 +0,0 @@ -.syntax-theme-base .syntax .xml .cdata-content { - color: #004466; - border-radius: 0.5em; } -.syntax-theme-base .syntax .xml .xml-tag, .syntax-theme-base .syntax .xml .cdata { - color: #0000cc; } -.syntax-theme-base .syntax .xml .tag-name, .syntax-theme-base .syntax .xml .cdata-tag { - color: blue; - font-weight: bold; } -.syntax-theme-base .syntax .xml .namespace { - color: #0000cc; } -.syntax-theme-base .syntax .xml .attribute { - color: #0000cc; } -.syntax-theme-base .syntax .xml .instruction { - color: #0000cc; } -.syntax-theme-base .syntax .xml .entity, .syntax-theme-base .syntax .xml .percent-escape { - color: #666666; - background-color: #dddddd; - border-radius: 0.5em; } diff --git a/public/base/jquery.syntax.core.css b/public/base/jquery.syntax.core.css deleted file mode 100644 index 146d8bc..0000000 --- a/public/base/jquery.syntax.core.css +++ /dev/null @@ -1,44 +0,0 @@ -.syntax-theme-base .syntax { - font-family: Menlo, Monaco, Consolas, monospace; - line-height: 1.5em; } - .syntax-theme-base .syntax .function { - color: #3333ff; } - .syntax-theme-base .syntax .keyword, .syntax-theme-base .syntax .access { - color: #7a0968; } - .syntax-theme-base .syntax .type { - color: #3239d6; } - .syntax-theme-base .syntax .comment { - color: #66aacc; } - .syntax-theme-base .syntax .constant { - color: #1c00ce; } - .syntax-theme-base .syntax .string, .syntax-theme-base .syntax .symbol { - color: #c41a15; } - .syntax-theme-base .syntax .string .escape { - color: #ff9999; } - .syntax-theme-base .syntax .operator { - color: black; } - .syntax-theme-base .syntax .href { - color: #0e0eff; - text-decoration: underline; } - .syntax-theme-base .syntax .variable { - color: #466997; } - .syntax-theme-base .syntax .highlight { - background-color: #fdfdba; } - .syntax-theme-base .syntax pre { - overflow: auto; - font-family: inherit; } - -.syntax-container.syntax-theme-base { - position: relative; } - .syntax-container.syntax-theme-base .toolbar { - font-size: 80%; - text-align: right; - padding: 0 0.2em 0.2em; } - .syntax-container.syntax-theme-base .toolbar a { - margin-left: 1em; } - .syntax-container.syntax-theme-base pre.raw { - overflow: auto; - padding: 0 0.4em 0 !important; - margin: 0 !important; - background-color: #f0f0f0; - border: 1px solid #aaaaaa; } diff --git a/public/base/jquery.syntax.layout.fixed.css b/public/base/jquery.syntax.layout.fixed.css deleted file mode 100644 index d4f2344..0000000 --- a/public/base/jquery.syntax.layout.fixed.css +++ /dev/null @@ -1,28 +0,0 @@ -.syntax-container.syntax-theme-base div.fixed.syntax { - background-color: #e3e3e3; - border: 1px solid #aaaaaa; - padding: 0 !important; - margin: 0 !important; } - .syntax-container.syntax-theme-base div.fixed.syntax .numbers-column { - float: left; - text-align: right; - margin-right: 0em; - width: 3em; - color: #979797; - background-color: #e3e3e3; } - .syntax-container.syntax-theme-base div.fixed.syntax .numbers-column div { - padding: 0 0.4em 0 !important; } - .syntax-container.syntax-theme-base div.fixed.syntax .code-column { - border-left: 1px solid #aaaaaa; - overflow: auto; - background-color: #f0f0f0; } - .syntax-container.syntax-theme-base div.fixed.syntax .code-column table { - border-collapse: collapse; - width: 100%; - white-space: pre; } - .syntax-container.syntax-theme-base div.fixed.syntax .code-column .source { - margin: auto !important; - color: #333333; - padding: 0 0.4em 0 !important; } - .syntax-container.syntax-theme-base div.fixed.syntax .code-column .source.alt { - background-color: #f5f5f5; } diff --git a/public/base/jquery.syntax.layout.inline.css b/public/base/jquery.syntax.layout.inline.css deleted file mode 100644 index e69de29..0000000 diff --git a/public/base/jquery.syntax.layout.list.css b/public/base/jquery.syntax.layout.list.css deleted file mode 100644 index b964a47..0000000 --- a/public/base/jquery.syntax.layout.list.css +++ /dev/null @@ -1,51 +0,0 @@ -.syntax-container.syntax-theme-base ol.syntax { - background-color: #e3e3e3; - border: 1px solid #aaaaaa; - padding: 0 0 0 5em !important; - margin: 0 !important; } - .syntax-container.syntax-theme-base ol.syntax li { - padding: 0 !important; - margin: 0 !important; - color: #979797; - /* CSS2.1 */ - white-space: pre-wrap; - /* Mozilla, since 1999 */ - white-space: -moz-pre-wrap; - /* Opera 7 */ - white-space: -o-pre-wrap; - /* Internet Explorer 5.5+ */ - word-wrap: break-word; - _white-space: pre; } - .syntax-container.syntax-theme-base ol.syntax li div.source { - color: #333333; - margin-left: -0.5em; - border-left: 1px solid #aaaaaa; - background-color: #f0f0f0; - padding: 0 0.4em 0 !important; } - .syntax-container.syntax-theme-base ol.syntax li.alt div.source { - background-color: #f5f5f5; } -.syntax-container.syntax-theme-base ul.syntax { - background-color: #e3e3e3; - border: 1px solid #aaaaaa; - padding: 0 !important; - margin: 0 !important; - list-style-type: none; } - .syntax-container.syntax-theme-base ul.syntax li { - padding: 0 !important; - margin: 0 !important; - /* CSS2.1 */ - white-space: pre-wrap; - /* Mozilla, since 1999 */ - white-space: -moz-pre-wrap; - /* Opera 7 */ - white-space: -o-pre-wrap; - /* Internet Explorer 5.5+ */ - word-wrap: break-word; - _white-space: pre; } - .syntax-container.syntax-theme-base ul.syntax li div.source { - margin: 0 !important; - color: #333333; - background-color: #f0f0f0; - padding: 0 0.4em 0 !important; } - .syntax-container.syntax-theme-base ul.syntax li.alt div.source { - background-color: #f5f5f5; } diff --git a/public/base/jquery.syntax.layout.plain.css b/public/base/jquery.syntax.layout.plain.css deleted file mode 100644 index 8e6312f..0000000 --- a/public/base/jquery.syntax.layout.plain.css +++ /dev/null @@ -1,8 +0,0 @@ -.syntax-container.syntax-theme-base .syntax.plain { - background-color: #f0f0f0; - padding: 0.6em; - border: 1px solid #aaaaaa; } - .syntax-container.syntax-theme-base .syntax.plain pre { - margin: 0; - font-family: inherit; - overflow: auto; } diff --git a/public/base/jquery.syntax.layout.table.css b/public/base/jquery.syntax.layout.table.css deleted file mode 100644 index 8141c38..0000000 --- a/public/base/jquery.syntax.layout.table.css +++ /dev/null @@ -1,31 +0,0 @@ -.syntax-container.syntax-theme-base table.syntax { - border-collapse: collapse; - background-color: #f0f0f0; - border: 1px solid #aaaaaa; - padding: 0 !important; - margin: 0 !important; - width: 100%; } - .syntax-container.syntax-theme-base table.syntax tr.alt td.source { - background-color: #f5f5f5; } - .syntax-container.syntax-theme-base table.syntax td.source { - padding: 0 0.4em 0; - color: #333333; - /* CSS2.1 */ - white-space: pre-wrap; - /* Mozilla, since 1999 */ - white-space: -moz-pre-wrap; - /* Opera 7 */ - white-space: -o-pre-wrap; - /* Internet Explorer 5.5+ */ - word-wrap: break-word; - _white-space: pre; } - .syntax-container.syntax-theme-base table.syntax td.number { - padding: 0 0.4em 0; - user-select: none; - -moz-user-select: none; - -webkit-user-select: none; - border-right: 1px solid #aaaaaa; - text-align: right; - width: 2.5em; - color: #979797; - background-color: #e3e3e3; } diff --git a/public/jquery.syntax.brush.apache.js b/public/jquery.syntax.brush.apache.js deleted file mode 100644 index c1702a6..0000000 --- a/public/jquery.syntax.brush.apache.js +++ /dev/null @@ -1,40 +0,0 @@ -// brush: "apache" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('apache', function(brush) { - brush.push({ - pattern: /(<(\w+).*?>)/gi, - matches: Syntax.extractMatches( - { - klass: 'tag', - allow: ['attribute', 'tag-name', 'string'] - }, - { - klass: 'tag-name', - process: Syntax.lib.webLinkProcess("site:http://httpd.apache.org/docs/trunk/ directive", true) - }) - }); - - brush.push({ - pattern: /(<\/(\w+).*?>)/gi, - matches: Syntax.extractMatches({klass: 'tag', allow: ['tag-name']}, {klass: 'tag-name'}) - }); - - brush.push({ - pattern: /^\s+([A-Z][\w]+)/gm, - matches: Syntax.extractMatches({ - klass: 'function', - allow: ['attribute'], - process: Syntax.lib.webLinkProcess("site:http://httpd.apache.org/docs/trunk/ directive", true) - }) - }); - - brush.push(Syntax.lib.perlStyleComment); - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - - brush.push(Syntax.lib.webLink); -}); diff --git a/public/jquery.syntax.brush.applescript.js b/public/jquery.syntax.brush.applescript.js deleted file mode 100644 index 198d076..0000000 --- a/public/jquery.syntax.brush.applescript.js +++ /dev/null @@ -1,57 +0,0 @@ -// brush: "applescript" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('applescript', function(brush) { - var keywords = ["after", "before", "beginning", "continue", "copy", "each", "end", "every", "from", "get", "global", "in", "local", "named", "of", "return", "set", "some", "that", "the", "then", "times", "to", "where", "whose", "with", "without"] - - brush.push(keywords, {klass: 'keyword'}); - - var ordinals = ["first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "last", "front", "back", "middle"]; - - brush.push(ordinals, {klass: 'keyword'}); - - var specials = ["activate", "add", "alias", "AppleScript", "ask", "attachment", "boolean", "class", "constant", "delete", "duplicate", "empty", "exists", "false", "id", "integer", "list", "make", "message", "modal", "modified", "new", "no", "paragraph", "pi", "properties", "quit", "real", "record", "remove", "rest", "result", "reveal", "reverse", "run", "running", "save", "string", "true", "word", "yes"]; - - brush.push(specials, {klass: 'keyword'}); - - var comments = [ - /(\-\-|#).*$/gm, - /\(\*(?:[\s\S]*?\(\*[\s\S]*?\*\))*[\s\S]*?\*\)/gm, - Syntax.lib.perlStyleComment.pattern - ]; - - brush.push(Syntax.lib.webLink); - brush.push(comments, {klass: 'comment', allow: ['href']}); - - brush.push(Syntax.lib.doubleQuotedString); - - var constants = [ - /\b\d+(st|nd|rd|th)\b/g, - /(-)?(\d)+(\.(\d)?)?(E\+(\d)+)?/g - ]; - - brush.push(constants, {klass: 'constant'}); - - brush.push({ - pattern: /&|¬|=|≠|>|<|≥|>=|≤|<=|\*|\+|-|\/|÷|\^/g, - klass: 'operator' - }); - - brush.push({ - pattern: /\b(?:and|as|div|mod|not|or|return(?!\s&)(ing)?|equals|(is(n't| not)? )?equal( to)?|does(n't| not) equal|(is(n't| not)? )?(greater|less) than( or equal( to)?)?|(comes|does(n't| not) come) (after|before)|is(n't| not)?( in)? (back|front) of|is(n't| not)? behind|is(n't| not)?( (in|contained by))?|does(n't| not) contain|contain(s)?|(start|begin|end)(s)? with|((but|end) )?(consider|ignor)ing|prop(erty)?|(a )?ref(erence)?( to)?|repeat (until|while|with)|((end|exit) )?repeat|((else|end) )?if|else|(end )?(script|tell|try)|(on )?error|(put )?into|(of )?(it|me)|its|my|with (timeout( of)?|transaction)|end (timeout|transaction))\b/g, - klass: 'keyword' - }) - - brush.push({ - pattern: /\b(?:about|above|against|around|at|below|beneath|beside|between|by|(apart|aside) from|(instead|out) of|into|on(to)?|over|since|thr(ough|u)|under)\b/g, - klass: 'keyword' - }) - - brush.push({ - pattern: /\b(?:adding folder items to|after receiving|choose( ((remote )?application|color|folder|from list|URL))?|clipboard info|set the clipboard to|(the )?clipboard|entire contents|display(ing| (alert|dialog|mode))?|document( (edited|file|nib name))?|file( (name|type))?|(info )?for|giving up after|(name )?extension|quoted form|return(ed)?|second(?! item)(s)?|list (disks|folder)|text item(s| delimiters)?|(Unicode )?text|(disk )?item(s)?|((current|list) )?view|((container|key) )?window|with (data|icon( (caution|note|stop))?|parameter(s)?|prompt|properties|seed|title)|case|diacriticals|hyphens|numeric strings|punctuation|white space|folder creation|application(s( folder)?| (processes|scripts position|support))?|((desktop )?(pictures )?|(documents|downloads|favorites|home|keychain|library|movies|music|public|scripts|sites|system|users|utilities|workflows) )folder|desktop|Folder Action scripts|font(s| panel)?|help|internet plugins|modem scripts|(system )?preferences|printer descriptions|scripting (additions|components)|shared (documents|libraries)|startup (disk|items)|temporary items|trash|on server|in AppleTalk zone|((as|long|short) )?user name|user (ID|locale)|(with )?password|in (bundle( with identifier)?|directory)|(close|open for) access|read|write( permission)?|(g|s)et eof|using( delimiters)?|starting at|default (answer|button|color|country code|entr(y|ies)|identifiers|items|name|location|script editor)|hidden( answer)?|open(ed| (location|untitled))?|error (handling|reporting)|(do( shell)?|load|run|store) script|administrator privileges|altering line endings|get volume settings|(alert|boot|input|mount|output|set) volume|output muted|(fax|random )?number|round(ing)?|up|down|toward zero|to nearest|as taught in school|system (attribute|info)|((AppleScript( Studio)?|system) )?version|(home )?directory|(IPv4|primary Ethernet) address|CPU (type|speed)|physical memory|time (stamp|to GMT)|replacing|ASCII (character|number)|localized string|from table|offset|summarize|beep|delay|say|(empty|multiple) selections allowed|(of|preferred) type|invisibles|showing( package contents)?|editable URL|(File|FTP|News|Media|Web) [Ss]ervers|Telnet hosts|Directory services|Remote applications|waiting until completion|saving( (in|to))?|path (for|to( (((current|frontmost) )?application|resource))?)|POSIX (file|path)|(background|RGB) color|(OK|cancel) button name|cancel button|button(s)?|cubic ((centi)?met(re|er)s|yards|feet|inches)|square ((kilo)?met(re|er)s|miles|yards|feet)|(centi|kilo)?met(re|er)s|miles|yards|feet|inches|lit(re|er)s|gallons|quarts|(kilo)?grams|ounces|pounds|degrees (Celsius|Fahrenheit|Kelvin)|print( (dialog|settings))?|clos(e(able)?|ing)|(de)?miniaturized|miniaturizable|zoom(ed|able)|attribute run|action (method|property|title)|phone|email|((start|end)ing|home) page|((birth|creation|current|custom|modification) )?date|((((phonetic )?(first|last|middle))|computer|host|maiden|related) |nick)?name|aim|icq|jabber|msn|yahoo|address(es)?|save addressbook|should enable action|city|country( code)?|formatte(r|d address)|(palette )?label|state|street|zip|AIM [Hh]andle(s)?|my card|select(ion| all)?|unsaved|(alpha )?value|entr(y|ies)|group|(ICQ|Jabber|MSN) handle|person|people|company|department|icon image|job title|note|organization|suffix|vcard|url|copies|collating|pages (across|down)|request print time|target( printer)?|((GUI Scripting|Script menu) )?enabled|show Computer scripts|(de)?activated|awake from nib|became (key|main)|call method|of (class|object)|center|clicked toolbar item|closed|for document|exposed|(can )?hide|idle|keyboard (down|up)|event( (number|type))?|launch(ed)?|load (image|movie|nib|sound)|owner|log|mouse (down|dragged|entered|exited|moved|up)|move|column|localization|resource|script|register|drag (info|types)|resigned (active|key|main)|resiz(e(d)?|able)|right mouse (down|dragged|up)|scroll wheel|(at )?index|should (close|open( untitled)?|quit( after last window closed)?|zoom)|((proposed|screen) )?bounds|show(n)?|behind|in front of|size (mode|to fit)|update(d| toolbar item)?|was (hidden|miniaturized)|will (become active|close|finish launching|hide|miniaturize|move|open|quit|(resign )?active|((maximum|minimum|proposed) )?size|show|zoom)|bundle|data source|movie|pasteboard|sound|tool(bar| tip)|(color|open|save) panel|coordinate system|frontmost|main( (bundle|menu|window))?|((services|(excluded from )?windows) )?menu|((executable|frameworks|resource|scripts|shared (frameworks|support)) )?path|(selected item )?identifier|data|content(s| view)?|character(s)?|click count|(command|control|option|shift) key down|context|delta (x|y|z)|key( code)?|location|pressure|unmodified characters|types|(first )?responder|playing|(allowed|selectable) identifiers|allows customization|(auto saves )?configuration|visible|image( name)?|menu form representation|tag|user(-| )defaults|associated file name|(auto|needs) display|current field editor|floating|has (resize indicator|shadow)|hides when deactivated|level|minimized (image|title)|opaque|position|release when closed|sheet|title(d)?)\b/g, - klass: 'keyword' - }) -}); diff --git a/public/jquery.syntax.brush.assembly.js b/public/jquery.syntax.brush.assembly.js deleted file mode 100644 index 91b4855..0000000 --- a/public/jquery.syntax.brush.assembly.js +++ /dev/null @@ -1,37 +0,0 @@ -// brush: "assembly" aliases: ["asm"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('assembly', function(brush) { - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - - brush.push({pattern: /\.[a-zA-Z_][a-zA-Z0-9_]*/gm, klass: 'directive'}); - - brush.push({pattern: /^[a-zA-Z_][a-zA-Z0-9_]*:/gm, klass: 'label'}); - - brush.push({ - pattern: /^\s*([a-zA-Z]+)/gm, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - brush.push({pattern: /(-[0-9]+)|(\b[0-9]+)|(\$[0-9]+)/g, klass: 'constant'}); - brush.push({pattern: /(\-|\b|\$)(0x[0-9a-f]+|[0-9]+|[a-z0-9_]+)/gi, klass: 'constant'}); - - brush.push({pattern: /%\w+/g, klass: 'register'}); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - // Comments - brush.push(Syntax.lib.perlStyleComment); - brush.push(Syntax.lib.webLink); -}); diff --git a/public/jquery.syntax.brush.bash-script.js b/public/jquery.syntax.brush.bash-script.js deleted file mode 100644 index 1296edf..0000000 --- a/public/jquery.syntax.brush.bash-script.js +++ /dev/null @@ -1,67 +0,0 @@ -// brush: "bash-script" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('bash-script', function(brush) { - var operators = ["&&", "|", ";", "{", "}"]; - brush.push(operators, {klass: 'operator'}); - - brush.push({ - pattern: /(?:^|\||;|&&)\s*((?:"([^"]|\\")+"|'([^']|\\')+'|\\\n|.|[ \t])+?)(?=$|\||;|&&)/gmi, - matches: Syntax.extractMatches({brush: 'bash-statement'}) - }); -}); - -Syntax.register('bash-statement', function(brush) { - var keywords = ["break", "case", "continue", "do", "done", "elif", "else", "eq", "fi", "for", "function", "ge", "gt", "if", "in", "le", "lt", "ne", "return", "then", "until", "while"]; - brush.push(keywords, {klass: 'keyword'}); - - var operators = [">", "<", "=", "`", "--", "{", "}", "(", ")", "[", "]"]; - brush.push(operators, {klass: 'operator'}); - - brush.push({ - pattern: /\(\((.*?)\)\)/gmi, - klass: 'expression', - allow: ['variable', 'string', 'operator', 'constant'] - }); - - brush.push({ - pattern: /`([\s\S]+?)`/gmi, - matches: Syntax.extractMatches({brush: 'bash-script', debug: true}) - }); - - brush.push(Syntax.lib.perlStyleComment); - - // Probably need to write a real parser here rather than using regular expressions, it is too fragile - // and misses lots of edge cases (e.g. nested brackets, delimiters). - brush.push({ - pattern: /^\s*((?:\S+?=\$?(?:\[[^\]]+\]|\(\(.*?\)\)|"(?:[^"]|\\")+"|'(?:[^']|\\')+'|\S+)\s*)*)((?:\S+)?)/gmi, - matches: Syntax.extractMatches( - {klass: 'env', allow: ['variable', 'string', 'operator', 'constant', 'expression']}, - {klass: 'function', allow: ['variable', 'string']} - ) - }); - - brush.push({ - pattern: /(\S+?)=/gmi, - matches: Syntax.extractMatches({klass: 'variable'}), - only: ['env'] - }); - - brush.push({ - pattern: /\$\w+/g, - klass: 'variable' - }); - - brush.push({pattern: /\s\-+\w+/g, klass: 'option'}) - - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - brush.push(Syntax.lib.webLink); -}); diff --git a/public/jquery.syntax.brush.bash.js b/public/jquery.syntax.brush.bash.js deleted file mode 100644 index d08464e..0000000 --- a/public/jquery.syntax.brush.bash.js +++ /dev/null @@ -1,33 +0,0 @@ -// brush: "bash" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.brushes.dependency('bash', 'bash-script'); - -Syntax.register('bash', function(brush) { - brush.push({ - pattern: /^([\w@:~ ]*?[\$|\#])\s+(.*?)$/gm, - matches: Syntax.extractMatches({klass: 'prompt'}, {brush: 'bash-script'}) - }); - - brush.push({ - pattern: /^\-\- .*$/gm, - klass: 'comment', - allow: ['href'] - }); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.webLink); - - brush.push({ - klass: 'stderr', - allow: ['string', 'comment', 'constant', 'href'] - }); -}); diff --git a/public/jquery.syntax.brush.basic.js b/public/jquery.syntax.brush.basic.js deleted file mode 100644 index 1cc1d74..0000000 --- a/public/jquery.syntax.brush.basic.js +++ /dev/null @@ -1,51 +0,0 @@ -// brush: "basic" aliases: ['vb'] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.lib.vbStyleComment = {pattern: /' .*$/gm, klass: 'comment', allow: ['href']}; - -Syntax.register('basic', function(brush) { - var keywords = ["AddHandler", "AddressOf", "Alias", "And", "AndAlso", "Ansi", "As", "Assembly", "Auto", "ByRef", "ByVal", "Call", "Case", "Catch", "Declare", "Default", "Delegate", "Dim", "DirectCast", "Do", "Each", "Else", "ElseIf", "End", "Enum", "Erase", "Error", "Event", "Exit", "Finally", "For", "Function", "Get", "GetType", "GoSub", "GoTo", "Handles", "If", "Implements", "Imports", "In", "Inherits", "Interface", "Is", "Let", "Lib", "Like", "Loop", "Mod", "Module", "MustOverride", "Namespace", "New", "Next", "Not", "On", "Option", "Optional", "Or", "OrElse", "Overloads", "Overridable", "Overrides", "ParamArray", "Preserve", "Property", "RaiseEvent", "ReadOnly", "ReDim", "REM", "RemoveHandler", "Resume", "Return", "Select", "Set", "Static", "Step", "Stop", "Structure", "Sub", "SyncLock", "Then", "Throw", "To", "Try", "TypeOf", "Unicode", "Until", "When", "While", "With", "WithEvents", "WriteOnly", "Xor", "ExternalSource", "Region", "Print", "Class"]; - - var operators = ["-", "&", "&=", "*", "*=", "/", "/=", "\\", "\=", "^", "^=", "+", "+=", "=", "-="]; - - var types = ["CBool", "CByte", "CChar", "CDate", "CDec", "CDbl", "Char", "CInt", "CLng", "CObj", "Const", "CShort", "CSng", "CStr", "CType", "Date", "Decimal", "Variant", "String", "Short", "Long", "Single", "Double", "Object", "Integer", "Boolean", "Byte", "Char"]; - - var operators = ["+", "-", "*", "/", "+=", "-=", "*=", "/=", "=", ":=", "==", "!=", "!", "%", "?", ">", "<", ">=", "<=", "&&", "||", "&", "|", "^", ".", "~", "..", ">>", "<<", ">>>", "<<<", ">>=", "<<=", ">>>=", "<<<=", "%=", "^=", "@"]; - - var values = ["Me", "MyClass", "MyBase", "super", "True", "False", "Nothing", /[A-Z][A-Z0-9_]+/g]; - - var access = ["Public", "Protected", "Private", "Shared", "Friend", "Shadows", "MustInherit", "NotInheritable", "NotOverridable"]; - - brush.push(types, {klass: 'type'}); - brush.push(keywords, {klass: 'keyword', options: 'gi'}); - brush.push(operators, {klass: 'operator'}); - brush.push(access, {klass: 'access'}); - brush.push(values, {klass: 'constant'}); - - brush.push(Syntax.lib.decimalNumber); - - // ClassNames (CamelCase) - brush.push(Syntax.lib.camelCaseType); - - brush.push(Syntax.lib.vbStyleComment); - - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - brush.postprocess = function (options, html, container) { - var queryURI = "http://social.msdn.microsoft.com/Search/en-us?query="; - - jQuery('.function', html).each(function() { - var text = jQuery(this).text(); - jQuery(this).replaceWith(jQuery('
').attr('href', queryURI + encodeURIComponent(text)).text(text)); - }); - - return html; - }; -}); diff --git a/public/jquery.syntax.brush.clang.js b/public/jquery.syntax.brush.clang.js deleted file mode 100644 index ed30d05..0000000 --- a/public/jquery.syntax.brush.clang.js +++ /dev/null @@ -1,89 +0,0 @@ -// brush: "clang" aliases: ["cpp", "c++", "c", "objective-c"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('clang', function(brush) { - var keywords = ["@interface", "@implementation", "@protocol", "@end", "@try", "@throw", "@catch", "@finally", "@class", "@selector", "@encode", "@synchronized", "@property", "@synthesize", "@dynamic", "struct", "break", "continue", "else", "for", "switch", "case", "default", "enum", "goto", "register", "sizeof", "typedef", "volatile", "do", "extern", "if", "return", "static", "union", "while", "asm", "dynamic_cast", "namespace", "reinterpret_cast", "try", "explicit", "static_cast", "typeid", "catch", "operator", "template", "class", "const_cast", "inline", "throw", "virtual", "IBOutlet"]; - - var access = ["@private", "@protected", "@public", "@required", "@optional", "private", "protected", "public", "friend", "using"]; - - var typeModifiers = ["mutable", "auto", "const", "register", "typename", "abstract"]; - var types = ["double", "float", "int", "short", "char", "long", "signed", "unsigned", "bool", "void", "id"]; - - var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">", "[", "]", "new", "delete", "in"]; - - var values = ["this", "true", "false", "NULL", "YES", "NO", "nil"]; - - brush.push(values, {klass: 'constant'}); - brush.push(typeModifiers, {klass: 'keyword'}) - brush.push(types, {klass: 'type'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - brush.push(access, {klass: 'access'}); - - // Objective-C properties - brush.push({ - pattern: /@property\((.*)\)[^;]+;/gmi, - klass: 'objective-c-property', - allow: '*' - }); - - var propertyAttributes = ["getter", "setter", "readwrite", "readonly", "assign", "retain", "copy", "nonatomic"]; - - brush.push(propertyAttributes, { - klass: 'keyword', - only: ['objective-c-property'] - }); - - // Objective-C strings - - brush.push({ - pattern: /@(?=")/g, - klass: 'string' - }); - - // Objective-C classes, C++ classes, C types, etc. - brush.push(Syntax.lib.camelCaseType); - brush.push(Syntax.lib.cStyleType); - brush.push({ - pattern: /(?:class|struct|enum|namespace)\s+([^{;\s]+)/gmi, - matches: Syntax.extractMatches({klass: 'type'}) - }); - - brush.push({ - pattern: /#.*$/gmi, - klass: 'preprocessor', - allow: ['string'] - }); - - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - brush.push(Syntax.lib.webLink); - - // Objective-C style functions - brush.push({pattern: /\w+:(?=.*(\]|;|\{))(?!:)/g, klass: 'function'}); - - brush.push({ - pattern: /[^:\[]\s+(\w+)(?=\])/g, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - brush.push({ - pattern: /-\s*(\([^\)]+?\))?\s*(\w+)\s*\{/g, - matches: Syntax.extractMatches({index: 2, klass: 'function'}) - }); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - brush.push(Syntax.lib.cStyleFunction); -}); - diff --git a/public/jquery.syntax.brush.csharp.js b/public/jquery.syntax.brush.csharp.js deleted file mode 100644 index bb4d9aa..0000000 --- a/public/jquery.syntax.brush.csharp.js +++ /dev/null @@ -1,47 +0,0 @@ -// brush: "csharp" aliases: ["c-sharp", "c#"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('csharp', function(brush) { - var keywords = ["abstract", "add", "alias", "ascending", "base", "break", "case", "catch", "class", "const", "continue", "default", "delegate", "descending", "do", "dynamic", "else", "enum", "event", "explicit", "extern", "finally", "for", "foreach", "from", "get", "global", "goto", "group", "if", "implicit", "in", "interface", "into", "join", "let", "lock", "namespace", "new", "operator", "orderby", "out", "override", "params", "partial", "readonly", "ref", "remove", "return", "sealed", "select", "set", "stackalloc", "static", "struct", "switch", "throw", "try", "unsafe", "using", "value", "var", "virtual", "volatile", "where", "while", "yield"]; - - var access = ["public", "private", "internal", "protected"]; - - var types = ["object", "bool", "byte", "fixed", "float", "uint", "char", "ulong", "ushort", "decimal", "int", "sbyte", "short", "void", "long", "string", "double"]; - - var operators = ["+", "-", "*", "/", "%", "&", "|", "^", "!", "~", "&&", "||", "++", "--", "<<", ">>", "==", "!=", "<", ">", "<=", ">=", "=", "?", "new", "as", "is", "sizeof", "typeof", "checked", "unchecked"]; - - var values = ["this", "true", "false", "null"]; - - brush.push(values, {klass: 'constant'}); - brush.push(types, {klass: 'type'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - brush.push(access, {klass: 'access'}); - - // Functions - brush.push(Syntax.lib.cStyleFunction); - brush.push({ - pattern: /(?:\.)([a-z_][a-z0-9_]+)/gi, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - // Camel Case Types - brush.push(Syntax.lib.camelCaseType); - - // Comments - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); -}); - diff --git a/public/jquery.syntax.brush.css.js b/public/jquery.syntax.brush.css.js deleted file mode 100644 index 3a0fc5b..0000000 --- a/public/jquery.syntax.brush.css.js +++ /dev/null @@ -1,80 +0,0 @@ -// brush: "css" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('css', function(brush) { - var colorNames = ["AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque", "Black", "BlanchedAlmond", "Blue", "BlueViolet", "Brown", "BurlyWood", "CadetBlue", "Chartreuse", "Chocolate", "Coral", "CornflowerBlue", "Cornsilk", "Crimson", "Cyan", "DarkBlue", "DarkCyan", "DarkGoldenRod", "DarkGray", "DarkGreen", "DarkKhaki", "DarkMagenta", "DarkOliveGreen", "Darkorange", "DarkOrchid", "DarkRed", "DarkSalmon", "DarkSeaGreen", "DarkSlateBlue", "DarkSlateGray", "DarkTurquoise", "DarkViolet", "DeepPink", "DeepSkyBlue", "DimGray", "DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen", "Fuchsia", "Gainsboro", "GhostWhite", "Gold", "GoldenRod", "Gray", "Green", "GreenYellow", "HoneyDew", "HotPink", "IndianRed", "Indigo", "Ivory", "Khaki", "Lavender", "LavenderBlush", "LawnGreen", "LemonChiffon", "LightBlue", "LightCoral", "LightCyan", "LightGoldenRodYellow", "LightGrey", "LightGreen", "LightPink", "LightSalmon", "LightSeaGreen", "LightSkyBlue", "LightSlateGray", "LightSteelBlue", "LightYellow", "Lime", "LimeGreen", "Linen", "Magenta", "Maroon", "MediumAquaMarine", "MediumBlue", "MediumOrchid", "MediumPurple", "MediumSeaGreen", "MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise", "MediumVioletRed", "MidnightBlue", "MintCream", "MistyRose", "Moccasin", "NavajoWhite", "Navy", "OldLace", "Olive", "OliveDrab", "Orange", "OrangeRed", "Orchid", "PaleGoldenRod", "PaleGreen", "PaleTurquoise", "PaleVioletRed", "PapayaWhip", "PeachPuff", "Peru", "Pink", "Plum", "PowderBlue", "Purple", "Red", "RosyBrown", "RoyalBlue", "SaddleBrown", "Salmon", "SandyBrown", "SeaGreen", "SeaShell", "Sienna", "Silver", "SkyBlue", "SlateBlue", "SlateGray", "Snow", "SpringGreen", "SteelBlue", "Tan", "Teal", "Thistle", "Tomato", "Turquoise", "Violet", "Wheat", "White", "WhiteSmoke", "Yellow", "YellowGreen"]; - - var colorPatterns = ["#[0-9a-f]{3,6}", "rgba?\\(.+?\\)", "hsla?\\(.+?\\)"]; - - var colorMatcher = [].concat( - jQuery.map(colorNames, function(pattern) { - return "(" + Syntax.Brush.convertStringToTokenPattern(pattern, true) + ")"; - }), - jQuery.map(colorPatterns, function(pattern) { - return "(" + Syntax.Brush.convertStringToTokenPattern(pattern, false) + ")"; - }) - ); - - brush.push({ - pattern: /\(.*?\)/g, - allow: '*', - disallow: ['property'] - }); - - brush.push({ - pattern: /\s*([\:\.\[\]\"\'\=\s\w#\.\-,]+)\s+\{/gm, - matches: Syntax.extractMatches({klass: 'selector', allow: ['string']}) - }); - - brush.push({ - pattern: new RegExp(colorMatcher.join("|"), "gi"), - klass: 'color', - process: function (element, match) { - var text = Syntax.innerText(element); - var colourBox = document.createElement('span'); - colourBox.className = 'colour-box'; - - var sampleColour = document.createElement('span'); - sampleColour.className = 'sample'; - sampleColour.style.backgroundColor = text; - sampleColour.appendChild(document.createTextNode('  ')) - colourBox.appendChild(sampleColour); - - element.appendChild(colourBox); - return element; - } - }); - - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.webLink); - - brush.push({ - pattern: /\{(.|\n)*?\}/g, - klass: 'properties', - allow: '*' - }); - - brush.push({ - pattern: /\:(.*?(?=\})|(.|\n)*?(?=(\}|\;)))/g, - matches: Syntax.extractMatches({klass: 'value', allow: ['color'], only: ['properties']}) - }); - - brush.push({ - pattern: /([\-\w]+):/g, - matches: Syntax.extractMatches({ - klass: 'property', - process: Syntax.lib.webLinkProcess("http://cssdocs.org/") - }) - }); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - brush.push(Syntax.lib.cStyleFunction); -}); - diff --git a/public/jquery.syntax.brush.diff.js b/public/jquery.syntax.brush.diff.js deleted file mode 100644 index e55b83e..0000000 --- a/public/jquery.syntax.brush.diff.js +++ /dev/null @@ -1,24 +0,0 @@ -// brush: "diff" aliases: ["patch"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('diff', function(brush) { - brush.push({pattern: /^\+\+\+.*$/gm, klass: 'add'}); - brush.push({pattern: /^\-\-\-.*$/gm, klass: 'del'}); - - brush.push({pattern: /^@@.*@@/gm, klass: 'offset'}); - - brush.push({pattern: /^\+[^\+]{1}.*$/gm, klass: 'insert'}); - brush.push({pattern: /^\-[^\-]{1}.*$/gm, klass: 'remove'}); - - brush.postprocess = function (options, html, container) { - $('.insert', html).closest('.source').addClass('insert-line'); - $('.remove', html).closest('.source').addClass('remove-line'); - $('.offset', html).closest('.source').addClass('offset-line'); - - return html; - }; -}); - diff --git a/public/jquery.syntax.brush.go.js b/public/jquery.syntax.brush.go.js deleted file mode 100644 index a376487..0000000 --- a/public/jquery.syntax.brush.go.js +++ /dev/null @@ -1,47 +0,0 @@ -// brush: "go" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('go', function(brush) { - var keywords = ["break", "default", "func", "interface", "select", "case", "defer", "go", "map", "struct", "chan", "else", "goto", "package", "switch", "const", "fallthrough", "if", "range", "type", "continue", "for", "import", "return", "var"]; - - var types = [ - /u?int\d*/g, - /float\d+/g, - /complex\d+/g, - "byte", - "uintptr", - "string", - ]; - - var operators = ["+", "&", "+=", "&=", "&&", "==", "!=", "-", "|", "-=", "|=", "||", "<", "<=", "*", "^", "*=", "^=", "<-", ">", ">=", "/", "<<", "/=", "<<=", "++", "=", ":=", ",", ";", "%", ">>", "%=", ">>=", "--", "!", "...", ".", ":", "&^", "&^="]; - - var values = ["true", "false", "iota", "nil"]; - - var functions = ["append", "cap", "close", "complex", "copy", "imag", "len", "make", "new", "panic", "print", "println", "real", "recover"]; - - brush.push(values, {klass: 'constant'}); - brush.push(types, {klass: 'type'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - brush.push(functions, {klass: 'function'}); - - brush.push(Syntax.lib.cStyleFunction); - - brush.push(Syntax.lib.camelCaseType); - - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); -}); diff --git a/public/jquery.syntax.brush.haskell.js b/public/jquery.syntax.brush.haskell.js deleted file mode 100644 index 77deeba..0000000 --- a/public/jquery.syntax.brush.haskell.js +++ /dev/null @@ -1,45 +0,0 @@ -// brush: "haskell" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('haskell', function(brush) { - var keywords = ["as", "case", "of", "class", "data", "data family", "data instance", "default", "deriving", "deriving instance", "do", "forall", "foreign", "hiding", "if", "then", "else", "import", "infix", "infixl", "infixr", "instance", "let", "in", "mdo", "module", "newtype", "proc", "qualified", "rec", "type", "type family", "type instance", "where"]; - - var operators = ["`", "|", "\\", "-", "-<", "-<<", "->", "*", "?", "??", "#", "<-", "@", "!", "::", "_", "~", ">", ";", "{", "}"]; - - var values = ["True", "False"]; - - brush.push(values, {klass: 'constant'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - - // Camelcase Types - brush.push(Syntax.lib.camelCaseType); - - // Comments - brush.push({ - pattern: /\-\-.*$/gm, - klass: 'comment', - allow: ['href'] - }); - - brush.push({ - pattern: /\{\-[\s\S]*?\-\}/gm, - klass: 'comment', - allow: ['href'] - }); - - brush.push(Syntax.lib.webLink); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); -}); - diff --git a/public/jquery.syntax.brush.html.js b/public/jquery.syntax.brush.html.js deleted file mode 100644 index 4beb7fc..0000000 --- a/public/jquery.syntax.brush.html.js +++ /dev/null @@ -1,66 +0,0 @@ -// brush: "html" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.brushes.dependency('html', 'xml'); -Syntax.brushes.dependency('html', 'javascript'); -Syntax.brushes.dependency('html', 'css'); -Syntax.brushes.dependency('html', 'php-script'); -Syntax.brushes.dependency('html', 'ruby'); - -Syntax.register('html', function(brush) { - brush.push({ - pattern: /((.|\n)*?)<\/script>/gmi, - matches: Syntax.extractMatches({brush: 'javascript'}) - }); - - brush.push({ - pattern: /((.|\n)*?)<\/style>/gmi, - matches: Syntax.extractMatches({brush: 'css'}) - }); - - brush.push({ - pattern: /((<\?php)([\s\S]*?)(\?>))/gm, - matches: Syntax.extractMatches( - {klass: 'php-tag', allow: ['keyword', 'php-script']}, - {klass: 'keyword'}, - {brush: 'php-script'}, - {klass: 'keyword'} - ) - }); - - brush.push({ - pattern: /((<\?rb?)([\s\S]*?)(\?>))/gm, - matches: Syntax.extractMatches( - {klass: 'ruby-tag', allow: ['keyword', 'ruby']}, - {klass: 'keyword'}, - {brush: 'ruby'}, - {klass: 'keyword'} - ) - }); - - brush.push({ - pattern: /<%=?(.*?)(%>)/g, - klass: 'instruction', - allow: ['string'] - }); - - brush.push({ - pattern: /<\!(DOCTYPE(.*?))>/g, - matches: Syntax.extractMatches({klass: 'doctype'}) - }); - - // Is this rule still relevant? - brush.push({ - pattern: /(%[0-9a-f]{2})/gi, - klass: 'percent-escape', - only: ['html'] - }); - - // The position of this statement is important - it determines at what point the rules of the parent are processed. - // In this case, the rules for xml are processed after the rules for html. - brush.derives('xml'); -}); - diff --git a/public/jquery.syntax.brush.io.js b/public/jquery.syntax.brush.io.js deleted file mode 100644 index 312b750..0000000 --- a/public/jquery.syntax.brush.io.js +++ /dev/null @@ -1,45 +0,0 @@ -// brush: "io" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('io', function(brush) { - brush.push(Syntax.lib.cStyleFunction); - - var keywords = ["return"]; - - var operators = ["::=", ":=", "or", "and", "@", "+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">", "[", "]", "new", "delete"]; - - brush.push(keywords, {klass: 'keywords'}); - brush.push(operators, {klass: 'operator'}); - - // Extract space delimited method invocations - brush.push({ - pattern: /\b([ \t]+([a-z]+))/gi, - matches: Syntax.extractMatches({index: 2, klass: 'function'}) - }); - - brush.push({ - pattern: /\)([ \t]+([a-z]+))/gi, - matches: Syntax.extractMatches({index: 2, klass: 'function'}) - }); - - // Objective-C classes - brush.push(Syntax.lib.camelCaseType); - - brush.push(Syntax.lib.perlStyleComment); - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); -}); - diff --git a/public/jquery.syntax.brush.java.js b/public/jquery.syntax.brush.java.js deleted file mode 100644 index ad0591e..0000000 --- a/public/jquery.syntax.brush.java.js +++ /dev/null @@ -1,45 +0,0 @@ -// brush: "java" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('java', function(brush) { - var keywords = ["abstract", "continue", "for", "switch", "assert", "default", "goto", "synchronized", "do", "if", "break", "implements", "throw", "else", "import", "throws", "case", "enum", "return", "transient", "catch", "extends", "try", "final", "interface", "static", "class", "finally", "strictfp", "volatile", "const", "native", "super", "while"]; - - var access = ["private", "protected", "public", "package"]; - - var types = ["void", "byte", "short", "int", "long", "float", "double", "boolean", "char"]; - - var operators = ["++", "--", "++", "--", "+", "-", "~", "!", "*", "/", "%", "+", "-", "<<", ">>", ">>>", "<", ">", "<=", ">=", "==", "!=", "&", "^", "|", "&&", "||", "?", "=", "+=", "-=", "*=", "/=", "%=", "&=", "^=", "|=", "<<=", ">>=", ">>>=", "instanceof", "new", "delete"]; - - var constants = ["this", "true", "false", "null"]; - - brush.push(constants, {klass: 'constant'}); - brush.push(types, {klass: 'type'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - brush.push(access, {klass: 'access'}); - - // Camel Case Types - brush.push(Syntax.lib.camelCaseType); - - // Comments - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - brush.push(Syntax.lib.webLink); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - brush.push(Syntax.lib.cStyleFunction); - - brush.processes['function'] = Syntax.lib.webLinkProcess('java "Developer Documentation"', true); -}); - diff --git a/public/jquery.syntax.brush.javascript.js b/public/jquery.syntax.brush.javascript.js deleted file mode 100644 index d0ad541..0000000 --- a/public/jquery.syntax.brush.javascript.js +++ /dev/null @@ -1,40 +0,0 @@ -// brush: "javascript" aliases: ["js", "actionscript"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('javascript', function(brush) { - var keywords = ["function", "break", "case", "catch", "continue", "default", "delete", "do", "else", "for", "if", "in", "instanceof", "new", "return", "super", "switch", "throw", "true", "try", "typeof", "var", "while", "with", "prototype"]; - - var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">"]; - var values = ["this", "true", "false", "null"]; - - brush.push(values, {klass: 'constant'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - - // Regular expressions - brush.push(Syntax.lib.perlStyleRegularExpression); - - // Camel Case Types - brush.push(Syntax.lib.camelCaseType); - - // Comments - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - // Functions - brush.push(Syntax.lib.cStyleFunction); -}); - diff --git a/public/jquery.syntax.brush.kai.js b/public/jquery.syntax.brush.kai.js deleted file mode 100644 index e3c7b00..0000000 --- a/public/jquery.syntax.brush.kai.js +++ /dev/null @@ -1,29 +0,0 @@ -// brush: "kai" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('kai', function(brush) { - brush.push(['(', ')', '[', ']', '{', '}'], {klass: 'operator'}); - - brush.push(Syntax.lib.perlStyleComment); - - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.webLink); - - brush.push({ - pattern: /\(([^\s\(\)]+)/gi, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - brush.push({ - pattern: /`[a-z]*/gi, - klass: 'constant' - }) - - // Strings - brush.push(Syntax.lib.multiLineDoubleQuotedString); - brush.push(Syntax.lib.stringEscape); -}); - diff --git a/public/jquery.syntax.brush.lisp.js b/public/jquery.syntax.brush.lisp.js deleted file mode 100644 index d2cdc5f..0000000 --- a/public/jquery.syntax.brush.lisp.js +++ /dev/null @@ -1,34 +0,0 @@ -// brush: "lisp" aliases: ['scheme', 'clojure'] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.lib.lispStyleComment = {pattern: /(;+) .*$/gm, klass: 'comment', allow: ['href']}; - -// This syntax is intentionally very sparse. This is because it is a general syntax for Lisp like languages. -// It might be a good idea to make specific dialects (e.g. common lisp, scheme, clojure, etc) -Syntax.register('lisp', function(brush) { - brush.push(['(', ')'], {klass: 'operator'}); - - brush.push(Syntax.lib.lispStyleComment); - - brush.push(Syntax.lib.hexNumber); - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.webLink); - - brush.push({ - pattern: /\(\s*([^\s\(\)]+)/gmi, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - brush.push({ - pattern: /#[a-z]+/gi, - klass: 'constant' - }) - - // Strings - brush.push(Syntax.lib.multiLineDoubleQuotedString); - brush.push(Syntax.lib.stringEscape); -}); - diff --git a/public/jquery.syntax.brush.lua.js b/public/jquery.syntax.brush.lua.js deleted file mode 100644 index f7821c3..0000000 --- a/public/jquery.syntax.brush.lua.js +++ /dev/null @@ -1,44 +0,0 @@ -// brush: "lua" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('lua', function(brush) { - var keywords = ["and", "break", "do", "else", "elseif", "end", "false", "for", "function", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while"]; - - var operators = ["+", "-", "*", "/", "%", "^", "#", "..", "=", "==", "~=", "<", ">", "<=", ">=", "?", ":"]; - - var values = ["self", "true", "false", "nil"]; - - brush.push(values, {klass: 'constant'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - - // Camelcase Types - brush.push(Syntax.lib.camelCaseType); - brush.push(Syntax.lib.cStyleFunction); - - brush.push({ - pattern: /\-\-.*$/gm, - klass: 'comment', - allow: ['href'] - }); - - brush.push({ - pattern: /\-\-\[\[(\n|.)*?\]\]\-\-/gm, - klass: 'comment', - allow: ['href'] - }); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - brush.push(Syntax.lib.hexNumber); - brush.push(Syntax.lib.decimalNumber); - - brush.push(Syntax.lib.webLink); -}); - diff --git a/public/jquery.syntax.brush.ocaml.js b/public/jquery.syntax.brush.ocaml.js deleted file mode 100644 index c0b7e20..0000000 --- a/public/jquery.syntax.brush.ocaml.js +++ /dev/null @@ -1,73 +0,0 @@ -// brush: "ocaml" aliases: ["ml", "sml", "fsharp"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -// This brush is based loosely on the following documentation: -// http://msdn.microsoft.com/en-us/library/dd233230.aspx - -Syntax.register('ocaml', function(brush) { - var keywords = ["abstract", "and", "as", "assert", "begin", "class", "default", "delegate", "do", "done", "downcast", "downto", "elif", "else", "end", "exception", "extern", "finally", "for", "fun", "function", "if", "in", "inherit", "inline", "interface", "internal", "lazy", "let", "match", "member", "module", "mutable", "namespace", "new", "null", "of", "open", "or", "override", "rec", "return", "static", "struct", "then", "to", "try", "type", "upcast", "use", "val", "when", "while", "with", "yield", "asr", "land", "lor", "lsl", "lsr", "lxor", "mod", "sig", "atomic", "break", "checked", "component", "const", "constraint", "constructor", "continue", "eager", "event", "external", "fixed", "functor", "global", "include", "method", "mixin", "object", "parallel", "process", "protected", "pure", "sealed", "trait", "virtual", "volatile", "val"]; - - var types = ["bool", "byte", "sbyte", /\bu?int\d*\b/g, "nativeint", "unativeint", "char", "string", "decimal", "unit", "void", "float32", "single", "float64", "double", "list", "array", "exn", "format", "fun", "option", "ref"]; - - var operators = ["!", "<>", "%", "&", "*", "+", "-", "->", "/", "::", ":=", ":>", ":?", ":?>", "<", "=", ">", "?", "@", "^", "_", "`", "|", "~", "'", "[<", ">]", "<|", "|>", "[|", "|]", "(|", "|)", "(*", "*)", "in"]; - - var values = ["true", "false"]; - - var access = ["private", "public"]; - - brush.push(access, {klass: 'access'}); - brush.push(values, {klass: 'constant'}); - brush.push(types, {klass: 'type'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - - // http://caml.inria.fr/pub/docs/manual-ocaml/manual011.html#module-path - // open [module-path], new [type] - brush.push({ - pattern: /(?:open|new)\s+((?:\.?[a-z][a-z0-9]*)+)/gi, - matches: Syntax.extractMatches({klass: 'type'}) - }); - - // Functions - brush.push({ - pattern: /(?:\.)([a-z_][a-z0-9_]+)/gi, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - // Avoid highlighting keyword arguments as camel-case types. - brush.push({ - pattern: /(?:\(|,)\s*(\w+\s*=)/g, - matches: Syntax.extractMatches({ - klass: 'keyword-argument' - }) - }); - - // We need to modify cStyleFunction because "(*" is a comment token. - brush.push({ - pattern: /([a-z_][a-z0-9_]*)\s*\((?!\*)/gi, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - // Types - brush.push(Syntax.lib.camelCaseType); - - // Web Links - brush.push(Syntax.lib.webLink); - - // Comments - brush.push({ - pattern: /\(\*[\s\S]*?\*\)/g, - klass: 'comment' - }); - - // Strings - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); -}); diff --git a/public/jquery.syntax.brush.ooc.js b/public/jquery.syntax.brush.ooc.js deleted file mode 100644 index 133040c..0000000 --- a/public/jquery.syntax.brush.ooc.js +++ /dev/null @@ -1,46 +0,0 @@ -// brush: "ooc" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('ooc', function(brush) { - var keywords = ["class", "interface", "implement", "abstract", "extends", "from", "const", "final", "static", "import", "use", "extern", "inline", "proto", "break", "continue", "fallthrough", "operator", "if", "else", "for", "while", "do", "switch", "case", "as", "in", "version", "return", "include", "cover", "func"]; - - var types = ["Int", "Int8", "Int16", "Int32", "Int64", "Int80", "Int128", "UInt", "UInt8", "UInt16", "UInt32", "UInt64", "UInt80", "UInt128", "Octet", "Short", "UShort", "Long", "ULong", "LLong", "ULLong", "Float", "Double", "LDouble", "Float32", "Float64", "Float128", "Char", "UChar", "WChar", "String", "Void", "Pointer", "Bool", "SizeT", "This"]; - - var operators = ["+", "-", "*", "/", "+=", "-=", "*=", "/=", "=", ":=", "==", "!=", "!", "%", "?", ">", "<", ">=", "<=", "&&", "||", "&", "|", "^", ".", "~", "..", ">>", "<<", ">>>", "<<<", ">>=", "<<=", ">>>=", "<<<=", "%=", "^=", "@"]; - - var values = ["this", "super", "true", "false", "null", /[A-Z][A-Z0-9_]+/g]; - - brush.push(values, {klass: 'constant'}); - brush.push(types, {klass: 'type'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - - // Hex, Octal and Binary numbers :) - brush.push({ - pattern: /0[xcb][0-9a-fA-F]+/g, - klass: 'constant' - }); - - brush.push(Syntax.lib.decimalNumber); - - // ClassNames (CamelCase) - brush.push(Syntax.lib.camelCaseType); - brush.push(Syntax.lib.cStyleType); - brush.push(Syntax.lib.cStyleFunction); - - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - brush.processes['function'] = Syntax.lib.webLinkProcess("http://docs.ooc-lang.org/search.html?q="); -}); - diff --git a/public/jquery.syntax.brush.pascal.js b/public/jquery.syntax.brush.pascal.js deleted file mode 100644 index 606d1f1..0000000 --- a/public/jquery.syntax.brush.pascal.js +++ /dev/null @@ -1,51 +0,0 @@ -// brush: "pascal" aliases: ["delphi"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. -// -// Constructed using information from http://pascal.comsci.us/etymology/ -// - -Syntax.register('pascal', function(brush) { - var keywords = ["absolute", "abstract", "all", "and_then", "as", "asm", "asmname", "attribute", "begin", "bindable", "c", "c_language", "case", "class", "const", "constructor", "destructor", "dispose", "do", "downto", "else", "end", "except", "exit", "export", "exports", "external", "far", "file", "finalization", "finally", "for", "forward", "function", "goto", "if", "implementation", "import", "inherited", "initialization", "inline", "interface", "interrupt", "is", "keywords", "label", "library", "module", "name", "near", "new", "object", "of", "on", "only", "operator", "or_else", "otherwise", "packed", "pascal", "pow", "private", "procedure", "program", "property", "protected", "public", "published", "qualified", "raise", "record", "repeat", "resident", "restricted", "segment", "set", "then", "threadvar", "to", "try", "type", "unit", "until", "uses", "value", "var", "view", "virtual", "while", "with"]; - - var operators = ["+", "-", "*", "/", "div", "mod", "and", "or", "xor", "shl", "shr", "not", "=", ">=", ">", "<>", "<=", "<", "in", ":="]; - - var values = ["true", "false", "nil"]; - - // Keywords are case insensitive - brush.push(values, {klass: 'constant', options: 'gi'}); - brush.push(keywords, {klass: 'keyword', options: 'gi'}); - brush.push(operators, {klass: 'operator', options: 'gi'}); - - brush.push(Syntax.lib.camelCaseType); - - // Pascal style comments - brush.push({ - pattern: /\{[\s\S]*?\}/gm, - klass: 'comment', - allow: ['href'] - }); - - brush.push({ - pattern: /\(\*[\s\S]*?\*\)/gm, - klass: 'comment', - allow: ['href'] - }); - - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - // Functions - brush.push(Syntax.lib.cStyleFunction); -}); - diff --git a/public/jquery.syntax.brush.perl5.js b/public/jquery.syntax.brush.perl5.js deleted file mode 100644 index 4ec9c4d..0000000 --- a/public/jquery.syntax.brush.perl5.js +++ /dev/null @@ -1,52 +0,0 @@ -// brush: "perl5" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('perl5', function(brush) { - var builtins = ["abs", "accept", "alarm", "atan2", "bind", "binmode", "chdir", "chmod", "chomp", "chop", "chown", "chr", "chroot", "close", "closedir", "connect", "cos", "crypt", "defined", "delete", "each", "endgrent", "endhostent", "endnetent", "endprotoent", "endpwent", "endservent", "eof", "exec", "exists", "exp", "fcntl", "fileno", "flock", "fork", "format", "formline", "getc", "getgrent", "getgrgid", "getgrnam", "gethostbyaddr", "gethostbyname", "gethostent", "getlogin", "getnetbyaddr", "getnetbyname", "getnetent", "getpeername", "getpgrp", "getppid", "getpriority", "getprotobyname", "getprotobynumber", "getprotoent", "getpwent", "getpwnam", "getpwuid", "getservbyname", "getservbyport", "getservent", "getsockname", "getsockopt", "glob", "gmtime", "grep", "hex", "index", "int", "ioctl", "join", "keys", "kill", "lc", "lcfirst", "length", "link", "listen", "localtime", "lock", "log", "lstat", "map", "mkdir", "msgctl", "msgget", "msgrcv", "msgsnd", "oct", "open", "opendir", "ord", "pack", "pipe", "pop", "pos", "print", "printf", "prototype", "push", "quotemeta", "rand", "read", "readdir", "readline", "readlink", "readpipe", "recv", "rename", "reset", "reverse", "rewinddir", "rindex", "rmdir", "scalar", "seek", "seekdir", "select", "semctl", "semget", "semop", "send", "setgrent", "sethostent", "setnetent", "setpgrp", "setpriority", "setprotoent", "setpwent", "setservent", "setsockopt", "shift", "shmctl", "shmget", "shmread", "shmwrite", "shutdown", "sin", "sleep", "socket", "socketpair", "sort", "splice", "split", "sprintf", "sqrt", "srand", "stat", "study", "substr", "symlink", "syscall", "sysopen", "sysread", "sysseek", "system", "syswrite", "tell", "telldir", "time", "times", "tr", "truncate", "uc", "ucfirst", "umask", "undef", "unlink", "unpack", "unshift", "utime", "values", "vec", "wait", "waitpid", "warn", "write"]; - - var keywords = ["bless", "caller", "continue", "die", "do", "dump", "else", "elsif", "eval", "exit", "for", "foreach", "goto", "if", "import", "last", "local", "my", "next", "no", "our", "package", "redo", "ref", "require", "return", "sub", "tie", "tied", "unless", "untie", "until", "use", "wantarray", "while"]; - - var operators = ["->", "++", "--", "**", "!", "~", "\\", "+", "-", "=~", "!~", "*", "/", "%", "x", "+", "-", ".", "<<", ">>", "<", ">", "<=", ">=", "lt", "gt", "le", "ge", "==", "!=", "<=>", "eq", "ne", "cmp", "~~", "&", "|", "^", "&&", "||", "//", "..", "...", "?:", "=", ",", "=>", "not", "and", "or", "xor"]; - - var values = ["this", "true", "false"]; - - brush.push(values, {klass: 'constant'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - brush.push(builtins, {klass: 'function'}); - - // Regular expressions - brush.push(Syntax.lib.perlStyleRegularExpression); - - // Comments - brush.push(Syntax.lib.perlStyleComment); - brush.push(Syntax.lib.webLink); - - // Variables - brush.push({ - pattern: /(\$|@|%)\w+/gi, - klass: 'variable' - }); - - // Enddoc - brush.push({ - pattern: /__END__[\s\S]*/gm, - klass: 'comment' - }); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - // Functions - brush.push(Syntax.lib.cStyleFunction); -}); - diff --git a/public/jquery.syntax.brush.php-script.js b/public/jquery.syntax.brush.php-script.js deleted file mode 100644 index c053fa0..0000000 --- a/public/jquery.syntax.brush.php-script.js +++ /dev/null @@ -1,48 +0,0 @@ -// brush: "php-script" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('php-script', function(brush) { - var keywords = ["abstract", "and", "as", "break", "case", "cfunction", "class", "const", "continue", "declare", "default", "die", "do", "echo", "else", "elseif", "enddeclare", "endfor", "endforeach", "endif", "endswitch", "endwhile", "extends", "extends", "for", "foreach", "function", "global", "if", "implements", "include", "include_once", "interface", "old_function", "or", "require", "require_once", "return", "static", "switch", "throw", "use", "var", "while", "xor"]; - - var access = ["private", "protected", "public"]; - - var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">", "[", "]", "new"]; - - var values = ["this", "true", "false"]; - - brush.push(values, {klass: 'constant'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - brush.push(access, {klass: 'access'}); - - // Variables - brush.push({ - pattern: /\$[a-z_][a-z0-9]*/gi, - klass: 'variable' - }); - - // ClassNames (CamelCase) - brush.push(Syntax.lib.camelCaseType); - brush.push(Syntax.lib.cStyleFunction); - - // Comments - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - brush.push(Syntax.lib.perlStyleComment); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - brush.processes['function'] = Syntax.lib.webLinkProcess("http://www.php.net/manual-lookup.php?pattern="); -}); - diff --git a/public/jquery.syntax.brush.php.js b/public/jquery.syntax.brush.php.js deleted file mode 100644 index cc813a4..0000000 --- a/public/jquery.syntax.brush.php.js +++ /dev/null @@ -1,15 +0,0 @@ -// brush: "php" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.brushes.dependency('php', 'php-script'); - -Syntax.register('php', function(brush) { - brush.push({ - pattern: /(<\?(php)?)((.|\n)*?)(\?>)/gm, - matches: Syntax.extractMatches({klass: 'keyword'}, null, {brush: 'php-script'}, null, {klass: 'keyword'}) - }) -}); - diff --git a/public/jquery.syntax.brush.plain.js b/public/jquery.syntax.brush.plain.js deleted file mode 100644 index 30f4bb8..0000000 --- a/public/jquery.syntax.brush.plain.js +++ /dev/null @@ -1,10 +0,0 @@ -// brush: "plain" aliases: ["text"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('plain', function(brush) { - brush.push(Syntax.lib.webLink); -}); - diff --git a/public/jquery.syntax.brush.protobuf.js b/public/jquery.syntax.brush.protobuf.js deleted file mode 100644 index 1ebd8f3..0000000 --- a/public/jquery.syntax.brush.protobuf.js +++ /dev/null @@ -1,43 +0,0 @@ -// brush: "protobuf" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('protobuf', function(brush) { - var keywords = ["enum", "extend", "extensions", "group", "import", "max", "message", "option", "package", "returns", "rpc", "service", "syntax", "to", "default"]; - brush.push(keywords, {klass: 'keyword'}) - - var values = ["true", "false"]; - brush.push(values, {klass: 'constant'}); - - var types = ["bool", "bytes", "double", "fixed32", "fixed64", "float", "int32", "int64", "sfixed32", "sfixed64", "sint32", "sint64", "string", "uint32", "uint64"]; - brush.push(types, {klass: 'type'}); - - var access = ["optional", "required", "repeated"] - brush.push(access, {klass: 'access'}); - - brush.push(Syntax.lib.camelCaseType); - - // Highlight names of fields - brush.push({ - pattern: /\s+(\w+)\s*=\s*\d+/g, - matches: Syntax.extractMatches({ - klass: 'variable' - }) - }); - - // Comments - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); -}); - diff --git a/public/jquery.syntax.brush.python.js b/public/jquery.syntax.brush.python.js deleted file mode 100644 index 40f6a90..0000000 --- a/public/jquery.syntax.brush.python.js +++ /dev/null @@ -1,44 +0,0 @@ -// brush: "python" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('python', function(brush) { - var keywords = ["and", "as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass", "print", "raise", "return", "try", "while", "with", "yield"]; - - var operators = ["!=", "%", "%=", "&", "&=", "(", ")", "*", "**", "**=", "*=", "+", "+=", ",", "-", "-=", ".", "/", "//", "//=", "/=", ":", ";", "<", "<<", "<<=", "<=", "<>", "=", "==", ">", ">=", ">>", ">>=", "@", "[", "]", "^", "^=", "`", "`", "{", "|", "|=", "}", "~"]; - - // Extracted from http://docs.python.org/library/functions.html - var builtinFunctions = ["abs", "all", "any", "basestring", "bin", "bool", "callable", "chr", "classmethod", "cmp", "compile", "complex", "delattr", "dict", "dir", "divmod", "enumerate", "eval", "execfile", "file", "filter", "float", "format", "frozenset", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "int", "isinstance", "issubclass", "iter", "len", "list", "locals", "long", "map", "max", "min", "next", "object", "oct", "open", "ord", "pow", "print", "property", "range", "raw_input", "reduce", "reload", "repr", "reversed", "round", "set", "setattr", "slice", "sorted", "staticmethod", "str", "sum", "super", "tuple", "type", "type", "unichr", "unicode", "vars", "xrange", "zip", "__import__", "apply", "buffer", "coerce", "intern"]; - - var values = ["self", "True", "False", "None"]; - - brush.push({pattern: /^\s*@\w+/gm, klass: 'decorator'}); - brush.push(values, {klass: 'constant'}); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - brush.push(builtinFunctions, {klass: 'builtin'}); - - // ClassNames (CamelCase) - brush.push(Syntax.lib.camelCaseType); - brush.push(Syntax.lib.cStyleFunction); - - brush.push(Syntax.lib.perlStyleComment); - brush.push({pattern: /(['\"]{3})([^\1])*?\1/gm, klass: 'comment'}); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - brush.processes['function'] = Syntax.lib.webLinkProcess("http://docs.python.org/search.html?q="); - brush.processes['type'] = Syntax.lib.webLinkProcess("http://docs.python.org/search.html?q="); - brush.processes['builtin'] = Syntax.lib.webLinkProcess("http://docs.python.org/search.html?q="); -}); - diff --git a/public/jquery.syntax.brush.ruby.js b/public/jquery.syntax.brush.ruby.js deleted file mode 100644 index 5d37ed1..0000000 --- a/public/jquery.syntax.brush.ruby.js +++ /dev/null @@ -1,77 +0,0 @@ -// brush: "ruby" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.lib.rubyStyleFunction = {pattern: /(?:def\s+|\.)([a-z_][a-z0-9_]+)/gi, matches: Syntax.extractMatches({klass: 'function'})}; - -// We need to emulate negative lookbehind -Syntax.lib.rubyStyleSymbol = {pattern: /([:]?):\w+/g, klass: 'constant', matches: function (match, expr) { - if (match[1] != '') return []; - - return [new Syntax.Match(match.index, match[0].length, expr, match[0])]; -}}; - -Syntax.register('ruby', function(brush) { - var keywords = ["alias", "and", "begin", "break", "case", "class", "def", "define_method", "defined?", "do", "else", "elsif", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or", "raise", "redo", "rescue", "retry", "return", "then", "throw", "undef", "unless", "until", "when", "while", "yield", "block_given?"]; - - var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">"]; - var values = ["self", "super", "true", "false", "nil"]; - - var access = ["private", "protected", "public"]; - - brush.push(access, {klass: 'access'}); - brush.push(values, {klass: 'constant'}); - - // Percent operator statements - brush.push({ - pattern: /(\%[\S])(\{[\s\S]*?\})/g, - matches: Syntax.extractMatches({klass: 'function'}, {klass: 'constant'}) - }); - - brush.push({ - pattern: /`[^`]+`/g, - klass: 'string' - }); - - brush.push({ - pattern: /\#\{([^\}]*)\}/g, - matches: Syntax.extractMatches({ - brush: 'ruby', - only: ['string'] - }), - }); - - // Regular expressions - brush.push(Syntax.lib.perlStyleRegularExpression); - - brush.push({pattern: /(@+|\$)[\w]+/g, klass: 'variable'}); - - brush.push(Syntax.lib.camelCaseType); - brush.push(keywords, {klass: 'keyword'}); - brush.push(operators, {klass: 'operator'}); - - brush.push(Syntax.lib.rubyStyleSymbol); - - // Comments - brush.push(Syntax.lib.perlStyleComment); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - // Functions - brush.push(Syntax.lib.rubyStyleFunction); - brush.push(Syntax.lib.cStyleFunction); - - // brush.processes['function'] = Syntax.lib.webLinkProcess("ruby", true); - // brush.processes['type'] = Syntax.lib.webLinkProcess("ruby", true); -}); - diff --git a/public/jquery.syntax.brush.scala.js b/public/jquery.syntax.brush.scala.js deleted file mode 100644 index 544a26b..0000000 --- a/public/jquery.syntax.brush.scala.js +++ /dev/null @@ -1,44 +0,0 @@ -// brush: "scala" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.brushes.dependency('scala', 'xml'); - -Syntax.register('scala', function(brush) { - var keywords = ["abstract", "do", "finally", "import", "object", "return", "trait", "var", "case", "catch", "class", "else", "extends", "for", "forSome", "if", "lazy", "match", "new", "override", "package", "private", "sealed", "super", "try", "type", "while", "with", "yield", "def", "final", "implicit", "protected", "throw", "val"]; - brush.push(keywords, {klass: 'keyword'}); - - var operators = ["_", ":", "=", "=>", "<-", "<:", "<%", ">:", "#", "@"]; - brush.push(operators, {klass: 'operator'}); - - var constants = ["this", "null", "true", "false"]; - brush.push(constants, {klass: 'constant'}); - - // Strings - brush.push({ - pattern: /"""[\s\S]*?"""/g, - klass: 'string' - }); - - brush.push(Syntax.lib.doubleQuotedString); - - // Functions - brush.push({ - pattern: /(?:def\s+|\.)([a-z_][a-z0-9_]+)/gi, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - brush.push(Syntax.lib.camelCaseType); - - // Types - brush.push(Syntax.lib.cStyleFunction); - - // Comments - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - - brush.derives('xml'); -}); - diff --git a/public/jquery.syntax.brush.smalltalk.js b/public/jquery.syntax.brush.smalltalk.js deleted file mode 100644 index a91200a..0000000 --- a/public/jquery.syntax.brush.smalltalk.js +++ /dev/null @@ -1,29 +0,0 @@ -// brush: "smalltalk" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('smalltalk', function(brush) { - var operators = ["[", "]", "|", ":=", "."]; - - var values = ["self", "super", "true", "false", "nil"]; - - brush.push(values, {klass: 'constant'}); - brush.push(operators, {klass: 'operator'}); - - // Objective-C style functions - brush.push({pattern: /\w+:/g, klass: 'function'}); - - // Camelcase Types - brush.push(Syntax.lib.camelCaseType); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); -}); diff --git a/public/jquery.syntax.brush.sql.js b/public/jquery.syntax.brush.sql.js deleted file mode 100644 index 8f00aa0..0000000 --- a/public/jquery.syntax.brush.sql.js +++ /dev/null @@ -1,31 +0,0 @@ -// brush: "sql" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.lib.sqlStyleComment = {pattern: /-- .*$/gm, klass: 'comment', allow: ['href']}; - -Syntax.register('sql', function(brush) { - var keywords = ["A", "ABORT", "ABS", "ABSOLUTE", "ACCESS", "ACTION", "ADA", "ADD", "ADMIN", "AFTER", "AGGREGATE", "ALIAS", "ALL", "ALLOCATE", "ALSO", "ALTER", "ALWAYS", "ANALYSE", "ANALYZE", "AND", "ANY", "ARE", "ARRAY", "AS", "ASC", "ASENSITIVE", "ASSERTION", "ASSIGNMENT", "ASYMMETRIC", "AT", "ATOMIC", "ATTRIBUTE", "ATTRIBUTES", "AUDIT", "AUTHORIZATION", "AUTO_INCREMENT", "AVG", "AVG_ROW_LENGTH", "BACKUP", "BACKWARD", "BEFORE", "BEGIN", "BERNOULLI", "BETWEEN", "BIGINT", "BINARY", "BIT", "BIT_LENGTH", "BITVAR", "BLOB", "BOOL", "BOOLEAN", "BOTH", "BREADTH", "BREAK", "BROWSE", "BULK", "BY", "C", "CACHE", "CALL", "CALLED", "CARDINALITY", "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CATALOG_NAME", "CEIL", "CEILING", "CHAIN", "CHANGE", "CHAR", "CHAR_LENGTH", "CHARACTER", "CHARACTER_LENGTH", "CHARACTER_SET_CATALOG", "CHARACTER_SET_NAME", "CHARACTER_SET_SCHEMA", "CHARACTERISTICS", "CHARACTERS", "CHECK", "CHECKED", "CHECKPOINT", "CHECKSUM", "CLASS", "CLASS_ORIGIN", "CLOB", "CLOSE", "CLUSTER", "CLUSTERED", "COALESCE", "COBOL", "COLLATE", "COLLATION", "COLLATION_CATALOG", "COLLATION_NAME", "COLLATION_SCHEMA", "COLLECT", "COLUMN", "COLUMN_NAME", "COLUMNS", "COMMAND_FUNCTION", "COMMAND_FUNCTION_CODE", "COMMENT", "COMMIT", "COMMITTED", "COMPLETION", "COMPRESS", "COMPUTE", "CONDITION", "CONDITION_NUMBER", "CONNECT", "CONNECTION", "CONNECTION_NAME", "CONSTRAINT", "CONSTRAINT_CATALOG", "CONSTRAINT_NAME", "CONSTRAINT_SCHEMA", "CONSTRAINTS", "CONSTRUCTOR", "CONTAINS", "CONTAINSTABLE", "CONTINUE", "CONVERSION", "CONVERT", "COPY", "CORR", "CORRESPONDING", "COUNT", "COVAR_POP", "COVAR_SAMP", "CREATE", "CREATEDB", "CREATEROLE", "CREATEUSER", "CROSS", "CSV", "CUBE", "CUME_DIST", "CURRENT", "CURRENT_DATE", "CURRENT_DEFAULT_TRANSFORM_GROUP", "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_TRANSFORM_GROUP_FOR_TYPE", "CURRENT_USER", "CURSOR", "CURSOR_NAME", "CYCLE", "DATA", "DATABASE", "DATABASES", "DATE", "DATETIME", "DATETIME_INTERVAL_CODE", "DATETIME_INTERVAL_PRECISION", "DAY", "DAY_HOUR", "DAY_MICROSECOND", "DAY_MINUTE", "DAY_SECOND", "DAYOFMONTH", "DAYOFWEEK", "DAYOFYEAR", "DBCC", "DEALLOCATE", "DEC", "DECIMAL", "DECLARE", "DEFAULT", "DEFAULTS", "DEFERRABLE", "DEFERRED", "DEFINED", "DEFINER", "DEGREE", "DELAY_KEY_WRITE", "DELAYED", "DELETE", "DELIMITER", "DELIMITERS", "DENSE_RANK", "DENY", "DEPTH", "DEREF", "DERIVED", "DESC", "DESCRIBE", "DESCRIPTOR", "DESTROY", "DESTRUCTOR", "DETERMINISTIC", "DIAGNOSTICS", "DICTIONARY", "DISABLE", "DISCONNECT", "DISK", "DISPATCH", "DISTINCT", "DISTINCTROW", "DISTRIBUTED", "DIV", "DO", "DOMAIN", "DOUBLE", "DROP", "DUAL", "DUMMY", "DUMP", "DYNAMIC", "DYNAMIC_FUNCTION", "DYNAMIC_FUNCTION_CODE", "EACH", "ELEMENT", "ELSE", "ELSEIF", "ENABLE", "ENCLOSED", "ENCODING", "ENCRYPTED", "END", "END-EXEC", "ENUM", "EQUALS", "ERRLVL", "ESCAPE", "ESCAPED", "EVERY", "EXCEPT", "EXCEPTION", "EXCLUDE", "EXCLUDING", "EXCLUSIVE", "EXEC", "EXECUTE", "EXISTING", "EXISTS", "EXIT", "EXP", "EXPLAIN", "EXTERNAL", "EXTRACT", "FALSE", "FETCH", "FIELDS", "FILE", "FILLFACTOR", "FILTER", "FINAL", "FIRST", "FLOAT", "FLOAT4", "FLOAT8", "FLOOR", "FLUSH", "FOLLOWING", "FOR", "FORCE", "FOREIGN", "FORTRAN", "FORWARD", "FOUND", "FREE", "FREETEXT", "FREETEXTTABLE", "FREEZE", "FROM", "FULL", "FULLTEXT", "FUNCTION", "FUSION", "G", "GENERAL", "GENERATED", "GET", "GLOBAL", "GO", "GOTO", "GRANT", "GRANTED", "GRANTS", "GREATEST", "GROUP", "GROUPING", "HANDLER", "HAVING", "HEADER", "HEAP", "HIERARCHY", "HIGH_PRIORITY", "HOLD", "HOLDLOCK", "HOST", "HOSTS", "HOUR", "HOUR_MICROSECOND", "HOUR_MINUTE", "HOUR_SECOND", "IDENTIFIED", "IDENTITY", "IDENTITY_INSERT", "IDENTITYCOL", "IF", "IGNORE", "ILIKE", "IMMEDIATE", "IMMUTABLE", "IMPLEMENTATION", "IMPLICIT", "IN", "INCLUDE", "INCLUDING", "INCREMENT", "INDEX", "INDICATOR", "INFILE", "INFIX", "INHERIT", "INHERITS", "INITIAL", "INITIALIZE", "INITIALLY", "INNER", "INOUT", "INPUT", "INSENSITIVE", "INSERT", "INSERT_ID", "INSTANCE", "INSTANTIABLE", "INSTEAD", "INT", "INT1", "INT2", "INT3", "INT4", "INT8", "INTEGER", "INTERSECT", "INTERSECTION", "INTERVAL", "INTO", "INVOKER", "IS", "ISAM", "ISNULL", "ISOLATION", "ITERATE", "JOIN", "K", "KEY", "KEY_MEMBER", "KEY_TYPE", "KEYS", "KILL", "LANCOMPILER", "LANGUAGE", "LARGE", "LAST", "LAST_INSERT_ID", "LATERAL", "LEADING", "LEAST", "LEAVE", "LEFT", "LENGTH", "LESS", "LEVEL", "LIKE", "LIMIT", "LINENO", "LINES", "LISTEN", "LN", "LOAD", "LOCAL", "LOCALTIME", "LOCALTIMESTAMP", "LOCATION", "LOCATOR", "LOCK", "LOGIN", "LOGS", "LONG", "LONGBLOB", "LONGTEXT", "LOOP", "LOW_PRIORITY", "LOWER", "M", "MAP", "MATCH", "MATCHED", "MAX", "MAX_ROWS", "MAXEXTENTS", "MAXVALUE", "MEDIUMBLOB", "MEDIUMINT", "MEDIUMTEXT", "MEMBER", "MERGE", "MESSAGE_LENGTH", "MESSAGE_OCTET_LENGTH", "MESSAGE_TEXT", "METHOD", "MIDDLEINT", "MIN", "MIN_ROWS", "MINUS", "MINUTE", "MINUTE_MICROSECOND", "MINUTE_SECOND", "MINVALUE", "MLSLABEL", "MOD", "MODE", "MODIFIES", "MODIFY", "MODULE", "MONTH", "MONTHNAME", "MORE", "MOVE", "MULTISET", "MUMPS", "MYISAM", "NAMES", "NATIONAL", "NATURAL", "NCHAR", "NCLOB", "NESTING", "NEW", "NEXT", "NO", "NO_WRITE_TO_BINLOG", "NOAUDIT", "NOCHECK", "NOCOMPRESS", "NOCREATEDB", "NOCREATEROLE", "NOCREATEUSER", "NOINHERIT", "NOLOGIN", "NONCLUSTERED", "NONE", "NORMALIZE", "NORMALIZED", "NOSUPERUSER", "NOT", "NOTHING", "NOTIFY", "NOTNULL", "NOWAIT", "NULL", "NULLABLE", "NULLIF", "NULLS", "NUMBER", "NUMERIC", "OBJECT", "OCTET_LENGTH", "OCTETS", "OF", "OFF", "OFFLINE", "OFFSET", "OFFSETS", "OIDS", "OLD", "ON", "ONLINE", "ONLY", "OPEN", "OPENDATASOURCE", "OPENQUERY", "OPENROWSET", "OPENXML", "OPERATION", "OPERATOR", "OPTIMIZE", "OPTION", "OPTIONALLY", "OPTIONS", "OR", "ORDER", "ORDERING", "ORDINALITY", "OTHERS", "OUT", "OUTER", "OUTFILE", "OUTPUT", "OVER", "OVERLAPS", "OVERLAY", "OVERRIDING", "OWNER", "PACK_KEYS", "PAD", "PARAMETER", "PARAMETER_MODE", "PARAMETER_NAME", "PARAMETER_ORDINAL_POSITION", "PARAMETER_SPECIFIC_CATALOG", "PARAMETER_SPECIFIC_NAME", "PARAMETER_SPECIFIC_SCHEMA", "PARAMETERS", "PARTIAL", "PARTITION", "PASCAL", "PASSWORD", "PATH", "PCTFREE", "PERCENT", "PERCENT_RANK", "PERCENTILE_CONT", "PERCENTILE_DISC", "PLACING", "PLAN", "PLI", "POSITION", "POSTFIX", "POWER", "PRECEDING", "PRECISION", "PREFIX", "PREORDER", "PREPARE", "PREPARED", "PRESERVE", "PRIMARY", "PRINT", "PRIOR", "PRIVILEGES", "PROC", "PROCEDURAL", "PROCEDURE", "PROCESS", "PROCESSLIST", "PUBLIC", "PURGE", "QUOTE", "RAID0", "RAISERROR", "RANGE", "RANK", "RAW", "READ", "READS", "READTEXT", "REAL", "RECHECK", "RECONFIGURE", "RECURSIVE", "REF", "REFERENCES", "REFERENCING", "REGEXP", "REGR_AVGX", "REGR_AVGY", "REGR_COUNT", "REGR_INTERCEPT", "REGR_R2", "REGR_SLOPE", "REGR_SXX", "REGR_SXY", "REGR_SYY", "REINDEX", "RELATIVE", "RELEASE", "RELOAD", "RENAME", "REPEAT", "REPEATABLE", "REPLACE", "REPLICATION", "REQUIRE", "RESET", "RESIGNAL", "RESOURCE", "RESTART", "RESTORE", "RESTRICT", "RESULT", "RETURN", "RETURNED_CARDINALITY", "RETURNED_LENGTH", "RETURNED_OCTET_LENGTH", "RETURNED_SQLSTATE", "RETURNS", "REVOKE", "RIGHT", "RLIKE", "ROLE", "ROLLBACK", "ROLLUP", "ROUTINE", "ROUTINE_CATALOG", "ROUTINE_NAME", "ROUTINE_SCHEMA", "ROW", "ROW_COUNT", "ROW_NUMBER", "ROWCOUNT", "ROWGUIDCOL", "ROWID", "ROWNUM", "ROWS", "RULE", "SAVE", "SAVEPOINT", "SCALE", "SCHEMA", "SCHEMA_NAME", "SCHEMAS", "SCOPE", "SCOPE_CATALOG", "SCOPE_NAME", "SCOPE_SCHEMA", "SCROLL", "SEARCH", "SECOND", "SECOND_MICROSECOND", "SECTION", "SECURITY", "SELECT", "SELF", "SENSITIVE", "SEPARATOR", "SEQUENCE", "SERIALIZABLE", "SERVER_NAME", "SESSION", "SESSION_USER", "SET", "SETOF", "SETS", "SETUSER", "SHARE", "SHOW", "SHUTDOWN", "SIGNAL", "SIMILAR", "SIMPLE", "SIZE", "SMALLINT", "SOME", "SONAME", "SOURCE", "SPACE", "SPATIAL", "SPECIFIC", "SPECIFIC_NAME", "SPECIFICTYPE", "SQL", "SQL_BIG_RESULT", "SQL_BIG_SELECTS", "SQL_BIG_TABLES", "SQL_CALC_FOUND_ROWS", "SQL_LOG_OFF", "SQL_LOG_UPDATE", "SQL_LOW_PRIORITY_UPDATES", "SQL_SELECT_LIMIT", "SQL_SMALL_RESULT", "SQL_WARNINGS", "SQLCA", "SQLCODE", "SQLERROR", "SQLEXCEPTION", "SQLSTATE", "SQLWARNING", "SQRT", "SSL", "STABLE", "START", "STARTING", "STATE", "STATEMENT", "STATIC", "STATISTICS", "STATUS", "STDDEV_POP", "STDDEV_SAMP", "STDIN", "STDOUT", "STORAGE", "STRAIGHT_JOIN", "STRICT", "STRING", "STRUCTURE", "STYLE", "SUBCLASS_ORIGIN", "SUBLIST", "SUBMULTISET", "SUBSTRING", "SUCCESSFUL", "SUM", "SUPERUSER", "SYMMETRIC", "SYNONYM", "SYSDATE", "SYSID", "SYSTEM", "SYSTEM_USER", "TABLE", "TABLE_NAME", "TABLES", "TABLESAMPLE", "TABLESPACE", "TEMP", "TEMPLATE", "TEMPORARY", "TERMINATE", "TERMINATED", "TEXT", "TEXTSIZE", "THAN", "THEN", "TIES", "TIME", "TIMESTAMP", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", "TINYBLOB", "TINYINT", "TINYTEXT", "TO", "TOAST", "TOP", "TOP_LEVEL_COUNT", "TRAILING", "TRAN", "TRANSACTION", "TRANSACTION_ACTIVE", "TRANSACTIONS_COMMITTED", "TRANSACTIONS_ROLLED_BACK", "TRANSFORM", "TRANSFORMS", "TRANSLATE", "TRANSLATION", "TREAT", "TRIGGER", "TRIGGER_CATALOG", "TRIGGER_NAME", "TRIGGER_SCHEMA", "TRIM", "TRUE", "TRUNCATE", "TRUSTED", "TSEQUAL", "TYPE", "UESCAPE", "UID", "UNBOUNDED", "UNCOMMITTED", "UNDER", "UNDO", "UNENCRYPTED", "UNION", "UNIQUE", "UNKNOWN", "UNLISTEN", "UNLOCK", "UNNAMED", "UNNEST", "UNSIGNED", "UNTIL", "UPDATE", "UPDATETEXT", "UPPER", "USAGE", "USE", "USER", "USER_DEFINED_TYPE_CATALOG", "USER_DEFINED_TYPE_CODE", "USER_DEFINED_TYPE_NAME", "USER_DEFINED_TYPE_SCHEMA", "USING", "UTC_DATE", "UTC_TIME", "UTC_TIMESTAMP", "VACUUM", "VALID", "VALIDATE", "VALIDATOR", "VALUE", "VALUES", "VAR_POP", "VAR_SAMP", "VARBINARY", "VARCHAR", "VARCHAR2", "VARCHARACTER", "VARIABLE", "VARIABLES", "VARYING", "VERBOSE", "VIEW", "VOLATILE", "WAITFOR", "WHEN", "WHENEVER", "WHERE", "WHILE", "WIDTH_BUCKET", "WINDOW", "WITH", "WITHIN", "WITHOUT", "WORK", "WRITE", "WRITETEXT", "X509", "XOR", "YEAR", "YEAR_MONTH", "ZEROFILL", "ZONE"]; - - var operators = ["=", "!=", "<", ">", "<=", ">=", "+", "-", "*", "/", "%"]; - - brush.push(operators, {klass: 'operator'}); - - brush.push(Syntax.lib.sqlStyleComment); - - brush.push(keywords, {klass: 'keyword', options: 'gi'}); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - brush.push(Syntax.lib.webLink); -}); - diff --git a/public/jquery.syntax.brush.super-collider.js b/public/jquery.syntax.brush.super-collider.js deleted file mode 100644 index 4064ce1..0000000 --- a/public/jquery.syntax.brush.super-collider.js +++ /dev/null @@ -1,57 +0,0 @@ -// brush: "super-collider" aliases: ["sc"] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('super-collider', function(brush) { - var keywords = ["const", "arg", "classvar", "var"]; - brush.push(keywords, {klass: 'keyword'}); - - var operators = ["`", "+", "@", ":", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">"]; - brush.push(operators, {klass: 'operator'}); - - var values = ["thisFunctionDef", "thisFunction", "thisMethod", "thisProcess", "thisThread", "this", "super", "true", "false", "nil", "inf"]; - brush.push(values, {klass: 'constant'}); - - brush.push(Syntax.lib.camelCaseType); - - // Single Characters - brush.push({ - pattern: /\$(\\)?./g, - klass: "constant" - }); - - // Symbols - brush.push({ - pattern: /\\[a-z_][a-z0-9_]*/gi, - klass: "symbol" - }); - - brush.push({ - pattern: /'[^']+'/g, - klass: "symbol" - }); - - // Comments - brush.push(Syntax.lib.cStyleComment); - brush.push(Syntax.lib.cppStyleComment); - brush.push(Syntax.lib.webLink); - - // Strings - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - brush.push(Syntax.lib.stringEscape); - - // Numbers - brush.push(Syntax.lib.decimalNumber); - brush.push(Syntax.lib.hexNumber); - - // Functions - brush.push({ - pattern: /(?:\.)([a-z_][a-z0-9_]*)/gi, - matches: Syntax.extractMatches({klass: 'function'}) - }); - - brush.push(Syntax.lib.cStyleFunction); -}); diff --git a/public/jquery.syntax.brush.xml.js b/public/jquery.syntax.brush.xml.js deleted file mode 100644 index 03bbbf2..0000000 --- a/public/jquery.syntax.brush.xml.js +++ /dev/null @@ -1,50 +0,0 @@ -// brush: "xml" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.lib.xmlEntity = {pattern: /&\w+;/g, klass: 'entity'}; -Syntax.lib.xmlPercentEscape = {pattern: /(%[0-9a-f]{2})/gi, klass: 'percent-escape', only: ['string']}; - -Syntax.register('xml-tag', function(brush) { - brush.push({ - pattern: /<\/?((?:[^:\s>]+:)?)([^\s>]+)(\s[^>]*)?\/?>/g, - matches: Syntax.extractMatches({klass: 'namespace'}, {klass: 'tag-name'}) - }); - - brush.push({ - pattern: /([^=\s]+)=(".*?"|'.*?'|[^\s>]+)/g, - matches: Syntax.extractMatches({klass: 'attribute', only: ['tag']}, {klass: 'string', only: ['tag']}) - }); - - brush.push(Syntax.lib.xmlEntity); - brush.push(Syntax.lib.xmlPercentEscape); - - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); -}); - -Syntax.register('xml', function(brush) { - brush.push({ - pattern: /()/gm, - matches: Syntax.extractMatches( - {klass: 'cdata', allow: ['cdata-content', 'cdata-tag']}, - {klass: 'cdata-tag'}, - {klass: 'cdata-content'}, - {klass: 'cdata-tag'} - ) - }); - - brush.push(Syntax.lib.xmlComment); - - brush.push({ - pattern: /<[^>\-\s]([^>'"!\/;\?@\[\]^`\{\}\|]|"[^"]*"|'[^']')*[\/?]?>/g, - brush: 'xml-tag' - }); - - brush.push(Syntax.lib.xmlEntity); - brush.push(Syntax.lib.xmlPercentEscape); - - brush.push(Syntax.lib.webLink); -}); diff --git a/public/jquery.syntax.brush.yaml.js b/public/jquery.syntax.brush.yaml.js deleted file mode 100644 index 9920770..0000000 --- a/public/jquery.syntax.brush.yaml.js +++ /dev/null @@ -1,29 +0,0 @@ -// brush: "yaml" aliases: [] - -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.register('yaml', function(brush) { - brush.push({ - pattern: /^\s*#.*$/gm, - klass: 'comment', - allow: ['href'] - }); - - brush.push(Syntax.lib.singleQuotedString); - brush.push(Syntax.lib.doubleQuotedString); - - brush.push({ - pattern: /(&|\*)[a-z0-9]+/gi, - klass: 'constant' - }); - - brush.push({ - pattern: /(.*?):/gi, - matches: Syntax.extractMatches({klass: 'keyword'}) - }); - - brush.push(Syntax.lib.webLink); -}); - diff --git a/public/jquery.syntax.cache.js b/public/jquery.syntax.cache.js deleted file mode 100644 index 664c98e..0000000 --- a/public/jquery.syntax.cache.js +++ /dev/null @@ -1,67 +0,0 @@ -// This file is automatically generated. Any changes may be lost. -// The following declarations describes all resources that might be loaded dynamically. - -// Brush Aliases -Syntax.alias("apache", []); -Syntax.alias("applescript", []); -Syntax.alias("assembly", ["asm"]); -Syntax.alias("bash-script", []); -Syntax.alias("bash", []); -Syntax.alias("basic", ['vb']); -Syntax.alias("clang", ["cpp", "c++", "c", "objective-c"]); -Syntax.alias("csharp", ["c-sharp", "c#"]); -Syntax.alias("css", []); -Syntax.alias("diff", ["patch"]); -Syntax.alias("go", []); -Syntax.alias("haskell", []); -Syntax.alias("html", []); -Syntax.alias("io", []); -Syntax.alias("java", []); -Syntax.alias("javascript", ["js", "actionscript"]); -Syntax.alias("kai", []); -Syntax.alias("lisp", ['scheme', 'clojure']); -Syntax.alias("lua", []); -Syntax.alias("ocaml", ["ml", "sml", "fsharp"]); -Syntax.alias("ooc", []); -Syntax.alias("pascal", ["delphi"]); -Syntax.alias("perl5", []); -Syntax.alias("php-script", []); -Syntax.alias("php", []); -Syntax.alias("plain", ["text"]); -Syntax.alias("protobuf", []); -Syntax.alias("python", []); -Syntax.alias("ruby", []); -Syntax.alias("scala", []); -Syntax.alias("smalltalk", []); -Syntax.alias("sql", []); -Syntax.alias("super-collider", ["sc"]); -Syntax.alias("xml", []); -Syntax.alias("yaml", []); - -// CSS Extensions -Syntax.styles["jquery.syntax.layout.list"] = ["base/jquery.syntax.layout.list.css"]; -Syntax.styles["jquery.syntax.layout.inline"] = ["base/jquery.syntax.layout.inline.css", "modern/jquery.syntax.layout.inline.css"]; -Syntax.styles["jquery.syntax.brush.ruby"] = ["base/jquery.syntax.brush.ruby.css"]; -Syntax.styles["jquery.syntax.layout.plain"] = ["base/jquery.syntax.layout.plain.css", "modern/jquery.syntax.layout.plain.css"]; -Syntax.styles["jquery.syntax.brush.xml"] = ["base/jquery.syntax.brush.xml.css"]; -Syntax.styles["jquery.syntax.brush.bash-script"] = ["base/jquery.syntax.brush.bash-script.css"]; -Syntax.styles["jquery.syntax.brush.assembly"] = ["base/jquery.syntax.brush.assembly.css"]; -Syntax.styles["jquery.syntax.brush.python"] = ["base/jquery.syntax.brush.python.css"]; -Syntax.styles["jquery.syntax.brush.css"] = ["base/jquery.syntax.brush.css.css"]; -Syntax.styles["jquery.syntax.brush.clang"] = ["base/jquery.syntax.brush.clang.css"]; -Syntax.styles["jquery.syntax.brush.applescript"] = ["base/jquery.syntax.brush.applescript.css"]; -Syntax.styles["jquery.syntax.layout.fixed"] = ["base/jquery.syntax.layout.fixed.css"]; -Syntax.styles["jquery.syntax.layout.editor"] = ["base/jquery.syntax.layout.editor.css", "modern/jquery.syntax.layout.editor.css"]; -Syntax.styles["jquery.syntax.brush.protobuf"] = ["base/jquery.syntax.brush.protobuf.css"]; -Syntax.styles["jquery.syntax.layout.table"] = ["base/jquery.syntax.layout.table.css"]; -Syntax.styles["jquery.syntax.brush.bash"] = ["base/jquery.syntax.brush.bash.css"]; -Syntax.styles["jquery.syntax.core"] = ["base/jquery.syntax.core.css", "bright/jquery.syntax.core.css"]; -Syntax.styles["jquery.syntax.brush.html"] = ["base/jquery.syntax.brush.html.css"]; -Syntax.styles["jquery.syntax.brush.ocaml"] = ["base/jquery.syntax.brush.ocaml.css"]; -Syntax.styles["jquery.syntax.brush.diff"] = ["base/jquery.syntax.brush.diff.css"]; -Syntax.styles["jquery.syntax.brush.apache"] = ["base/jquery.syntax.brush.apache.css"]; - -// Theme Configuration -Syntax.themes["base"] = [] -Syntax.themes["bright"] = ["base"] -Syntax.themes["modern"] = ["base"] diff --git a/public/jquery.syntax.core.js b/public/jquery.syntax.core.js deleted file mode 100644 index ecc71f8..0000000 --- a/public/jquery.syntax.core.js +++ /dev/null @@ -1,1177 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -if (!RegExp.prototype.indexOf) { - RegExp.indexOf = function (match, index) { - return match[0].indexOf(match[index]) + match.index; - }; -} - -if (!RegExp.prototype.escape) { - RegExp.escape = function (pattern) { - return pattern.replace(/[\-\[\]{}()*+?.\\\^$|,#\s]/g, "\\$&"); - }; -} - -if (!String.prototype.repeat) { - String.prototype.repeat = function(l) { - return new Array(l+1).join(this); - }; -} - -// Return the inner text of an element - must preserve whitespace. -// Avoid returning \r characters. -Syntax.innerText = function(element) { - var text; - - if (!element) { - return ""; - } - - if (element.nodeName == 'BR') { - return '\n'; - } else if (element.textContent) { - // W3C: FF, Safari, Chrome, etc. - text = element.textContent; - } else if (document.body.innerText) { - // IE, other older browsers. - text = element.innerText; - } - - return text.replace(/\r\n?/g, '\n'); -} - -// Convert to stack based implementation -Syntax.extractElementMatches = function (elems, offset, tabWidth) { - var matches = [], current = [elems]; - offset = offset || 0; - tabWidth = tabWidth || 4; - - (function (elems) { - for (var i = 0; elems[i]; i++) { - var text = null, elem = elems[i]; - - if (elem.nodeType === 3 || elem.nodeType === 4) { - offset += elem.nodeValue.length; - - } else if (elem.nodeType === 1) { - var text = Syntax.innerText(elem); - - matches.push(new Syntax.Match(offset, text.length, { - klass: elem.className, - force: true, - element: elem, - allow: '*' - }, text)); - } - - // Traverse everything, except comment nodes - if (elem.nodeType !== 8 && elem.children) { - arguments.callee(elem.childNodes, offset); - } - } - })(elems); - - // Remove the top level element, since this will be recreated based on the supplied configuration. - // Maybe there is a better way to achieve this? - matches.shift(); - - return matches; -} - -// Basic layout doesn't do anything e.g. identity layout. -Syntax.layouts.preformatted = function (options, html, container) { - return html; -}; - -Syntax.modeLineOptions = { - 'tab-width': function(name, value, options) { options.tabWidth = parseInt(value, 10); } -}; - -// Should be obvious right? -Syntax.convertTabsToSpaces = function (text, tabSize) { - var space = [], pattern = /\r|\n|\t/g, tabOffset = 0, offsets = [], totalOffset = 0; - tabSize = tabSize || 4 - - for (var i = ""; i.length <= tabSize; i = i + " ") { - space.push(i); - } - - text = text.replace(pattern, function(match) { - var offset = arguments[arguments.length - 2]; - if (match === "\r" || match === "\n") { - tabOffset = -(offset + 1); - return match; - } else { - var width = tabSize - ((tabOffset + offset) % tabSize); - tabOffset += width - 1; - - // Any match after this offset has been shifted right by totalOffset - totalOffset += width - 1 - offsets.push([offset, width, totalOffset]); - - return space[width]; - } - }); - - return {text: text, offsets: offsets}; -}; - -// This function converts from a compressed set of offsets of the form: -// [ -// [offset, width, totalOffset], -// ... -// ] -// This means that at a $offset, a tab (single character) was expanded to $width -// single space characters. -// This function produces a lookup table of offsets, where a given character offset -// is mapped to how far the character has been offset. -Syntax.convertToLinearOffsets = function (offsets, length) { - var current = 0, changes = []; - - // Anything with offset after offset[current][0] but smaller than offset[current+1][0] - // has been shifted right by offset[current][2] - for (var i = 0; i < length; i++) { - if (offsets[current] && i > offsets[current][0]) { - // Is there a next offset? - if (offsets[current+1]) { - // Is the index less than the start of the next offset? - if (i <= offsets[current+1][0]) { - changes.push(offsets[current][2]); - } else { - // If so, move to the next offset. - current += 1; - i -= 1; - } - } else { - // If there is no next offset we assume this one to the end. - changes.push(offsets[current][2]); - } - } else { - changes.push(changes[changes.length-1] || 0); - } - } - - return changes; -} - -// Used for tab expansion process, by shifting matches when tab charaters were converted to -// spaces. -Syntax.updateMatchesWithOffsets = function (matches, linearOffsets, text) { - (function (matches) { - for (var i = 0; i < matches.length; i++) { - var match = matches[i]; - - // Calculate the new start and end points - var offset = match.offset + linearOffsets[match.offset]; - var end = match.offset + match.length; - end += linearOffsets[end]; - - // Start, Length, Text - match.adjust(linearOffsets[match.offset], end - offset, text); - - if (match.children.length > 0) - arguments.callee(match.children); - } - })(matches); - - return matches; -}; - -// A helper function which automatically matches expressions with capture groups from the regular expression match. -// Each argument position corresponds to the same index regular expression group. -// Or, override by providing rule.index -Syntax.extractMatches = function() { - var rules = arguments; - - return function(match, expr) { - var matches = []; - - for (var i = 0; i < rules.length; i += 1) { - var rule = rules[i], index = i+1; - - if (rule == null) { - continue; - } - - if (typeof(rule.index) != 'undefined') { - index = rule.index; - } - - if (rule.debug) { - Syntax.log("extractMatches", rule, index, match[index], match); - } - - if (match[index].length > 0) { - if (rule.brush) { - matches.push(Syntax.Brush.buildTree(rule, match[index], RegExp.indexOf(match, index))); - } else { - var expression = jQuery.extend({owner: expr.owner}, rule); - - matches.push(new Syntax.Match(RegExp.indexOf(match, index), match[index].length, expression, match[index])); - } - } - } - - return matches; - }; -}; - -// Used to create processing functions that automatically link to remote documentation. -Syntax.lib.webLinkProcess = function (queryURI, lucky) { - if (lucky) { - queryURI = "http://www.google.com/search?btnI=I&q=" + encodeURIComponent(queryURI + " "); - } - - return function (element, match, options) { - // Per-code block linkification control. - if (options.linkify === false) - return element; - - var a = document.createElement('a'); - a.href = queryURI + encodeURIComponent(Syntax.innerText(element)); - a.className = element.className; - - // Move children from to - while (element.childNodes.length > 0) - a.appendChild(element.childNodes[0]); - - return a; - }; -}; - -// Global brush registration function. -Syntax.register = function (name, callback) { - var brush = Syntax.brushes[name] = new Syntax.Brush(); - brush.klass = name; - - callback(brush); -}; - -// Library of helper patterns -Syntax.lib.cStyleComment = {pattern: /\/\*[\s\S]*?\*\//gm, klass: 'comment', allow: ['href']}; -Syntax.lib.cppStyleComment = {pattern: /\/\/.*$/gm, klass: 'comment', allow: ['href']}; -Syntax.lib.perlStyleComment = {pattern: /#.*$/gm, klass: 'comment', allow: ['href']}; - -Syntax.lib.perlStyleRegularExpression = {pattern: /\B\/([^\/]|\\\/)*?\/[a-z]*(?=\s*($|[^\w\s'"\(]))/gm, klass: 'constant', incremental: true}; - -Syntax.lib.cStyleFunction = {pattern: /([a-z_][a-z0-9_]*)\s*\(/gi, matches: Syntax.extractMatches({klass: 'function'})}; -Syntax.lib.camelCaseType = {pattern: /\b_*[A-Z][\w]*\b/g, klass: 'type'}; -Syntax.lib.cStyleType = {pattern: /\b[_a-z][_\w]*_t\b/gi, klass: 'type'}; - -Syntax.lib.xmlComment = {pattern: /(<|<)!--[\s\S]*?--(>|>)/gm, klass: 'comment'}; -Syntax.lib.webLink = {pattern: /\w+:\/\/[\w\-.\/?%&=@:;#]*/g, klass: 'href'}; - -Syntax.lib.hexNumber = {pattern: /\b0x[0-9a-fA-F]+/g, klass: 'constant'}; -Syntax.lib.decimalNumber = {pattern: /\b[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/g, klass: 'constant'}; - -Syntax.lib.doubleQuotedString = {pattern: /"([^\\"\n]|\\.)*"/g, klass: 'string'}; -Syntax.lib.singleQuotedString = {pattern: /'([^\\'\n]|\\.)*'/g, klass: 'string'}; -Syntax.lib.multiLineDoubleQuotedString = {pattern: /"([^\\"]|\\.)*"/g, klass: 'string'}; -Syntax.lib.multiLineSingleQuotedString = {pattern: /'([^\\']|\\.)*'/g, klass: 'string'}; -Syntax.lib.stringEscape = {pattern: /\\./g, klass: 'escape', only: ['string']}; - -// Main match constructor. Make sure value is the correct size. -Syntax.Match = function (offset, length, expression, value) { - this.offset = offset; - this.endOffset = offset + length; - this.length = length; - this.expression = expression; - this.value = value; - this.children = []; - this.parent = null; - - // When a node is bisected, this points to the next part. - this.next = null; -}; - -// Shifts an entire tree forward or backwards. -Syntax.Match.prototype.shift = function (offset, text) { - this.adjust(offset, null, text); - - for (var i = 0; i < this.children.length; i++) { - this.children[i].shift(offset, text) - } -}; - -// C the current match to have different offset and length. -Syntax.Match.prototype.adjust = function (offset, length, text) { - this.offset += offset; - this.endOffset += offset; - - if (length) { - this.length = length; - this.endOffset = this.offset + length; - } - - if (text) { - this.value = text.substr(this.offset, this.length); - } -}; - -// Sort helper for sorting matches in forward order (e.g. same as the text that they were extracted from) -Syntax.Match.sort = function (a,b) { - return (a.offset - b.offset) || (b.length - a.length); -}; - -// Is the given match contained in the range of the parent match? -Syntax.Match.prototype.contains = function (match) { - return (match.offset >= this.offset) && (match.endOffset <= this.endOffset); -}; - -// Reduce a givent tree node into an html node. -Syntax.Match.defaultReduceCallback = function (node, container) { - // We avoid using jQuery in this function since it is incredibly performance sensitive. - // Using jQuery jQuery.fn.append() can reduce performance by as much as 1/3rd. - if (typeof(node) === 'string') { - node = document.createTextNode(node); - } - - container.appendChild(node); -}; - -// Convert a tree of matches into some flat form (typically HTML nodes). -Syntax.Match.prototype.reduce = function (append, process) { - var start = this.offset; - var container = document.createElement('span'); - - append = append || Syntax.Match.defaultReduceCallback; - - if (this.expression && this.expression.klass) { - if (container.className.length > 0) - container.className += ' '; - - container.className += this.expression.klass; - } - - for (var i = 0; i < this.children.length; i += 1) { - var child = this.children[i], end = child.offset; - - if (child.offset < this.offset) { - Syntax.log("Syntax Warning: Offset of child", child, "is before offset of parent", this); - } - - var text = this.value.substr(start - this.offset, end - start); - - append(text, container); - append(child.reduce(append, process), container); - - start = child.endOffset; - } - - if (start === this.offset) { - append(this.value, container); - } else if (start < this.endOffset) { - append(this.value.substr(start - this.offset, this.endOffset - start), container); - } else if (start > this.endOffset) { - Syntax.log("Syntax Warning: Start position " + start + " exceeds end of value " + this.endOffset); - } - - if (process) { - container = process(container, this); - } - - return container; -}; - -// Main nesting check - can a match contain the given match? -Syntax.Match.prototype.canContain = function (match) { - // This is a special conditional for explicitly added ranges by the user. - // Since user added it, we honour it no matter what. - if (match.expression.force) { - return true; - } - - // Can't add anything into complete trees. - if (this.complete) { - return false; - } - - // match.expression.only will be checked on insertion using this.canHaveChild(match) - if (match.expression.only) { - return true; - } - - // If allow is undefined, default behaviour is no children. - if (typeof(this.expression.allow) === 'undefined') { - return false; - } - - // false if {disallow: [..., klass, ...]} - if (jQuery.isArray(this.expression.disallow) && jQuery.inArray(match.expression.klass, this.expression.disallow) !== -1) { - return false; - } - - // true if {allow: '*'} - if (this.expression.allow === '*') { - return true; - } - - // true if {allow: [..., klass, ...]} - if (jQuery.isArray(this.expression.allow) && jQuery.inArray(match.expression.klass, this.expression.allow) !== -1) { - return true; - } - - return false; -}; - -// Return true if the given match can be spliced in as a child. -// Checked automatically when calling _splice. -Syntax.Match.prototype.canHaveChild = function(match) { - var only = match.expression.only; - - // This condition is fairly slow - if (only) { - var cur = this; - - while (cur !== null) { - if (jQuery.inArray(cur.expression.klass, only) !== -1) { - return true; - } - - cur = cur.parent; - - // We don't traverse into other trees. - if (cur && cur.complete) { - break; - } - } - - return false; - } - - return true; -}; - -// Add a child into the list of children for a given match, if it is acceptable to do so. -// Updates the owner of the match. -// Returns null if splice failed. -Syntax.Match.prototype._splice = function(i, match) { - if (this.canHaveChild(match)) { - this.children.splice(i, 0, match); - match.parent = this; - - // For matches added using tags. - if (!match.expression.owner) { - match.expression.owner = this.expression.owner; - } - - return this; - } else { - return null; - } -}; - -// This function implements a full insertion procedure, and will break up the match to fit. -// This operation is potentially very expensive, but is used to insert custom ranges into -// the tree, if they are specified by the user. A custom may cover multiple leafs in -// the tree, thus some parts of the tree may need to be split. This behavior is controlled -// by whole - if true, the tree is split, if false, the match is split. -// You should avoid using this function except in very specific cases. -Syntax.Match.prototype.insert = function(match, whole) { - if (!this.contains(match)) - return null; - - if (whole) { - var top = this, i = 0; - while (i < top.children.length) { - if (top.children[i].contains(match)) { - top = top.children[i]; - i = 0; - } else { - i += 1; - } - } - - return top._insertWhole(match); - } else { - return this._insert(match); - } -} - -Syntax.Match.prototype._insertWhole = function(match) { - var parts = this.bisectAtOffsets([match.offset, match.endOffset]) - this.children = []; - - if (parts[0]) { - this.children = this.children.concat(parts[0].children); - } - - if (parts[1]) { - match.children = []; - - // Update the match's expression based on the current position in the tree: - if (this.expression && this.expression.owner) { - match.expression = this.expression.owner.getRuleForKlass(match.expression.klass) || match.expression; - } - - // This probably isn't ideal, it would be better to convert all children and children-of-children - // into a linear array and reinsert - it would be slightly more accurate in many cases. - for (var i = 0; i < parts[1].children.length; i += 1) { - var child = parts[1].children[i]; - - if (match.canContain(child)) { - match.children.push(child); - } - } - - this.children.push(match); - } - - if (parts[2]) { - this.children = this.children.concat(parts[2].children); - } - - return this; -} - -// This is not a general tree insertion function. It is optimised to run in almost constant -// time, but data must be inserted in sorted order, otherwise you will have problems. -// This function also ensures that matches won't be broken up unless absolutely necessary. -Syntax.Match.prototype.insertAtEnd = function(match) { - if (!this.contains(match)) { - Syntax.log("Syntax Error: Child is not contained in parent node!"); - return null; - } - - if (!this.canContain(match)) { - return null; - } - - if (this.children.length > 0) { - var i = this.children.length-1; - var child = this.children[i]; - - if (match.offset < child.offset) { - // Displacement: Before or LHS Overlap - // This means that the match has actually occurred before the last child. - // This is a bit of an unusual situation because the matches SHOULD be in - // sorted order. - // However, we are sure that the match is contained in this node. This situation - // sometimes occurs when sorting existing branches with matches that are supposed - // to be within that branch. When we insert the match into the branch, there are - // matches that technically should have been inserted afterwards. - // Normal usage should avoid this case, and this is best for performance. - if (match.force) { - return this._insert(match); - } else { - return null; - } - } else if (match.offset < child.endOffset) { - if (match.endOffset <= child.endOffset) { - // Displacement: Contains - //console.log("displacement => contains"); - var result = child.insertAtEnd(match); - return result; - } else { - // Displacement: RHS Overlap - if (match.force) { - return this._insert(match); - } else { - return null; - } - } - } else { - // Displacement: After - return this._splice(i+1, match); - } - - // Could not find a suitable placement: this is probably an error. - return null; - } else { - // Displacement: Contains [but currently no children] - return this._splice(0, match); - } -}; - -// This insertion function is relatively complex because it is required to split the match over -// several children. This function is used infrequently and is mostly for completeness. However, -// it might be possible to remove it to reduce code. -Syntax.Match.prototype._insert = function(match) { - if (this.children.length == 0) - return this._splice(0, match); - - for (var i = 0; i < this.children.length; i += 1) { - var child = this.children[i]; - - // If the match ends before this child, it must be before it. - if (match.endOffset <= child.offset) - return this._splice(i, match); - - // If the match starts after this child, we continue. - if (match.offset >= child.endOffset) - continue; - - // There are four possibilities... - // ... with the possibility of overlapping children on the RHS. - // {------child------} {---possibly some other child---} - // |----------complete overlap---------| - // |--lhs overlap--| - // |--contains--| - // |--rhs overlap--| - - // First, the easiest case: - if (child.contains(match)) { - return child._insert(match); - } - - // console.log("Bisect at offsets", match, child.offset, child.endOffset); - var parts = match.bisectAtOffsets([child.offset, child.endOffset]); - // console.log("parts =", parts); - // We now have at most three parts - // {------child------} {---possibly some other child---} - // |--[0]--|-------[1]-------|--[2]--| - - // console.log("parts", parts); - - if (parts[0]) { - this._splice(i, parts[0]) - } - - if (parts[1]) { - child.insert(parts[1]) - } - - // Continue insertion at this level with remainder. - if (parts[2]) { - match = parts[2] - } else { - return this; - } - } - - // If we got this far, the match wasn't [completely] inserted into the list of existing children, so it must be on the end. - this._splice(this.children.length, match); -} - -// This algorithm recursively bisects the tree at a given offset, but it does this efficiently by folding multiple bisections -// at a time. -// Splits: / / / -// Tree: |-------------------------Top-------------------------| -// |------------A--------------------| |------C-------| -// |-------B----------| -// Step (1): -// Split Top into 4 parts: -// |------/----------------/-------------------/---------| -// For each part, check if there are any children that cover this part. -// If there is a child, recursively call bisect with all splits. -// Step (1-1): -// Split A into parts: -// |------/-----A----------/---------| -// For each part, check if there are any children that cover this part. -// If there is a child, recursively call bisect with all splits. -// Step (1-1-1): -// Split B into parts: -// |-------B---/------| -// No children covered by split. Return array of two parts, B1, B2. -// Step (1-2): -// Enumerate the results of splitting the child and merge piece-wise into own parts -// |------/-----A----------/---------| -// |------B1---|--B2--| -// Finished merging children, return array of three parts, A1, A2, A3 -// Step (2): -// Enumerate the results of splitting the child and merge piece-wise into own parts. -// |------/----------------/-------------------/---------| -// |--A1--|-------A2-------|----A3---| -// |------B1---|--B2--| -// Continue by splitting next child, C. -// Once all children have been split and merged, return all parts, T1, T2, T3, T4. -// The new tree: -// |--T1--|-------T2-------|--------T3---------|---T4---| -// |--A1--|-------A2-------|----A3---| |--C1--|---C2--| -// |------B1---|--B2--| -// -// The new structure is as follows: -// T1 <- A1 -// T2 <- A2 <- B1 -// T3 <- A3 <- B2 -// \- C1 -// T4 <- C2 -// -Syntax.Match.prototype.bisectAtOffsets = function(splits) { - var parts = [], start = this.offset, prev = null, children = jQuery.merge([], this.children); - - // Copy the array so we can modify it. - splits = splits.slice(0); - - // We need to split including the last part. - splits.push(this.endOffset); - - splits.sort(function (a,b) { - return a-b; - }); - - // We build a set of top level matches by looking at each split point and - // creating a new match from the end of the previous match to the split point. - for (var i = 0; i < splits.length; i += 1) { - var offset = splits[i]; - - // The split offset is past the end of the match, so there are no more possible - // splits. - if (offset > this.endOffset) { - break; - } - - // We keep track of null parts if the offset is less than the start - // so that things align up as expected with the requested splits. - if ( - offset < this.offset // If the split point is less than the start of the match. - || (offset - start) == 0 // If the match would have effectively zero length. - ) { - parts.push(null); // Preserve alignment with splits. - start = offset; - continue; - } - - // Even if the previous split was out to the left, we align up the start - // to be at the start of the match we are bisecting. - if (start < this.offset) - start = this.offset; - - var match = new Syntax.Match(start, offset - start, this.expression); - match.value = this.value.substr(start - this.offset, match.length); - - if (prev) { - prev.next = match; - } - - prev = match; - - start = match.endOffset; - parts.push(match); - } - - // We only need to split to produce the number of parts we have. - splits.length = parts.length; - - for (var i = 0; i < parts.length; i += 1) { - if (parts[i] == null) - continue; - - var offset = splits[0]; - - while (children.length > 0) { - if (children[0].endOffset <= parts[i].endOffset) { - parts[i].children.push(children.shift()); - } else { - break; - } - } - - if (children.length) { - // We may have an intersection - if (children[0].offset < parts[i].endOffset) { - var children_parts = children.shift().bisectAtOffsets(splits), j = 0; - - // children_parts are the bisected children which need to be merged with parts - // in a linear fashion - for (; j < children_parts.length; j += 1) { - if (children_parts[j] == null) continue; // Preserve alignment with splits. - - parts[i+j].children.push(children_parts[j]); - } - - // Skip any parts which have been populated already - // (i is incremented at the start of the loop, splits shifted at the end) - i += (children_parts.length-2); - splits.splice(0, children_parts.length-2); - } - } - - splits.shift(); - } - - if (children.length) { - Syntax.log("Syntax Error: Children nodes not consumed", children.length, " remaining!"); - } - - return parts; -}; - -// Split a match at points in the tree that match a specific regular expression pattern. -// Uses the fast tree bisection algorithm, performance should be bounded O(S log N) where N is -// the total number of matches and S is the number of splits (?). -Syntax.Match.prototype.split = function(pattern) { - var splits = [], match; - - while ((match = pattern.exec(this.value)) !== null) { - splits.push(pattern.lastIndex); - } - - var matches = this.bisectAtOffsets(splits); - - // Remove any null placeholders. - return jQuery.grep(matches, function(n,i){ - return n; - }); -}; - -Syntax.Brush = function () { - // The primary class of this brush. Must be unique. - this.klass = null; - - // A sequential list of rules for extracting matches. - this.rules = []; - - // A list of all parents that this brush derives from. - this.parents = []; - - // A list of processes that may be run after extracting matches. - this.processes = {}; -}; - -// Add a parent to the brush. This brush should be loaded as a dependency. -Syntax.Brush.prototype.derives = function (name) { - this.parents.push(name); - this.rules.push({ - apply: function(text, expr) { - return Syntax.brushes[name].getMatches(text); - } - }); -} - -// Return an array of all classes that the brush consists of. -// A derivied brush is its own klass + the klass of any and all parents. -Syntax.Brush.prototype.allKlasses = function () { - var klasses = [this.klass]; - - for (var i = 0; i < this.parents.length; i += 1) { - klasses = klasses.concat(Syntax.brushes[this.parents[i]].allKlasses()); - } - - return klasses; -} - -Syntax.Brush.convertStringToTokenPattern = function (pattern, escape) { - var prefix = "\\b", postfix = "\\b"; - - if (!pattern.match(/^\w/)) { - if (!pattern.match(/\w$/)) { - prefix = postfix = ""; - } else { - prefix = "\\B"; - } - } else { - if (!pattern.match(/\w$/)) { - postfix = "\\B"; - } - } - - if (escape) - pattern = RegExp.escape(pattern) - - return prefix + pattern + postfix; -} - -Syntax.Brush.MatchPattern = function (text, rule) { - if (!rule.pattern) - return []; - - // Duplicate the pattern so that the function is reentrant. - var matches = [], pattern = new RegExp; - pattern.compile(rule.pattern); - - while((match = pattern.exec(text)) !== null) { - if (rule.matches) { - matches = matches.concat(rule.matches(match, rule)); - } else if (rule.brush) { - matches.push(Syntax.Brush.buildTree(rule, match[0], match.index)); - } else { - matches.push(new Syntax.Match(match.index, match[0].length, rule, match[0])); - } - - if (rule.incremental) { - // Don't start scanning from the end of the match.. - pattern.lastIndex = match.index + 1; - } - } - - return matches; -} - -Syntax.Brush.prototype.push = function () { - if (jQuery.isArray(arguments[0])) { - var patterns = arguments[0], rule = arguments[1]; - - var all = "("; - - for (var i = 0; i < patterns.length; i += 1) { - if (i > 0) all += "|"; - - var p = patterns[i]; - - if (p instanceof RegExp) { - all += p.source; - } else { - all += Syntax.Brush.convertStringToTokenPattern(p, true); - } - } - - all += ")"; - - this.push(jQuery.extend({ - pattern: new RegExp(all, rule.options || 'g') - }, rule)); - } else { - var rule = arguments[0]; - - if (typeof(rule.pattern) === 'string') { - rule.string = rule.pattern; - rule.pattern = new RegExp(Syntax.Brush.convertStringToTokenPattern(rule.string, true), rule.options || 'g') - } - - if (typeof(XRegExp) !== 'undefined') { - rule.pattern = new XRegExp(rule.pattern); - } - - // Default pattern extraction algorithm - rule.apply = rule.apply || Syntax.Brush.MatchPattern; - - if (rule.pattern && rule.pattern.global || typeof(rule.pattern) == 'undefined') { - this.rules.push(jQuery.extend({owner: this}, rule)); - } else { - Syntax.log("Syntax Error: Malformed rule: ", rule); - } - } -}; - -Syntax.Brush.prototype.getMatchesForRule = function (text, rule) { - var matches = [], match = null; - - // Short circuit (user defined) function: - if (typeof(rule.apply) != 'undefined') { - matches = rule.apply(text, rule); - } - - if (rule.debug) { - Syntax.log("Syntax matches:", rule, text, matches); - } - - return matches; -}; - -Syntax.Brush.prototype.getRuleForKlass = function (klass) { - for (var i = 0; i < this.rules.length; i += 1) { - if (this.rules[i].klass == klass) { - return this.rules[i]; - } - } - - return null; -} - -// Get all matches from a given block of text. -Syntax.Brush.prototype.getMatches = function(text) { - var matches = []; - - for (var i = 0; i < this.rules.length; i += 1) { - matches = matches.concat(this.getMatchesForRule(text, this.rules[i])); - } - - return matches; -}; - -// A helper function for building a tree from a specific rule. -// Typically used where sub-trees are required, e.g. CSS brush in HTML brush. -Syntax.Brush.buildTree = function(rule, text, offset, additionalMatches) { - var match = Syntax.brushes[rule.brush].buildTree(text, offset, additionalMatches); - - jQuery.extend(match.expression, rule); - - return match; -} - -// This function builds a tree from a given block of text. -// This is done by applying all rules to the text to get a complete list of matches, -// sorting them in order, and inserting them into a syntax tree data structure. -// Additional matches are forcefully inserted into the tree. -// Provide an offset if the text is offset in a larger block of text. Matches -// will be shifted along appropriately. -Syntax.Brush.prototype.buildTree = function(text, offset, additionalMatches) { - offset = offset || 0; - - // Fixes code that uses \r\n for line endings. /$/ matches both \r\n, which is a problem.. - text = text.replace(/\r/g, ''); - - var matches = this.getMatches(text); - - // Shift matches if offset is provided. - if (offset && offset > 0) { - for (var i = 0; i < matches.length; i += 1) { - matches[i].shift(offset); - } - } - - var top = new Syntax.Match(offset, text.length, {klass: this.allKlasses().join(" "), allow: '*', owner: this}, text); - - // This sort is absolutely key to the functioning of the tree insertion algorithm. - matches.sort(Syntax.Match.sort); - - for (var i = 0; i < matches.length; i += 1) { - top.insertAtEnd(matches[i]); - } - - if (additionalMatches) { - for (var i = 0; i < additionalMatches.length; i += 1) { - top.insert(additionalMatches[i], true); - } - } - - top.complete = true; - - return top; -}; - -// This function builds a syntax tree from the given text and matches (optional). -// The syntax tree is then flattened into html using a variety of functions. -// -// By default, you can't control reduction process through this function, but -// it is possible to control the element conversion process by replace -// .reduce(null, ...) with .reduce(reduceCallback, ...) -// See Syntax.Match.defaultReduceCallback for more details about interface. -// -// Matches is optional, and provides a set of pre-existing matches to add -// to the tree. -// Options are passed to element level processing functions. -Syntax.Brush.prototype.process = function(text, matches, options) { - var top = this.buildTree(text, 0, matches); - - var lines = top.split(/\n/g); - - var html = document.createElement('pre'); - html.className = 'syntax'; - - for (var i = 0; i < lines.length; i += 1) { - var line = lines[i].reduce(null, function (container, match) { - if (match.expression) { - if (match.expression.process) { - container = match.expression.process(container, match, options); - } - - if (match.expression.owner) { - var process = match.expression.owner.processes[match.expression.klass]; - if (process) { - container = process(container, match, options); - } - } - } - return container; - }); - - html.appendChild(line); - } - - return html; -}; - -// Highlights a given block of text with a given set of options. -// options.brush should specify the brush to use, either by direct reference -// or name. -// Callback will be called with (highlighted_html, brush_used, original_text, options) -Syntax.highlightText = function(text, options, callback) { - var brushName = (options.brush || 'plain').toLowerCase(); - - brushName = Syntax.aliases[brushName] || brushName; - - Syntax.brushes.get(brushName, function(brush) { - if (options.tabWidth) { - // Calculate the tab expansion and offsets - replacement = Syntax.convertTabsToSpaces(text, options.tabWidth); - - // Update any existing matches - if (options.matches && options.matches.length) { - var linearOffsets = Syntax.convertToLinearOffsets(replacement.offsets, text.length); - options.matches = Syntax.updateMatchesWithOffsets(options.matches, linearOffsets, replacement.text); - } - - text = replacement.text; - } - - var html = brush.process(text, options.matches, options); - - if (options.linkify !== false) { - jQuery('span.href', html).each(function(){ - jQuery(this).replaceWith(jQuery('').attr('href', this.innerHTML).text(this.innerHTML)); - }); - } - - callback(html, brush, text, options); - }); -} - -// Highlight a given set of elements with a set of options. -// Callback will be called once per element with (options, highlighted_html, original_container) -Syntax.highlight = function (elements, options, callback) { - if (typeof(options) === 'function') { - callback = options; - options = {}; - } - - options.layout = options.layout || 'preformatted'; - options.matches = []; - - if (typeof(options.tabWidth) === 'undefined') { - options.tabWidth = 4; - } - - elements.each(function () { - var container = jQuery(this); - - // We can augment the plain text to extract existing annotations (e.g. ...). - options.matches = options.matches.concat(Syntax.extractElementMatches(container)); - - var text = Syntax.innerText(this); - - var match = text.match(/-\*- mode: (.+?);(.*?)-\*-/i); - var endOfSecondLine = text.indexOf("\n", text.indexOf("\n") + 1); - - if (match && match.index < endOfSecondLine) { - options.brush = options.brush || match[1]; - var modeline = match[2]; - - var mode = /([a-z\-]+)\:(.*?)\;/gi; - - while((match = mode.exec(modeline)) !== null) { - var setter = Syntax.modeLineOptions[match[1]]; - - if (setter) { - setter(match[1], match[2], options); - } - } - } - - Syntax.highlightText(text, options, function(html, brush/*, text, options*/) { - Syntax.layouts.get(options.layout, function(layout) { - html = layout(options, $(html), $(container)); - - // If there is a theme specified, ensure it is added to the top level class. - if (options.theme) { - // Load dependencies - var themes = Syntax.themes[options.theme]; - for (var i = 0; i < themes.length; i += 1) { - html.addClass("syntax-theme-" + themes[i]); - } - - // Add the base theme - html.addClass("syntax-theme-" + options.theme); - } - - if (brush.postprocess) { - html = brush.postprocess(options, html, container); - } - - if (callback) { - html = callback(options, html, container); - } - - if (html && options.replace === true) { - container.replaceWith(html); - } - }); - }); - }); -}; - -// Register the file as being loaded -Syntax.loader.core = true; diff --git a/public/jquery.syntax.js b/public/jquery.syntax.js deleted file mode 100644 index 6a33d42..0000000 --- a/public/jquery.syntax.js +++ /dev/null @@ -1,317 +0,0 @@ -/* - This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. - For more information, please see http://www.oriontransfer.co.nz/software/jquery-syntax - - Copyright (c) 2011 Samuel G. D. Williams. - - 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 shall 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. -*/ - -/*global Function: true, ResourceLoader: true, Syntax: true, alert: false, jQuery: true */ - -// ECMAScript 5! Why wasn't this done before!? -if (!Function.prototype.bind) { - Function.prototype.bind = function (target) { - var args = Array.prototype.slice.call(arguments, 1), fn = this; - - return function () { - return fn.apply(target, args); - }; - }; -} - -function ResourceLoader (loader) { - this.dependencies = {}; - this.loading = {}; - this.loader = loader; -} - -ResourceLoader.prototype._finish = function (name) { - var deps = this.dependencies[name]; - - if (deps) { - // I'm not sure if this makes me want to cry... or laugh... or kill!? - var chain = this._loaded.bind(this, name); - - for (var i = 0; i < deps.length; i += 1) { - chain = this.get.bind(this, deps[i], chain); - } - - chain(); - } else { - this._loaded(name); - } -}; - -ResourceLoader.prototype._loaded = function (name) { - // When the script has been succesfully loaded, we expect the script - // to register with this loader (i.e. this[name]). - var resource = this[name], loading = this.loading[name]; - - // Clear the loading list - this.loading[name] = null; - - if (!resource) { - alert("ResourceLoader: Could not load resource named " + name); - } else { - for (var i = 0; i < loading.length; i += 1) { - loading[i](resource); - } - } -}; - -// This function must ensure that current cannot be completely loaded until next -// is completely loaded. -ResourceLoader.prototype.dependency = function (current, next) { - // If the resource has completely loaded, then we don't need to queue it - // as a dependency - if (this[next] && !this.loading[name]) { - return; - } - - if (this.dependencies[current]) { - this.dependencies[current].push(next); - } else { - this.dependencies[current] = [next]; - } -}; - -// This function must be reentrant for the same name and different callbacks. -ResourceLoader.prototype.get = function (name, callback) { - if (this.loading[name]) { - this.loading[name].push(callback) - } else if (this[name]) { - callback(this[name]); - } else { - this.loading[name] = [callback]; - this.loader(name, this._finish.bind(this, name)); - } -}; - -var Syntax = { - root: null, - aliases: {}, - styles: {}, - themes: {}, - lib: {}, - defaultOptions: { - cacheScripts: false, - cacheStyleSheets: false, - theme: "base" - }, - - brushes: new ResourceLoader(function (name, callback) { - name = Syntax.aliases[name] || name; - - Syntax.getResource('jquery.syntax.brush', name, callback); - }), - - layouts: new ResourceLoader(function (name, callback) { - Syntax.getResource('jquery.syntax.layout', name, callback); - }), - - loader: new ResourceLoader(function (name, callback) { - Syntax.getResource('jquery.syntax', name, callback); - }), - - getStyles: function (path) { - var link = jQuery(''); - jQuery("head").append(link); - - if (!Syntax.defaultOptions.cacheStyleSheets) { - path = path + "?" + Math.random() - } - - link.attr({ - rel: "stylesheet", - type: "text/css", - href: path - }); - }, - - getScript: function (path, callback) { - var script = document.createElement('script'); - - // Internet Exploder - script.onreadystatechange = function() { - if (this.onload && (this.readyState == 'loaded' || this.readyState == 'complete')) { - this.onload(); - - // Ensure the function is only called once. - this.onload = null; - } - }; - - // Every other modern browser - script.onload = callback; - script.type = "text/javascript"; - - if (!Syntax.defaultOptions.cacheScripts) - path = path + '?' + Math.random() - - script.src = path; - - document.getElementsByTagName('head')[0].appendChild(script); - }, - - getResource: function (prefix, name, callback) { - var basename = prefix + "." + name; - var styles = this.styles[basename]; - - if (styles) { - for (var i = 0; i < styles.length; i += 1) { - this.getStyles(this.root + styles[i]); - } - } - - Syntax.getScript(this.root + basename + '.js', callback); - }, - - alias: function (name, aliases) { - Syntax.aliases[name] = name; - - for (var i = 0; i < aliases.length; i += 1) { - Syntax.aliases[aliases[i]] = name; - } - }, - - brushAliases: function (brush) { - var aliases = []; - - for (var name in Syntax.aliases) { - if (Syntax.aliases[name] === brush) { - aliases.push(name); - } - } - - return aliases; - }, - - brushNames: function () { - var names = []; - - for (var name in Syntax.aliases) { - if (name === Syntax.aliases[name]) { - names.push(name); - } - } - - return names; - }, - - extractBrushName: function (className) { - // brush names are by default lower case - normalize so we can detect it. - className = className.toLowerCase(); - - var match = className.match(/brush-([\S]+)/); - - if (match) { - return match[1]; - } else { - var classes = className.split(/ /); - - if (jQuery.inArray("syntax", classes) !== -1) { - for (var i = 0; i < classes.length; i += 1) { - var name = Syntax.aliases[classes[i]]; - - if (name) { - return name; - } - } - } - } - - return null; - }, - - detectRoot: function () { - if (Syntax.root == null) { - // Initialize root based on current script path. - var scripts = jQuery('script').filter(function(){ - return this.src.match(/jquery\.syntax/); - }); - - var first = scripts.get(0); - - if (first) { - // Calculate the basename for the given script src. - var root = first.src.match(/.*\//); - - if (root) { - Syntax.root = root[0]; - } - } - } - }, - - log: function() { - if (typeof(console) != "undefined" && console.log) { - console.log.apply(console, arguments); - } else if (window.console && window.console.log) { - window.console.log.apply(window.console, arguments); - } - } -}; - -jQuery.fn.syntax = function (options, callback) { - Syntax.detectRoot(); - - var elements = this; - - Syntax.loader.get('core', function () { - Syntax.highlight(elements, options, callback); - }); -}; - -jQuery.syntax = function (options, callback) { - options = options || {}; - var context = options.context; - - if (options.root) { - Syntax.root = options.root; - } else { - Syntax.detectRoot(); - } - - options = jQuery.extend(Syntax.defaultOptions, options) - - options.blockSelector = options.blockSelector || 'pre.syntax:not(.highlighted)'; - options.inlineSelector = options.inlineSelector || 'code.syntax:not(.highlighted)'; - - options.blockLayout = options.blockLayout || 'list'; - options.inlineLayout = options.inlineLayout || 'inline'; - - // Allow the user to specify callbacks without replacement. - if (typeof options.replace == "undefined") - options.replace = true; - - jQuery(options.blockSelector, context).each(function () { - jQuery(this).syntax(jQuery.extend({}, options, { - brush: Syntax.extractBrushName(this.className), - layout: options.blockLayout - }), callback); - }); - - jQuery(options.inlineSelector, context).each(function () { - jQuery(this).syntax(jQuery.extend({}, options, { - brush: Syntax.extractBrushName(this.className), - layout: options.inlineLayout - }), callback); - }); -}; diff --git a/public/jquery.syntax.layout.editor.js b/public/jquery.syntax.layout.editor.js deleted file mode 100644 index ee5f554..0000000 --- a/public/jquery.syntax.layout.editor.js +++ /dev/null @@ -1,331 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.Editor = function(container, text) { - this.container = container; - this.current = this.getLines(); -} - -// This function generates an array of accumulated line offsets e.g. -// If line 8 is actually in child element 6, indices[8] = -2 -Syntax.Editor.prototype.getLines = function() { - var children = this.container.childNodes, lines = [], offsets = []; - - // Sometimes, e.g. when deleting text, children elements are not complete lines. - // We need to accumulate incomplete lines (1), and then append them to the - // start of the next complete line (2) - var remainder = null, startChild = 0, nextChild = 0; - for (var i = 0; i < children.length; i += 1) { - var childLines = ((remainder || '') + Syntax.innerText(children[i])).split('\n'); - - remainder = childLines.pop(); - - // There were no complete lines. - if (childLines.length == 0) { - continue; - } - - startChild = nextChild; - - for (var j = 0; j < childLines.length; j += 1) { - offsets.push(startChild - lines.length); - lines.push(childLines[j] + '\n'); - } - - nextChild = i + 1; - } - - // Final line, any remaining text - if (remainder != null) { - //if (!(lines[lines.length-1] == '\n' && remainder == '')) { - offsets.push(startChild - lines.length); - lines.push(remainder); - //} - } - - startChild += 1; - offsets.push(startChild - lines.length); - - Syntax.log("getLines", offsets, lines, children); - - return {lines: lines, offsets: offsets}; -} - -// This function updates the editor's internal state with regards to lines changed. -// This can be lines added, removed or modified partially. This function returns -// a list of lines which are different between the previous set of lines and the -// updated set of lines. -// This algorithm is not a general diff algorithm because we expect three cases only: -// 1: A single line was modified (most common case) -// 2: Some lines were removed (selection -> delete) -// 3: Some lines were added (paste) -Syntax.Editor.prototype.updateChangedLines = function() { - var result = {}; - - var updated = this.getLines(); - - // Find the sequence of lines at the start preceeding the change: - var i = 0, j = 0; - while (i < this.current.lines.length && j < updated.lines.length) { - if (this.current.lines[i] == updated.lines[j]) { - i += 1; - j += 1; - } else { - break; - } - } - - // The length of the initial segment which hasn't changed: - result.start = j; - - // Find the sequence of lines at the end proceeding the change: - i = this.current.lines.length, j = updated.lines.length; - while (i > result.start && j > result.start) { - if (this.current.lines[i-1] == updated.lines[j-1]) { - i -= 1; - j -= 1; - } else { - break; - } - } - - // The index of the remaining portion which hasn't changed: - result.end = j; - // The index to the original set of lines which were the same: - result.originalEnd = i; - - // Did we add or remove some lines? - result.difference = updated.lines.length - this.current.lines.length; - - // This should be augmented to improve the above. - while (result.start > 0) { - if (updated.offsets[result.start] == updated.offsets[result.start-1]) - break; - - result.start -= 1; - } - - if (result.difference > 0) { - while (result.end < (updated.lines.length-1)) { - if (updated.offsets[result.end-1] == updated.offsets[result.end]) - break; - - result.end += 1; - result.originalEnd += 1; - } - } - - // Update the internal state for the next update. - this.current = updated; - this.changed = result; - - return result; -} - -Syntax.Editor.prototype.textForLines = function(start, end) { - return this.current.lines.slice(start, end).join(''); -} - -Syntax.Editor.prototype.updateLines = function(changed, newLines) { - // We have two cases to handle, either we are replacing lines - // (1a) Replacing old lines with one more more new lines (update) - // (1b) Replacing old lines with zero new lines (removal) - // Or we are inserting lines - // (2a) We are inserting lines at the start of the element - // (2b) We are inserting lines after an existing element. - - if (changed.start != changed.end) { - // When text is deleted, at most two elements can remain: - // (1) Whatever was partially remaining on the first line. - // (2) Whatever was partially remaining on the last line. - // All other lines have already been removed by the container. - // changed.difference tells us how many elements have already been removed. - - // Cases (1a) and (1b) - var start = changed.start, end = changed.end; - - start += this.current.offsets[start]; - end += this.current.offsets[end]; - - var oldLines = Array.prototype.slice.call(this.container.childNodes, start, end); - - Syntax.log("updateLines", changed.start, changed.end, "->", start, end, "HTML", oldLines, newLines); - - $(oldLines).replaceWith(newLines); - } else { - if (changed.start == 0) - $(this.container).prepend(newLines); - else { - var start = changed.start; - - start += this.current.offsets[start]; - - $(this.container.childNodes[start]).after(newLines); - } - } -} - -// http://jsfiddle.net/TjXEG/1/ -Syntax.Editor.getCharacterOffset = function(element) { - var caretOffset = 0; - if (typeof window.getSelection != "undefined") { - var range = window.getSelection().getRangeAt(0); - var preCaretRange = range.cloneRange(); - preCaretRange.selectNodeContents(element); - preCaretRange.setEnd(range.endContainer, range.endOffset); - caretOffset = preCaretRange.toString().length; - } else if (typeof document.selection != "undefined" && document.selection.type != "Control") { - var textRange = document.selection.createRange(); - var preCaretTextRange = document.body.createTextRange(); - preCaretTextRange.moveToElementText(element); - preCaretTextRange.setEndPoint("EndToEnd", textRange); - caretOffset = preCaretTextRange.text.length; - } - return caretOffset; -}; - -Syntax.Editor.getNodesForCharacterOffsets = function(offsets, node) { - var treeWalker = document.createTreeWalker( - node, - NodeFilter.SHOW_TEXT, - function(node) { - return NodeFilter.FILTER_ACCEPT; - }, - false - ); - - var nodes = [], charCount = 0, i = 0; - while (i < offsets.length && treeWalker.nextNode()) { - var end = charCount + treeWalker.currentNode.length; - - while (i < offsets.length && offsets[i] < end) { - nodes.push([treeWalker.currentNode, charCount, end]); - - i += 1; - } - - charCount = end; - } - - return nodes; -}; - -Syntax.Editor.prototype.getClientState = function() { - var state = {}; - - var selection = window.getSelection(); - - if (selection.rangeCount > 0) - state.range = selection.getRangeAt(0); - - if (state.range) { - state.startOffset = Syntax.Editor.getCharacterOffset(this.container); - } - - return state; -}; - -Syntax.Editor.prototype.setClientState = function(state) { - if (state.startOffset) { - var nodes = Syntax.Editor.getNodesForCharacterOffsets([state.startOffset], this.container); - - if (nodes[0]) { - var range = document.createRange(); - range.setStart(nodes[0][0], state.startOffset - nodes[0][1]); - range.setEnd(nodes[0][0], state.startOffset - nodes[0][1]); - - var selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - } - } -}; - -Syntax.layouts.editor = function(options, code/*, container*/) { - var container = jQuery('
'); - - container.append(code.children()); - - var editor = new Syntax.Editor(container.get(0)); - var updateTimeout = null; - - var updateContainer = function() { - var changed = editor.updateChangedLines(); - - // Sometimes there are problems where multiple spans exist on the same line. - if (changed.difference < 0 && changed.start > 0) - changed.start -= 1; - - var text = editor.textForLines(changed.start, changed.end); - - if (changed.start == changed.end) { - editor.updateLines(changed, []); - } else { - // Lines have been added, update the highlighting. - Syntax.highlightText(text, options, function(html) { - var clientState = editor.getClientState(); - - editor.updateLines(changed, html.children().get()); - - editor.setClientState(clientState); - }); - } - - if (updateTimeout) { - clearTimeout(updateTimeout); - } - - updateTimeout = setTimeout(function(){ - var text = Syntax.innerText(editor.container); - - Syntax.highlightText(text, options, function(html) { - var clientState = editor.getClientState(); - - $(editor.container).empty(); - $(editor.container).append(html.children()); - - editor.setClientState(clientState); - }) - }, 1000); - }; - - // 'blur keyup paste mouseup' - container.bind('keyup', function(){ - //updateContainer(); - }); - - container.bind('paste', function(event){ - //updateContainer(); - }); - - container.bind('keydown', function(event){ - if (event.keyCode == 9) { - event.preventDefault(); - document.execCommand('insertHTML', false, " "); - } - else if (event.keyCode == 13) { - //var range = document.selection.createRange(); - var range = window.getSelection().getRangeAt(0); - Syntax.log("range", range); - range.deleteContents(); - - var br = document.createElement('br'); - range.insertNode(br); - event.preventDefault(); - - range.setStart(br, 0); - range.setEnd(br, 0); - - var selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - - // document.execCommand('insertHTML', false, "
"); - } - }); - - ED = editor; - - return jQuery('
').append(container); -}; diff --git a/public/jquery.syntax.layout.fixed.js b/public/jquery.syntax.layout.fixed.js deleted file mode 100644 index f51c0bc..0000000 --- a/public/jquery.syntax.layout.fixed.js +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -// This layout doesn't work correctly in IE6, but is fine in all other tested browsers. -Syntax.layouts.fixed = function(options, code, container) { - var fixed = jQuery('
'), line = 1, space = /^\s*$/; - var toolbar = jQuery('
'); - - var rawCode = container.clone(); - rawCode.addClass("raw syntax highlighted"); - - var codeTable = document.createElement('table'); - - var codeTableBody = document.createElement('tbody'); - codeTable.appendChild(codeTableBody); - - var numbersColumn = jQuery('
'); - var codeColumn = jQuery('
'); - - // Source code - code.children().each(function() { - var lineNumber = document.createElement('div'); - lineNumber.className = "line ln" + line - lineNumber.innerHTML = line; - numbersColumn.append(lineNumber); - - var lineCode = document.createElement('td'); - lineCode.className = "source " + this.className; - - if (line % 2) { - lineCode.className += " alt"; - } - - if (lineCode == 1) { - lineNumber.className += " first" - } - - // Thanks to Michael for suggesting the obvious :) - lineCode.appendChild(this); - - var tr = document.createElement('tr'); - tr.appendChild(lineCode); - codeTableBody.appendChild(tr); - - line = line + 1; - }); - - codeColumn.append(codeTable); - - fixed.append(numbersColumn); - fixed.append(codeColumn); - - a = jQuery('View Raw Code'); - a.click(function (event) { - event.preventDefault(); - - if (jQuery(fixed).is(':visible')) { - rawCode.height(jQuery(fixed).height()); - jQuery(fixed).replaceWith(rawCode); - } else { - jQuery(rawCode).replaceWith(fixed); - } - }); - - toolbar.append(a); - toolbar.append('?'); - - return jQuery('
').append(toolbar).append(fixed); -}; diff --git a/public/jquery.syntax.layout.inline.js b/public/jquery.syntax.layout.inline.js deleted file mode 100644 index 4a94350..0000000 --- a/public/jquery.syntax.layout.inline.js +++ /dev/null @@ -1,13 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.layouts.inline = function(options, code, container) { - var inline = jQuery(''); - inline.append(code.children()); - - var container = jQuery(''); - container.append(inline); - - return container; -}; diff --git a/public/jquery.syntax.layout.list.js b/public/jquery.syntax.layout.list.js deleted file mode 100644 index 0dcf6d8..0000000 --- a/public/jquery.syntax.layout.list.js +++ /dev/null @@ -1,54 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.layouts.list = function(options, code, container) { - var listTag = options.listTag || 'ol'; - - var list = jQuery('<' + listTag + ' class="syntax highlighted">'), line = 1, space = /^\s*$/; - var toolbar = jQuery('
'); - - var rawCode = container.clone(); - rawCode.addClass("raw syntax highlighted"); - - // Source code - code.children().each(function() { - var li = document.createElement('li'); - li.className = "line ln" + line - - if (line % 2) { - li.className += " alt"; - } - - if (line == 1) { - li.className += " first" - } - - var div = document.createElement('div'); - div.className = "source " + this.className; - - div.appendChild(this); - - li.appendChild(div); - list[0].appendChild(li); - - line = line + 1; - }); - - a = jQuery('View Raw Code'); - a.click(function (event) { - event.preventDefault(); - - if (jQuery(list).is(':visible')) { - rawCode.height(jQuery(list).height()); - jQuery(list).replaceWith(rawCode); - } else { - jQuery(rawCode).replaceWith(list); - } - }); - - toolbar.append(a); - toolbar.append('?'); - - return jQuery('
').append(toolbar).append(list); -}; diff --git a/public/jquery.syntax.layout.plain.js b/public/jquery.syntax.layout.plain.js deleted file mode 100644 index 877590d..0000000 --- a/public/jquery.syntax.layout.plain.js +++ /dev/null @@ -1,15 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -// This layout doesn't work correctly in IE6, but is fine in all other tested browsers. -Syntax.layouts.plain = function(options, code, container) { - var toolbar = jQuery('
'); - - var scrollContainer = jQuery('
'); - code.removeClass('syntax'); - - scrollContainer.append(code); - - return jQuery('
').append(toolbar).append(scrollContainer); -}; diff --git a/public/jquery.syntax.layout.table.js b/public/jquery.syntax.layout.table.js deleted file mode 100644 index fbd656f..0000000 --- a/public/jquery.syntax.layout.table.js +++ /dev/null @@ -1,58 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.layouts.table = function(options, code, container) { - var table = jQuery('
'), tr = null, td = null, a = null, line = 1; - var tbody = document.createElement('tbody'); - var toolbar = jQuery('
'); - - var rawCode = container.clone(); - rawCode.addClass("raw syntax highlighted"); - - // Source code - code.children().each(function() { - tr = document.createElement('tr'); - tr.className = "line ln" + line; - - if (line % 2) { - tr.className += " alt"; - } - - td = document.createElement('td'); - td.className = "number"; - - number = document.createElement('span'); - number.innerHTML = line; - td.appendChild(number); - tr.appendChild(td); - - td = document.createElement('td'); - td.className = "source"; - - td.appendChild(this); - tr.appendChild(td); - - tbody.appendChild(tr); - line = line + 1; - }); - - table.append(tbody); - - a = jQuery('View Raw Code'); - a.click(function (event) { - event.preventDefault(); - - if (jQuery(table).is(':visible')) { - rawCode.height(jQuery(table).height()); - jQuery(table).replaceWith(rawCode); - } else { - jQuery(rawCode).replaceWith(table); - } - }); - - toolbar.append(a); - toolbar.append('?'); - - return jQuery('
').append(toolbar).append(table); -}; diff --git a/public/jquery.syntax.min.js b/public/jquery.syntax.min.js deleted file mode 100644 index ac358f3..0000000 --- a/public/jquery.syntax.min.js +++ /dev/null @@ -1,21 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. - - -if(!Function.prototype.bind){Function.prototype.bind=function(target){var args=Array.prototype.slice.call(arguments,1),fn=this;return function(){return fn.apply(target,args);};};} -function ResourceLoader(loader){this.dependencies={};this.loading={};this.loader=loader;} -ResourceLoader.prototype._finish=function(name){var deps=this.dependencies[name];if(deps){var chain=this._loaded.bind(this,name);for(var i=0;i');jQuery("head").append(link);if(!Syntax.defaultOptions.cacheStyleSheets){path=path+"?"+Math.random()} -link.attr({rel:"stylesheet",type:"text/css",href:path});},getScript:function(path,callback){var script=document.createElement('script');script.onreadystatechange=function(){if(this.onload&&(this.readyState=='loaded'||this.readyState=='complete')){this.onload();this.onload=null;}};script.onload=callback;script.type="text/javascript";if(!Syntax.defaultOptions.cacheScripts) -path=path+'?'+Math.random() -script.src=path;document.getElementsByTagName('head')[0].appendChild(script);},getResource:function(prefix,name,callback){var basename=prefix+"."+name;var styles=this.styles[basename];if(styles){for(var i=0;i< 1Kbyte, per language. + +### Compared to xyz? + +All syntax highlighters are pretty good these days. But, there are some key differences worth considering: + +- How much does it load by default, even when not highlighting anything? +- How efficient/fast is it when highlighting code? +- How does line wrapping work? +- Can you embed `` and `` elements? +- Can it handle embedded code (e.g. JavaScript inside HTML)? +- Is it easy to install? +- Is it easy to customize? + +## Installation + +jQuery.Syntax is easily installed using `yarn`. + + $ yarn install jquery-syntax + +It has a `dist/` directory which follows standard conventions. + +### Advanced Configuration + +jQuery.Syntax compiles and minifies it's code using uses [`bake`](https://github.com/ioquatix/bake) (Ruby) and [Sass](http://sass-lang.com). Please review the included `bake.rb` and `install.yaml` for more details. + +## Usage + +jQuery.Syntax is typically used to highlight both block code elements and inline code elements. To highlight code, you first need to include several scripts in the `` of your page: + + + + + + + + +
puts "Hello World"
+ +### Stylesheet Compatibility + +The following stylesheet sets some useful defaults and enables responsive tab-size indentation. + +```css +html { + font-size: 16px; + + /* Fix odd text-size in `display: flex` elements on Safari iOS */ + text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; +} + +@media (min-width: 40em) { + html { + font-size: 18px; + --tab-size: 4; + } +} + +@media (min-width: 80em) { + html { + font-size: 20px; + --tab-size: 4; + } +} + +pre { + /* -moz-tab-size is still required by Firefox */ + --tab-size: 2; + tab-size: var(--tab-size); + -moz-tab-size: var(--tab-size); +} +``` + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request + +## License + +Released under the MIT license. + +Copyright, 2011-2020, by [Samuel G. D. Williams](https://www.codeotaku.com/). + +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 shall 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. diff --git a/source/jquery.syntax.brush.bash-script.js b/source/jquery.syntax.brush.bash-script.js index 1296edf..2e96bda 100644 --- a/source/jquery.syntax.brush.bash-script.js +++ b/source/jquery.syntax.brush.bash-script.js @@ -37,7 +37,7 @@ Syntax.register('bash-statement', function(brush) { // Probably need to write a real parser here rather than using regular expressions, it is too fragile // and misses lots of edge cases (e.g. nested brackets, delimiters). brush.push({ - pattern: /^\s*((?:\S+?=\$?(?:\[[^\]]+\]|\(\(.*?\)\)|"(?:[^"]|\\")+"|'(?:[^']|\\')+'|\S+)\s*)*)((?:\S+)?)/gmi, + pattern: /^\s*((?:\S+?=\$?(?:\[[^\]]+\]|\(\(.*?\)\)|"(?:[^"]|\\")+"|'(?:[^']|\\')+'|\S+)\s*)*)((?:(\\ |\S)+)?)/gmi, matches: Syntax.extractMatches( {klass: 'env', allow: ['variable', 'string', 'operator', 'constant', 'expression']}, {klass: 'function', allow: ['variable', 'string']} @@ -55,7 +55,7 @@ Syntax.register('bash-statement', function(brush) { klass: 'variable' }); - brush.push({pattern: /\s\-+\w+/g, klass: 'option'}) + brush.push({pattern: /\s\-+[\w-]+/g, klass: 'option'}) brush.push(Syntax.lib.singleQuotedString); brush.push(Syntax.lib.doubleQuotedString); diff --git a/source/jquery.syntax.brush.css.js b/source/jquery.syntax.brush.css.js index 3a0fc5b..e92f963 100644 --- a/source/jquery.syntax.brush.css.js +++ b/source/jquery.syntax.brush.css.js @@ -40,7 +40,7 @@ Syntax.register('css', function(brush) { var sampleColour = document.createElement('span'); sampleColour.className = 'sample'; sampleColour.style.backgroundColor = text; - sampleColour.appendChild(document.createTextNode('  ')) + sampleColour.appendChild(document.createTextNode(' ')) colourBox.appendChild(sampleColour); element.appendChild(colourBox); diff --git a/source/jquery.syntax.brush.go.js b/source/jquery.syntax.brush.go.js index a376487..f120abe 100644 --- a/source/jquery.syntax.brush.go.js +++ b/source/jquery.syntax.brush.go.js @@ -13,7 +13,7 @@ Syntax.register('go', function(brush) { /complex\d+/g, "byte", "uintptr", - "string", + "string" ]; var operators = ["+", "&", "+=", "&=", "&&", "==", "!=", "-", "|", "-=", "|=", "||", "<", "<=", "*", "^", "*=", "^=", "<-", ">", ">=", "/", "<<", "/=", "<<=", "++", "=", ":=", ",", ";", "%", ">>", "%=", ">>=", "--", "!", "...", ".", ":", "&^", "&^="]; diff --git a/source/jquery.syntax.brush.javascript.js b/source/jquery.syntax.brush.javascript.js index d0ad541..232e9f1 100644 --- a/source/jquery.syntax.brush.javascript.js +++ b/source/jquery.syntax.brush.javascript.js @@ -1,18 +1,21 @@ // brush: "javascript" aliases: ["js", "actionscript"] // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. +// Copyright (c) 2019 Samuel G. D. Williams. // See for licensing details. Syntax.register('javascript', function(brush) { - var keywords = ["function", "break", "case", "catch", "continue", "default", "delete", "do", "else", "for", "if", "in", "instanceof", "new", "return", "super", "switch", "throw", "true", "try", "typeof", "var", "while", "with", "prototype"]; + var keywords = ["async", "await", "break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "export", "extends", "finally", "for", "function", "if", "import", "in", "instanceof", "let", "new", "return", "super", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with", "yield"]; var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">"]; var values = ["this", "true", "false", "null"]; + var access = ["implements", "package", "protected", "interface", "private", "public"]; + brush.push(values, {klass: 'constant'}); brush.push(keywords, {klass: 'keyword'}); brush.push(operators, {klass: 'operator'}); + brush.push(access, {klass: 'access'}); // Regular expressions brush.push(Syntax.lib.perlStyleRegularExpression); @@ -37,4 +40,3 @@ Syntax.register('javascript', function(brush) { // Functions brush.push(Syntax.lib.cStyleFunction); }); - diff --git a/source/jquery.syntax.brush.nginx.js b/source/jquery.syntax.brush.nginx.js new file mode 100644 index 0000000..b6253c7 --- /dev/null +++ b/source/jquery.syntax.brush.nginx.js @@ -0,0 +1,30 @@ +// brush: "nginx" aliases: [] + +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +// Copyright (c) 2011 Samuel G. D. Williams. +// See for licensing details. + +Syntax.register('nginx', function(brush) { + brush.push({ + pattern: /((\w+).*?);/g, + matches: Syntax.extractMatches( + {klass: 'directive', allow: '*'}, + {klass: 'function', process: Syntax.lib.webLinkProcess("http://nginx.org/r/")} + ) + }); + + brush.push({ + pattern: /(\w+).*?{/g, + matches: Syntax.extractMatches( + {klass: 'keyword'} + ) + }); + + brush.push({pattern: /(\$)[\w]+/g, klass: 'variable'}); + + brush.push(Syntax.lib.perlStyleComment); + brush.push(Syntax.lib.singleQuotedString); + brush.push(Syntax.lib.doubleQuotedString); + + brush.push(Syntax.lib.webLink); +}); diff --git a/source/jquery.syntax.brush.ruby.js b/source/jquery.syntax.brush.ruby.js index 5d37ed1..3c82ffc 100644 --- a/source/jquery.syntax.brush.ruby.js +++ b/source/jquery.syntax.brush.ruby.js @@ -40,11 +40,11 @@ Syntax.register('ruby', function(brush) { matches: Syntax.extractMatches({ brush: 'ruby', only: ['string'] - }), + }) }); // Regular expressions - brush.push(Syntax.lib.perlStyleRegularExpression); + brush.push(Syntax.lib.rubyStyleRegularExpression); brush.push({pattern: /(@+|\$)[\w]+/g, klass: 'variable'}); diff --git a/source/jquery.syntax.brush.swift.js b/source/jquery.syntax.brush.swift.js new file mode 100644 index 0000000..1d170c8 --- /dev/null +++ b/source/jquery.syntax.brush.swift.js @@ -0,0 +1,55 @@ +// brush: "swift" aliases: [] + +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +// Copyright (c) 2016 Samuel G. D. Williams. +// See for licensing details. + +Syntax.register('swift', function(brush) { + var keywords = [ + "associatedtype", "class", "deinit", "enum", "extension", "fileprivate", "func", "import", "init", "inout", "internal", "let", "operator", "private", "protocol", "static", "struct", "subscript", "typealias", "var", "break", "case", "continue", "default", "defer", "do", "else", "fallthrough", "for", "guard", "if", "in", "repeat", "return", "switch", "where", "while", "as", "catch", "is", "rethrows", "throw", "throws", "try", "_", "#available", "#colorLiteral", "#column", "#else", "#elseif", "#endif", "#file", "#fileLiteral", "#function", "#if", "#imageLiteral", "#line", "#selector", "#sourceLocation", "associativity", "convenience", "dynamic", "didSet", "final", "get", "infix", "indirect", "lazy", "left", "mutating", "none", "nonmutating", "optional", "override", "postfix", "precedence", "prefix", "Protocol", "required", "right", "set", "Type", "unowned", "weak", "willSet"]; + + var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">", + "(", ")", "{", "}", "[", "]", ".", ",", ":", ";", "=", "@", "#", "->", "`", "?", "!"]; + + var values = ["self", "super", "true", "false", "nil"]; + + var access = ["fileprivate", "open", "private", "public"]; + + brush.push(access, {klass: 'access'}); + brush.push(values, {klass: 'constant'}); + + brush.push({ + pattern: /`[^`]+`/g, + klass: 'identifier' + }); + + brush.push({ + pattern: /\\\(([^)]*)\)/g, + matches: Syntax.extractMatches({ + brush: 'swift', + only: ['string'] + }) + }); + + brush.push(Syntax.lib.camelCaseType); + brush.push(keywords, {klass: 'keyword'}); + brush.push(operators, {klass: 'operator'}); + + // Comments + brush.push(Syntax.lib.cStyleComment); + brush.push(Syntax.lib.cppStyleComment); + brush.push(Syntax.lib.webLink); + + // Strings + brush.push(Syntax.lib.singleQuotedString); + brush.push(Syntax.lib.doubleQuotedString); + brush.push(Syntax.lib.stringEscape); + + // Numbers + brush.push(Syntax.lib.decimalNumber); + brush.push(Syntax.lib.hexNumber); + + // Functions + brush.push(Syntax.lib.cStyleFunction); +}); + diff --git a/source/jquery.syntax.brush.xrb.js b/source/jquery.syntax.brush.xrb.js new file mode 100644 index 0000000..d3f3614 --- /dev/null +++ b/source/jquery.syntax.brush.xrb.js @@ -0,0 +1,35 @@ +// brush: "xrb" aliases: ["trenni"] + +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +// Copyright (c) 2011 Samuel G. D. Williams. +// See for licensing details. + +Syntax.brushes.dependency('xrb', 'xml'); +Syntax.brushes.dependency('xrb', 'ruby'); + +Syntax.register('xrb', function(brush) { + brush.push({ + pattern: /((<\?r)([\s\S]*?)(\?>))/gm, + matches: Syntax.extractMatches( + {klass: 'ruby-tag', allow: ['keyword', 'ruby']}, + {klass: 'keyword'}, + {brush: 'ruby'}, + {klass: 'keyword'} + ) + }); + + brush.push({ + pattern: /((#{)([\s\S]*?)(}))/gm, + matches: Syntax.extractMatches( + {klass: 'ruby-tag', allow: ['keyword', 'ruby']}, + {klass: 'keyword'}, + {brush: 'ruby'}, + {klass: 'keyword'} + ) + }); + + // The position of this statement is important - it determines at what point the rules of the parent are processed. + // In this case, the rules for xml are processed after the rules for html. + brush.derives('xml'); +}); + diff --git a/source/jquery.syntax.core.js b/source/jquery.syntax.core.js index ecc71f8..47ae6de 100644 --- a/source/jquery.syntax.core.js +++ b/source/jquery.syntax.core.js @@ -42,11 +42,33 @@ Syntax.innerText = function(element) { return text.replace(/\r\n?/g, '\n'); } +Syntax.extractTextFromSelection = function(selection) { + var buffer = ""; + + for (var i = 0; i < selection.rangeCount; i += 1) { + var range = selection.getRangeAt(i), + text = range.toString(); + + buffer += text; + } + + return buffer; +} + +Syntax.copyCode = function(event) { + var + selection = window.getSelection(), + text = Syntax.extractTextFromSelection(selection); + + event.clipboardData.setData('text/plain', text); + + return false; +} + // Convert to stack based implementation -Syntax.extractElementMatches = function (elems, offset, tabWidth) { +Syntax.extractElementMatches = function (elems, offset) { var matches = [], current = [elems]; offset = offset || 0; - tabWidth = tabWidth || 4; (function (elems) { for (var i = 0; elems[i]; i++) { @@ -80,105 +102,6 @@ Syntax.extractElementMatches = function (elems, offset, tabWidth) { return matches; } -// Basic layout doesn't do anything e.g. identity layout. -Syntax.layouts.preformatted = function (options, html, container) { - return html; -}; - -Syntax.modeLineOptions = { - 'tab-width': function(name, value, options) { options.tabWidth = parseInt(value, 10); } -}; - -// Should be obvious right? -Syntax.convertTabsToSpaces = function (text, tabSize) { - var space = [], pattern = /\r|\n|\t/g, tabOffset = 0, offsets = [], totalOffset = 0; - tabSize = tabSize || 4 - - for (var i = ""; i.length <= tabSize; i = i + " ") { - space.push(i); - } - - text = text.replace(pattern, function(match) { - var offset = arguments[arguments.length - 2]; - if (match === "\r" || match === "\n") { - tabOffset = -(offset + 1); - return match; - } else { - var width = tabSize - ((tabOffset + offset) % tabSize); - tabOffset += width - 1; - - // Any match after this offset has been shifted right by totalOffset - totalOffset += width - 1 - offsets.push([offset, width, totalOffset]); - - return space[width]; - } - }); - - return {text: text, offsets: offsets}; -}; - -// This function converts from a compressed set of offsets of the form: -// [ -// [offset, width, totalOffset], -// ... -// ] -// This means that at a $offset, a tab (single character) was expanded to $width -// single space characters. -// This function produces a lookup table of offsets, where a given character offset -// is mapped to how far the character has been offset. -Syntax.convertToLinearOffsets = function (offsets, length) { - var current = 0, changes = []; - - // Anything with offset after offset[current][0] but smaller than offset[current+1][0] - // has been shifted right by offset[current][2] - for (var i = 0; i < length; i++) { - if (offsets[current] && i > offsets[current][0]) { - // Is there a next offset? - if (offsets[current+1]) { - // Is the index less than the start of the next offset? - if (i <= offsets[current+1][0]) { - changes.push(offsets[current][2]); - } else { - // If so, move to the next offset. - current += 1; - i -= 1; - } - } else { - // If there is no next offset we assume this one to the end. - changes.push(offsets[current][2]); - } - } else { - changes.push(changes[changes.length-1] || 0); - } - } - - return changes; -} - -// Used for tab expansion process, by shifting matches when tab charaters were converted to -// spaces. -Syntax.updateMatchesWithOffsets = function (matches, linearOffsets, text) { - (function (matches) { - for (var i = 0; i < matches.length; i++) { - var match = matches[i]; - - // Calculate the new start and end points - var offset = match.offset + linearOffsets[match.offset]; - var end = match.offset + match.length; - end += linearOffsets[end]; - - // Start, Length, Text - match.adjust(linearOffsets[match.offset], end - offset, text); - - if (match.children.length > 0) - arguments.callee(match.children); - } - })(matches); - - return matches; -}; - // A helper function which automatically matches expressions with capture groups from the regular expression match. // Each argument position corresponds to the same index regular expression group. // Or, override by providing rule.index @@ -200,7 +123,7 @@ Syntax.extractMatches = function() { } if (rule.debug) { - Syntax.log("extractMatches", rule, index, match[index], match); + console.log("extractMatches", rule, index, match[index], match); } if (match[index].length > 0) { @@ -254,7 +177,9 @@ Syntax.lib.cStyleComment = {pattern: /\/\*[\s\S]*?\*\//gm, klass: 'comment', all Syntax.lib.cppStyleComment = {pattern: /\/\/.*$/gm, klass: 'comment', allow: ['href']}; Syntax.lib.perlStyleComment = {pattern: /#.*$/gm, klass: 'comment', allow: ['href']}; -Syntax.lib.perlStyleRegularExpression = {pattern: /\B\/([^\/]|\\\/)*?\/[a-z]*(?=\s*($|[^\w\s'"\(]))/gm, klass: 'constant', incremental: true}; +// A hackity hack: +Syntax.lib.perlStyleRegularExpression = {pattern: /\B\/([^\\\/]|\\.)*\/[a-z]*(?=\s*($|[^\w\s'"\(]))/gm, klass: 'constant', incremental: true}; +Syntax.lib.rubyStyleRegularExpression = {pattern: /\B\/([^\\\/]|\\.)*\/[a-z]*(?=\s*($|[^\w\s'"\(]|do))/gm, klass: 'constant', incremental: true}; Syntax.lib.cStyleFunction = {pattern: /([a-z_][a-z0-9_]*)\s*\(/gi, matches: Syntax.extractMatches({klass: 'function'})}; Syntax.lib.camelCaseType = {pattern: /\b_*[A-Z][\w]*\b/g, klass: 'type'}; @@ -334,7 +259,13 @@ Syntax.Match.defaultReduceCallback = function (node, container) { // Convert a tree of matches into some flat form (typically HTML nodes). Syntax.Match.prototype.reduce = function (append, process) { var start = this.offset; - var container = document.createElement('span'); + var container = null; + + if (this.expression && this.expression.element) { + container = this.expression.element.cloneNode(false); + } else { + container = document.createElement('span'); + } append = append || Syntax.Match.defaultReduceCallback; @@ -345,11 +276,16 @@ Syntax.Match.prototype.reduce = function (append, process) { container.className += this.expression.klass; } + if (this.className) { + container.className += ' '; + container.className += this.className; + } + for (var i = 0; i < this.children.length; i += 1) { var child = this.children[i], end = child.offset; if (child.offset < this.offset) { - Syntax.log("Syntax Warning: Offset of child", child, "is before offset of parent", this); + console.log("Syntax Warning: Offset of child", child, "is before offset of parent", this); } var text = this.value.substr(start - this.offset, end - start); @@ -365,7 +301,7 @@ Syntax.Match.prototype.reduce = function (append, process) { } else if (start < this.endOffset) { append(this.value.substr(start - this.offset, this.endOffset - start), container); } else if (start > this.endOffset) { - Syntax.log("Syntax Warning: Start position " + start + " exceeds end of value " + this.endOffset); + console.log("Syntax Warning: Start position " + start + " exceeds end of value " + this.endOffset); } if (process) { @@ -531,7 +467,7 @@ Syntax.Match.prototype._insertWhole = function(match) { // This function also ensures that matches won't be broken up unless absolutely necessary. Syntax.Match.prototype.insertAtEnd = function(match) { if (!this.contains(match)) { - Syntax.log("Syntax Error: Child is not contained in parent node!"); + console.log("Syntax Error: Child is not contained in parent node!"); return null; } @@ -576,9 +512,6 @@ Syntax.Match.prototype.insertAtEnd = function(match) { // Displacement: After return this._splice(i+1, match); } - - // Could not find a suitable placement: this is probably an error. - return null; } else { // Displacement: Contains [but currently no children] return this._splice(0, match); @@ -783,7 +716,7 @@ Syntax.Match.prototype.bisectAtOffsets = function(splits) { } if (children.length) { - Syntax.log("Syntax Error: Children nodes not consumed", children.length, " remaining!"); + console.log("Syntax Error: Children nodes not consumed", children.length, " remaining!"); } return parts; @@ -807,6 +740,31 @@ Syntax.Match.prototype.split = function(pattern) { }); }; +Syntax.Match.prototype.splitLines = function() { + var lines = this.split(/\n/g); + + for (var i = 0; i < lines.length; i += 1) { + var line = lines[i]; + var indentOffset = line.value.search(/\S/); + + var top = new Syntax.Match(line.offset, line.length, line.expression, line.value); + + if (indentOffset > 0) { + var parts = line.bisectAtOffsets([line.offset + indentOffset]); + top.children = parts; + parts[0].expression = {klass: 'indent'}; + parts[1].expression = {klass: 'text'}; + } else { + line.expression = {klass: 'text'}; + top.children = [line]; + } + + lines[i] = top; + } + + return lines; +} + Syntax.Brush = function () { // The primary class of this brush. Must be unique. this.klass = null; @@ -829,7 +787,7 @@ Syntax.Brush.prototype.derives = function (name) { return Syntax.brushes[name].getMatches(text); } }); -} +}; // Return an array of all classes that the brush consists of. // A derivied brush is its own klass + the klass of any and all parents. @@ -931,7 +889,7 @@ Syntax.Brush.prototype.push = function () { if (rule.pattern && rule.pattern.global || typeof(rule.pattern) == 'undefined') { this.rules.push(jQuery.extend({owner: this}, rule)); } else { - Syntax.log("Syntax Error: Malformed rule: ", rule); + console.log("Syntax Error: Malformed rule: ", rule); } } }; @@ -945,7 +903,7 @@ Syntax.Brush.prototype.getMatchesForRule = function (text, rule) { } if (rule.debug) { - Syntax.log("Syntax matches:", rule, text, matches); + console.log("Syntax matches:", rule, text, matches); } return matches; @@ -1037,10 +995,10 @@ Syntax.Brush.prototype.buildTree = function(text, offset, additionalMatches) { Syntax.Brush.prototype.process = function(text, matches, options) { var top = this.buildTree(text, 0, matches); - var lines = top.split(/\n/g); + var lines = top.splitLines(); - var html = document.createElement('pre'); - html.className = 'syntax'; + var html = document.createElement('code'); + html.className = 'syntax highlighted'; for (var i = 0; i < lines.length; i += 1) { var line = lines[i].reduce(null, function (container, match) { @@ -1069,28 +1027,14 @@ Syntax.Brush.prototype.process = function(text, matches, options) { // options.brush should specify the brush to use, either by direct reference // or name. // Callback will be called with (highlighted_html, brush_used, original_text, options) -Syntax.highlightText = function(text, options, callback) { - var brushName = (options.brush || 'plain').toLowerCase(); - - brushName = Syntax.aliases[brushName] || brushName; +Syntax.highlightText = function(text, brush, matches, options, callback) { + brush = (brush || 'plain').toLowerCase(); + brush = Syntax.aliases[brush] || brush; - Syntax.brushes.get(brushName, function(brush) { - if (options.tabWidth) { - // Calculate the tab expansion and offsets - replacement = Syntax.convertTabsToSpaces(text, options.tabWidth); - - // Update any existing matches - if (options.matches && options.matches.length) { - var linearOffsets = Syntax.convertToLinearOffsets(replacement.offsets, text.length); - options.matches = Syntax.updateMatchesWithOffsets(options.matches, linearOffsets, replacement.text); - } - - text = replacement.text; - } - - var html = brush.process(text, options.matches, options); + Syntax.brushes.get(brush, function(brush) { + var html = brush.process(text, matches, options); - if (options.linkify !== false) { + if (options.linkify) { jQuery('span.href', html).each(function(){ jQuery(this).replaceWith(jQuery('
').attr('href', this.innerHTML).text(this.innerHTML)); }); @@ -1100,75 +1044,74 @@ Syntax.highlightText = function(text, options, callback) { }); } -// Highlight a given set of elements with a set of options. -// Callback will be called once per element with (options, highlighted_html, original_container) -Syntax.highlight = function (elements, options, callback) { - if (typeof(options) === 'function') { - callback = options; - options = {}; - } +Syntax.extractBrushName = function (className) { + // brush names are by default lower case - normalize so we can detect it. + className = className.toLowerCase(); - options.layout = options.layout || 'preformatted'; - options.matches = []; + var match = className.match(/(brush|language)-([\S]+)/); - if (typeof(options.tabWidth) === 'undefined') { - options.tabWidth = 4; + if (match) { + return match[2]; + } else { + var classes = className.split(/ /); + + if (jQuery.inArray("syntax", classes) !== -1) { + for (var i = 0; i < classes.length; i += 1) { + var name = Syntax.aliases[classes[i]]; + + if (name) { + return name; + } + } + } } + return null; +} + +// Highlight a given set of elements with a set of options. +// Callback will be called once per element with (options, highlighted_html, original_container) +Syntax.highlight = function (elements, options, callback) { elements.each(function () { var container = jQuery(this); + var brush = options.brush || Syntax.extractBrushName(this.className); + var text = Syntax.innerText(this); // We can augment the plain text to extract existing annotations (e.g. ...). - options.matches = options.matches.concat(Syntax.extractElementMatches(container)); - - var text = Syntax.innerText(this); + var matches = Syntax.extractElementMatches(container); - var match = text.match(/-\*- mode: (.+?);(.*?)-\*-/i); - var endOfSecondLine = text.indexOf("\n", text.indexOf("\n") + 1); - - if (match && match.index < endOfSecondLine) { - options.brush = options.brush || match[1]; - var modeline = match[2]; - - var mode = /([a-z\-]+)\:(.*?)\;/gi; - - while((match = mode.exec(modeline)) !== null) { - var setter = Syntax.modeLineOptions[match[1]]; - - if (setter) { - setter(match[1], match[2], options); - } - } + if (options.matches) { + Array.prototype.push(matches, options.matches); } - Syntax.highlightText(text, options, function(html, brush/*, text, options*/) { - Syntax.layouts.get(options.layout, function(layout) { - html = layout(options, $(html), $(container)); - - // If there is a theme specified, ensure it is added to the top level class. - if (options.theme) { - // Load dependencies - var themes = Syntax.themes[options.theme]; - for (var i = 0; i < themes.length; i += 1) { - html.addClass("syntax-theme-" + themes[i]); - } - - // Add the base theme - html.addClass("syntax-theme-" + options.theme); + Syntax.highlightText(text, brush, matches, options, function(html, brush/*, text, options*/) { + html.oncopy = Syntax.copyCode; + + html = jQuery(html); + + // If there is a theme specified, ensure it is added to the top level class. + if (options.theme) { + // Load dependencies + var themes = Syntax.themes[options.theme]; + for (var i = 0; i < themes.length; i += 1) { + html.addClass("syntax-theme-" + themes[i]); } - if (brush.postprocess) { - html = brush.postprocess(options, html, container); - } + // Add the base theme + html.addClass("syntax-theme-" + options.theme); + } - if (callback) { - html = callback(options, html, container); - } + if (brush.postprocess) { + html = brush.postprocess(options, html, container); + } - if (html && options.replace === true) { - container.replaceWith(html); - } - }); + if (callback) { + html = callback(options, html, container); + } + + if (html && options.replace === true) { + container.replaceWith(html); + } }); }); }; diff --git a/source/jquery.syntax.layout.editor.js b/source/jquery.syntax.editor.js similarity index 99% rename from source/jquery.syntax.layout.editor.js rename to source/jquery.syntax.editor.js index 0a8c009..bd707f2 100644 --- a/source/jquery.syntax.layout.editor.js +++ b/source/jquery.syntax.editor.js @@ -45,7 +45,7 @@ Syntax.Editor.prototype.getLines = function() { offsets.push(startChild); - Syntax.log("getLines", offsets, lines, children); + console.log("getLines", offsets, lines, children); return {lines: lines, offsets: offsets}; } diff --git a/source/jquery.syntax.js b/source/jquery.syntax.js index 1325ea0..b909666 100644 --- a/source/jquery.syntax.js +++ b/source/jquery.syntax.js @@ -92,9 +92,11 @@ ResourceLoader.prototype.dependency = function (current, next) { } }; -// This function must be reentrant for the same name and different callbacks. +// This function must be reentrant for the same name. Additionally, if name is undefined, the callback will be invoked but with no argument. ResourceLoader.prototype.get = function (name, callback) { - if (this.loading[name]) { + if (name == undefined) { + callback(); + } else if (this.loading[name]) { this.loading[name].push(callback) } else if (this[name]) { callback(this[name]); @@ -110,10 +112,15 @@ var Syntax = { styles: {}, themes: {}, lib: {}, + + cacheScripts: true, + cacheStyleSheets: true, + codeSelector: 'code:not(.highlighted)', + defaultOptions: { - cacheScripts: true, - cacheStyleSheets: true, - theme: "base" + theme: "base", + replace: true, + linkify: true }, brushes: new ResourceLoader(function (name, callback) { @@ -122,10 +129,6 @@ var Syntax = { Syntax.getResource('jquery.syntax.brush', name, callback); }), - layouts: new ResourceLoader(function (name, callback) { - Syntax.getResource('jquery.syntax.layout', name, callback); - }), - loader: new ResourceLoader(function (name, callback) { Syntax.getResource('jquery.syntax', name, callback); }), @@ -134,7 +137,7 @@ var Syntax = { var link = jQuery(''); jQuery("head").append(link); - if (!Syntax.defaultOptions.cacheStyleSheets) { + if (!Syntax.cacheStyleSheets) { path = path + "?" + Math.random() } @@ -148,21 +151,10 @@ var Syntax = { getScript: function (path, callback) { var script = document.createElement('script'); - // Internet Exploder - script.onreadystatechange = function() { - if (this.onload && (this.readyState == 'loaded' || this.readyState == 'complete')) { - this.onload(); - - // Ensure the function is only called once. - this.onload = null; - } - }; - - // Every other modern browser script.onload = callback; script.type = "text/javascript"; - if (!Syntax.defaultOptions.cacheScripts) + if (!Syntax.cacheScripts) path = path + '?' + Math.random() script.src = path; @@ -171,6 +163,8 @@ var Syntax = { }, getResource: function (prefix, name, callback) { + Syntax.detectRoot(); + var basename = prefix + "." + name; var styles = this.styles[basename]; @@ -215,31 +209,6 @@ var Syntax = { return names; }, - extractBrushName: function (className) { - // brush names are by default lower case - normalize so we can detect it. - className = className.toLowerCase(); - - var match = className.match(/brush-([\S]+)/); - - if (match) { - return match[1]; - } else { - var classes = className.split(/ /); - - if (jQuery.inArray("syntax", classes) !== -1) { - for (var i = 0; i < classes.length; i += 1) { - var name = Syntax.aliases[classes[i]]; - - if (name) { - return name; - } - } - } - } - - return null; - }, - detectRoot: function () { if (Syntax.root == null) { // Initialize root based on current script path. @@ -258,60 +227,21 @@ var Syntax = { } } } - }, - - log: function() { - if (typeof(console) != "undefined" && console.log) { - console.log.apply(console, arguments); - } else if (window.console && window.console.log) { - window.console.log.apply(window.console, arguments); - } } }; jQuery.fn.syntax = function (options, callback) { - Syntax.detectRoot(); + if (this.length == 0) return; - var elements = this; + options = jQuery.extend(Syntax.defaultOptions, options) - Syntax.loader.get('core', function () { - Syntax.highlight(elements, options, callback); - }); + Syntax.loader.get('core', function (elements) { + Syntax.highlight(this, options, callback); + }.bind(this)); }; jQuery.syntax = function (options, callback) { - options = options || {}; - var context = options.context; - - if (options.root) { - Syntax.root = options.root; - } else { - Syntax.detectRoot(); - } - - options = jQuery.extend(Syntax.defaultOptions, options) - - options.blockSelector = options.blockSelector || 'pre.syntax:not(.highlighted)'; - options.inlineSelector = options.inlineSelector || 'code.syntax:not(.highlighted)'; - - options.blockLayout = options.blockLayout || 'list'; - options.inlineLayout = options.inlineLayout || 'inline'; - - // Allow the user to specify callbacks without replacement. - if (typeof options.replace == "undefined") - options.replace = true; - - jQuery(options.blockSelector, context).each(function () { - jQuery(this).syntax(jQuery.extend({}, options, { - brush: Syntax.extractBrushName(this.className), - layout: options.blockLayout - }), callback); - }); + var context = options ? options.context : null; - jQuery(options.inlineSelector, context).each(function () { - jQuery(this).syntax(jQuery.extend({}, options, { - brush: Syntax.extractBrushName(this.className), - layout: options.inlineLayout - }), callback); - }); + jQuery(Syntax.codeSelector, context).syntax(options, callback); }; diff --git a/source/jquery.syntax.layout.fixed.js b/source/jquery.syntax.layout.fixed.js deleted file mode 100644 index f51c0bc..0000000 --- a/source/jquery.syntax.layout.fixed.js +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -// This layout doesn't work correctly in IE6, but is fine in all other tested browsers. -Syntax.layouts.fixed = function(options, code, container) { - var fixed = jQuery('
'), line = 1, space = /^\s*$/; - var toolbar = jQuery('
'); - - var rawCode = container.clone(); - rawCode.addClass("raw syntax highlighted"); - - var codeTable = document.createElement('table'); - - var codeTableBody = document.createElement('tbody'); - codeTable.appendChild(codeTableBody); - - var numbersColumn = jQuery('
'); - var codeColumn = jQuery('
'); - - // Source code - code.children().each(function() { - var lineNumber = document.createElement('div'); - lineNumber.className = "line ln" + line - lineNumber.innerHTML = line; - numbersColumn.append(lineNumber); - - var lineCode = document.createElement('td'); - lineCode.className = "source " + this.className; - - if (line % 2) { - lineCode.className += " alt"; - } - - if (lineCode == 1) { - lineNumber.className += " first" - } - - // Thanks to Michael for suggesting the obvious :) - lineCode.appendChild(this); - - var tr = document.createElement('tr'); - tr.appendChild(lineCode); - codeTableBody.appendChild(tr); - - line = line + 1; - }); - - codeColumn.append(codeTable); - - fixed.append(numbersColumn); - fixed.append(codeColumn); - - a = jQuery('View Raw Code'); - a.click(function (event) { - event.preventDefault(); - - if (jQuery(fixed).is(':visible')) { - rawCode.height(jQuery(fixed).height()); - jQuery(fixed).replaceWith(rawCode); - } else { - jQuery(rawCode).replaceWith(fixed); - } - }); - - toolbar.append(a); - toolbar.append('?'); - - return jQuery('
').append(toolbar).append(fixed); -}; diff --git a/source/jquery.syntax.layout.inline.js b/source/jquery.syntax.layout.inline.js deleted file mode 100644 index 4a94350..0000000 --- a/source/jquery.syntax.layout.inline.js +++ /dev/null @@ -1,13 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.layouts.inline = function(options, code, container) { - var inline = jQuery(''); - inline.append(code.children()); - - var container = jQuery(''); - container.append(inline); - - return container; -}; diff --git a/source/jquery.syntax.layout.list.js b/source/jquery.syntax.layout.list.js deleted file mode 100644 index 0dcf6d8..0000000 --- a/source/jquery.syntax.layout.list.js +++ /dev/null @@ -1,54 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.layouts.list = function(options, code, container) { - var listTag = options.listTag || 'ol'; - - var list = jQuery('<' + listTag + ' class="syntax highlighted">'), line = 1, space = /^\s*$/; - var toolbar = jQuery('
'); - - var rawCode = container.clone(); - rawCode.addClass("raw syntax highlighted"); - - // Source code - code.children().each(function() { - var li = document.createElement('li'); - li.className = "line ln" + line - - if (line % 2) { - li.className += " alt"; - } - - if (line == 1) { - li.className += " first" - } - - var div = document.createElement('div'); - div.className = "source " + this.className; - - div.appendChild(this); - - li.appendChild(div); - list[0].appendChild(li); - - line = line + 1; - }); - - a = jQuery('View Raw Code'); - a.click(function (event) { - event.preventDefault(); - - if (jQuery(list).is(':visible')) { - rawCode.height(jQuery(list).height()); - jQuery(list).replaceWith(rawCode); - } else { - jQuery(rawCode).replaceWith(list); - } - }); - - toolbar.append(a); - toolbar.append('?'); - - return jQuery('
').append(toolbar).append(list); -}; diff --git a/source/jquery.syntax.layout.plain.js b/source/jquery.syntax.layout.plain.js deleted file mode 100644 index 877590d..0000000 --- a/source/jquery.syntax.layout.plain.js +++ /dev/null @@ -1,15 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -// This layout doesn't work correctly in IE6, but is fine in all other tested browsers. -Syntax.layouts.plain = function(options, code, container) { - var toolbar = jQuery('
'); - - var scrollContainer = jQuery('
'); - code.removeClass('syntax'); - - scrollContainer.append(code); - - return jQuery('
').append(toolbar).append(scrollContainer); -}; diff --git a/source/jquery.syntax.layout.table.js b/source/jquery.syntax.layout.table.js deleted file mode 100644 index fbd656f..0000000 --- a/source/jquery.syntax.layout.table.js +++ /dev/null @@ -1,58 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -Syntax.layouts.table = function(options, code, container) { - var table = jQuery('
'), tr = null, td = null, a = null, line = 1; - var tbody = document.createElement('tbody'); - var toolbar = jQuery('
'); - - var rawCode = container.clone(); - rawCode.addClass("raw syntax highlighted"); - - // Source code - code.children().each(function() { - tr = document.createElement('tr'); - tr.className = "line ln" + line; - - if (line % 2) { - tr.className += " alt"; - } - - td = document.createElement('td'); - td.className = "number"; - - number = document.createElement('span'); - number.innerHTML = line; - td.appendChild(number); - tr.appendChild(td); - - td = document.createElement('td'); - td.className = "source"; - - td.appendChild(this); - tr.appendChild(td); - - tbody.appendChild(tr); - line = line + 1; - }); - - table.append(tbody); - - a = jQuery('View Raw Code'); - a.click(function (event) { - event.preventDefault(); - - if (jQuery(table).is(':visible')) { - rawCode.height(jQuery(table).height()); - jQuery(table).replaceWith(rawCode); - } else { - jQuery(rawCode).replaceWith(table); - } - }); - - toolbar.append(a); - toolbar.append('?'); - - return jQuery('
').append(toolbar).append(table); -}; diff --git a/themes/base/_clean.scss b/themes/base/_clean.scss deleted file mode 100644 index ec9670f..0000000 --- a/themes/base/_clean.scss +++ /dev/null @@ -1,10 +0,0 @@ - -pre.syntax { - line-height: 1.6em; - letter-spacing: 0.05em; - margin: 1em 20pt 1em; -} - -.syntax-container { - padding: 1em 20pt 1em; -} diff --git a/themes/base/_layout.scss b/themes/base/_layout.scss deleted file mode 100644 index 43a1e76..0000000 --- a/themes/base/_layout.scss +++ /dev/null @@ -1,18 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -@mixin pre-wrap { - /* CSS2.1 */ - white-space: pre-wrap; - - /* Mozilla, since 1999 */ - white-space: -moz-pre-wrap; - - /* Opera 7 */ - white-space: -o-pre-wrap; - - /* Internet Explorer 5.5+ */ - word-wrap: break-word; - _white-space: pre; -} diff --git a/themes/base/jquery.syntax.brush.apache.sass b/themes/base/jquery.syntax.brush.apache.sass index 9fb7ebc..bb9cbe6 100644 --- a/themes/base/jquery.syntax.brush.apache.sass +++ b/themes/base/jquery.syntax.brush.apache.sass @@ -3,7 +3,7 @@ // See for licensing details. .syntax-theme-base - .syntax .apache + .apache .tag color: #00c @@ -12,3 +12,12 @@ .tag-name font-weight: bold + +@media (prefers-color-scheme: dark) + .syntax-theme-base + .apache + .tag + color: lighten(#00c, 30%) + + .tag-name + color: lighten(#00f, 30%) diff --git a/themes/base/jquery.syntax.brush.applescript.sass b/themes/base/jquery.syntax.brush.applescript.sass index e7aaf9e..52ced90 100644 --- a/themes/base/jquery.syntax.brush.applescript.sass +++ b/themes/base/jquery.syntax.brush.applescript.sass @@ -3,7 +3,7 @@ // See for licensing details. .syntax-theme-base - .syntax .applescript + .applescript font-family: Geneva, Helvetica, sans-serif .keyword diff --git a/themes/base/jquery.syntax.brush.assembly.sass b/themes/base/jquery.syntax.brush.assembly.sass index 3b272f0..24d2caa 100644 --- a/themes/base/jquery.syntax.brush.assembly.sass +++ b/themes/base/jquery.syntax.brush.assembly.sass @@ -3,7 +3,7 @@ // See for licensing details. .syntax-theme-base - .syntax .assembly + .assembly .register color: #3caa20 font-style: italic diff --git a/themes/base/jquery.syntax.brush.bash-script.sass b/themes/base/jquery.syntax.brush.bash-script.sass index 7c113cf..1cc1ae0 100644 --- a/themes/base/jquery.syntax.brush.bash-script.sass +++ b/themes/base/jquery.syntax.brush.bash-script.sass @@ -3,10 +3,7 @@ // See for licensing details. .syntax-theme-base - .syntax .bash-script - .function - font-weight: bold - + .bash-script .option color: #03f diff --git a/themes/base/jquery.syntax.brush.bash.sass b/themes/base/jquery.syntax.brush.bash.sass index f1d9f8b..a0ce116 100644 --- a/themes/base/jquery.syntax.brush.bash.sass +++ b/themes/base/jquery.syntax.brush.bash.sass @@ -3,17 +3,6 @@ // See for licensing details. .syntax-theme-base - .syntax .bash - .prompt - color: #0c0 - font-weight: bold - - color: #555 - font-style: italic - - .bash-script - font-style: normal - color: black - + .bash .stderr color: red \ No newline at end of file diff --git a/themes/base/jquery.syntax.brush.clang.sass b/themes/base/jquery.syntax.brush.clang.sass index 4ffd4d3..1af9b92 100644 --- a/themes/base/jquery.syntax.brush.clang.sass +++ b/themes/base/jquery.syntax.brush.clang.sass @@ -3,6 +3,10 @@ // See for licensing details. .syntax-theme-base - .syntax .preprocessor + .preprocessor color: #63381f - font-style: italic + +@media (prefers-color-scheme: dark) + .syntax-theme-base + .preprocessor + color: lighten(#63381f, 30%) diff --git a/themes/base/jquery.syntax.brush.css.sass b/themes/base/jquery.syntax.brush.css.sass index 430f43b..9ba0fdd 100644 --- a/themes/base/jquery.syntax.brush.css.sass +++ b/themes/base/jquery.syntax.brush.css.sass @@ -3,7 +3,7 @@ // See for licensing details. .syntax-theme-base - .syntax .css + .css .selector color: #458 font-weight: bold diff --git a/themes/base/jquery.syntax.brush.diff.sass b/themes/base/jquery.syntax.brush.diff.sass index b5643cc..45f87c7 100644 --- a/themes/base/jquery.syntax.brush.diff.sass +++ b/themes/base/jquery.syntax.brush.diff.sass @@ -3,24 +3,23 @@ // See for licensing details. .syntax-theme-base - .syntax - .add - color: green + .add + color: green - .del - color: red + .del + color: red - .insert - color: green - .insert-line - background-color: #cfc !important + .insert + color: green + .insert-line + background-color: #cfc !important - .remove - color: red - .remove-line - background-color: #fcc !important + .remove + color: red + .remove-line + background-color: #fcc !important - .offset - color: blue - .offset-line - background-color: #ccf !important \ No newline at end of file + .offset + color: blue + .offset-line + background-color: #ccf !important \ No newline at end of file diff --git a/themes/base/jquery.syntax.brush.html.sass b/themes/base/jquery.syntax.brush.html.sass index 8edb255..36ab858 100644 --- a/themes/base/jquery.syntax.brush.html.sass +++ b/themes/base/jquery.syntax.brush.html.sass @@ -3,10 +3,7 @@ // See for licensing details. .syntax-theme-base - .syntax .html + .html .doctype font-weight: bold color: #938 - - .javascript, .css - font-style: italic \ No newline at end of file diff --git a/themes/base/jquery.syntax.brush.python.sass b/themes/base/jquery.syntax.brush.python.sass index ec453c3..b2269a1 100644 --- a/themes/base/jquery.syntax.brush.python.sass +++ b/themes/base/jquery.syntax.brush.python.sass @@ -3,7 +3,7 @@ // See for licensing details. .syntax-theme-base - .syntax .python + .python .decorator color: #ffb600 font-weight: bold diff --git a/themes/base/jquery.syntax.brush.ruby.sass b/themes/base/jquery.syntax.brush.ruby.sass index 19630e8..327b3b5 100644 --- a/themes/base/jquery.syntax.brush.ruby.sass +++ b/themes/base/jquery.syntax.brush.ruby.sass @@ -4,6 +4,6 @@ // This small hack ensures that string interpolations are displayed correctly .syntax-theme-base - .syntax .ruby + .ruby .string .ruby - color: #000 \ No newline at end of file + color: #808080 diff --git a/themes/base/jquery.syntax.brush.xml.sass b/themes/base/jquery.syntax.brush.xml.sass index 3b421bd..3df01f7 100644 --- a/themes/base/jquery.syntax.brush.xml.sass +++ b/themes/base/jquery.syntax.brush.xml.sass @@ -3,7 +3,7 @@ // See for licensing details. .syntax-theme-base - .syntax .xml + .xml .cdata-content color: #046 border-radius: 0.5em @@ -28,3 +28,28 @@ color: #666 background-color: #ddd border-radius: 0.5em + +@media (prefers-color-scheme: dark) + .syntax-theme-base + .xml + .cdata-content + color: #a46 + + .xml-tag, .cdata + color: #c59de7 + + .tag-name, .cdata-tag + color: #9ae + + .namespace + color: #c59de7 + + .attribute + color: #c59de7 + + .instruction + color: #c59de7 + + .entity, .percent-escape + color: #999 + background-color: #333 diff --git a/themes/base/jquery.syntax.core.sass b/themes/base/jquery.syntax.core.sass index 9d7c4ff..81abfb3 100644 --- a/themes/base/jquery.syntax.core.sass +++ b/themes/base/jquery.syntax.core.sass @@ -2,61 +2,85 @@ // Copyright (c) 2011 Samuel G. D. Williams. // See for licensing details. +pre code.syntax-theme-base + display: block + + > span + display: flex + + .indent + flex-grow: 0 + flex-shrink: 0 + + .text + white-space: pre-wrap + padding-left: 2ch + text-indent: -2ch + .syntax-theme-base - .syntax - font-family: Menlo, Monaco, Consolas, monospace - line-height: 1.5em + a + text-decoration: none + color: inherit + + .function + color: #33f + + .keyword, .access, .option + color: darken(#a90d91, 10%) + + .type + color: #3239D6 + + .comment + color: #6ac + + .constant + color: #1c00ce + + .string, .symbol + color: #c41a15 + + .string .escape + color: #f99 + + .operator + color: black + .href + color: #0e0eff + text-decoration: underline + + .variable + color: #466997 + + .highlight + background-color: opacify(#fdfdba, 0.5) + +@media (prefers-color-scheme: dark) + .syntax-theme-base + .operator + color: white + .function - color: #33f + color: #c59de7 - .keyword, .access - color: darken(#a90d91, 10%) + .keyword, .access, .option + color: darken(#98c6ff, 20%) .type - color: #3239D6 + color: #37a4ff .comment - color: #6ac + color: #849fca .constant - color: #1c00ce + color: lighten(#9d7c31, 15%) .string, .symbol - color: #c41a15 + color: lighten(#e43c3a, 15%) .string .escape color: #f99 - - .operator - color: #000000 - - .href - color: #0e0eff - text-decoration: underline - + .variable - color: #466997 - - .highlight - background-color: opacify(#fdfdba, 0.5) - - pre - overflow: auto - font-family: inherit - -.syntax-container.syntax-theme-base - position: relative - .toolbar - font-size: 80% - text-align: right - padding: 0 0.2em 0.2em - a - margin-left: 1em - - pre.raw - overflow: auto - padding: 0 0.4em 0 !important - margin: 0 !important - background-color: $background-primary - border: 1px solid $border-primary \ No newline at end of file + color: #6e6dff diff --git a/themes/base/jquery.syntax.layout.editor.sass b/themes/base/jquery.syntax.editor.sass similarity index 85% rename from themes/base/jquery.syntax.layout.editor.sass rename to themes/base/jquery.syntax.editor.sass index b0e48ba..6796777 100644 --- a/themes/base/jquery.syntax.layout.editor.sass +++ b/themes/base/jquery.syntax.editor.sass @@ -4,8 +4,6 @@ .syntax-container.syntax-theme-base div.editor.syntax - background-color: white - border: 1px inset $border-primary padding: 0.2em !important margin: 0 !important white-space: pre diff --git a/themes/base/jquery.syntax.layout.fixed.sass b/themes/base/jquery.syntax.layout.fixed.sass deleted file mode 100644 index c5ed109..0000000 --- a/themes/base/jquery.syntax.layout.fixed.sass +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -.syntax-container.syntax-theme-base - div.fixed.syntax - background-color: darken($background-primary, 5%) - border: 1px solid $border-primary - padding: 0 !important - margin: 0 !important - - .numbers-column - float: left - text-align: right - margin-right: 0em - width: 3em - color: darken($background-primary, 35%) - background-color: darken($background-primary, 5%) - div - padding: 0 0.4em 0 !important - - .code-column - border-left: 1px solid $border-primary - overflow: auto - background-color: $background-primary - table - border-collapse: collapse - width: 100% - white-space: pre - .source - margin: auto !important - color: $code-primary - padding: 0 0.4em 0 !important - .source.alt - background-color: lighten($background-primary, 2%) \ No newline at end of file diff --git a/themes/base/jquery.syntax.layout.inline.sass b/themes/base/jquery.syntax.layout.inline.sass deleted file mode 100644 index 1b496e5..0000000 --- a/themes/base/jquery.syntax.layout.inline.sass +++ /dev/null @@ -1,7 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -.syntax-container.syntax-theme-base - code.syntax - //background-color: $background-primary diff --git a/themes/base/jquery.syntax.layout.list.sass b/themes/base/jquery.syntax.layout.list.sass deleted file mode 100644 index f00f4e1..0000000 --- a/themes/base/jquery.syntax.layout.list.sass +++ /dev/null @@ -1,49 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -@import "_layout" - -.syntax-container.syntax-theme-base - ol.syntax - background-color: darken($background-primary, 5%) - border: 1px solid $border-primary - padding: 0 0 0 5em !important - margin: 0 !important - - li - padding: 0 !important - margin: 0 !important - color: darken($background-primary, 35%) - +pre-wrap - - li div.source - color: $code-primary - margin-left: -0.5em - border-left: 1px solid $border-primary - background-color: $background-primary - padding: 0 0.4em 0 !important - - li.alt div.source - background-color: lighten($background-primary, 2%) - - ul.syntax - background-color: darken($background-primary, 5%) - border: 1px solid $border-primary - padding: 0 !important - margin: 0 !important - list-style-type: none - - li - padding: 0 !important - margin: 0 !important - +pre-wrap - - li div.source - margin: 0 !important - color: $code-primary - background-color: $background-primary - padding: 0 0.4em 0 !important - - li.alt div.source - background-color: lighten($background-primary, 2%) diff --git a/themes/base/jquery.syntax.layout.plain.sass b/themes/base/jquery.syntax.layout.plain.sass deleted file mode 100644 index 73ca7f7..0000000 --- a/themes/base/jquery.syntax.layout.plain.sass +++ /dev/null @@ -1,16 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -@import "_layout" - -.syntax-container.syntax-theme-base - .syntax.plain - background-color: $background-primary - padding: 0.6em - border: 1px solid $border-primary - - pre - margin: 0 - font-family: inherit - overflow: auto \ No newline at end of file diff --git a/themes/base/jquery.syntax.layout.table.sass b/themes/base/jquery.syntax.layout.table.sass deleted file mode 100644 index db9a22f..0000000 --- a/themes/base/jquery.syntax.layout.table.sass +++ /dev/null @@ -1,33 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -@import "_layout" - -.syntax-container.syntax-theme-base - table.syntax - border-collapse: collapse - background-color: $background-primary - border: 1px solid $border-primary - padding: 0 !important - margin: 0 !important - width: 100% - - tr.alt td.source - background-color: lighten($background-primary, 2%) - - td.source - padding: 0 0.4em 0 - color: $code-primary - +pre-wrap - - td.number - padding: 0 0.4em 0 - user-select: none - -moz-user-select: none - -webkit-user-select: none - border-right: 1px solid #aaa - text-align: right - width: 2.5em - color: darken($background-primary, 35%) - background-color: darken($background-primary, 5%) diff --git a/themes/base/master.sass b/themes/base/master.sass deleted file mode 100644 index 05a7875..0000000 --- a/themes/base/master.sass +++ /dev/null @@ -1,12 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -$background-primary: #f0f0f0 -$border-primary: #aaa -$code-primary: #333 - -// #f9fbfc, #e3eef9 -// $background-primary: #f9fbfc -// $border-primary: #ccf -// $code-primary: #333 \ No newline at end of file diff --git a/themes/modern/jquery.syntax.layout.editor.sass b/themes/modern/jquery.syntax.layout.editor.sass deleted file mode 100644 index 6f581a9..0000000 --- a/themes/modern/jquery.syntax.layout.editor.sass +++ /dev/null @@ -1,7 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -.syntax-container.syntax-theme-modern - div.editor.syntax - -webkit-box-shadow: inset 0px 2px 3px #969696 diff --git a/themes/modern/jquery.syntax.layout.inline.sass b/themes/modern/jquery.syntax.layout.inline.sass deleted file mode 100644 index 0389cea..0000000 --- a/themes/modern/jquery.syntax.layout.inline.sass +++ /dev/null @@ -1,9 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -.syntax-container.syntax-theme-modern - code.syntax - @include modern-gradient(white, $background-primary) - @include modern-border-radius(0.6em) - @include modern-box-shadow \ No newline at end of file diff --git a/themes/modern/jquery.syntax.layout.plain.sass b/themes/modern/jquery.syntax.layout.plain.sass deleted file mode 100644 index 758a94b..0000000 --- a/themes/modern/jquery.syntax.layout.plain.sass +++ /dev/null @@ -1,16 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -.syntax-container.syntax-theme-modern - .syntax.plain - @include modern-gradient(white, $background-primary) - @include modern-border-radius(0.6em) - @include modern-box-shadow - padding: 0.6em - border: 1px solid $border-primary - - pre - margin: 0 - font-family: inherit - overflow: auto \ No newline at end of file diff --git a/themes/modern/master.scss b/themes/modern/master.scss deleted file mode 100644 index a53897b..0000000 --- a/themes/modern/master.scss +++ /dev/null @@ -1,22 +0,0 @@ -// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. -// Copyright (c) 2011 Samuel G. D. Williams. -// See for licensing details. - -@mixin modern-gradient($first, $second) { - background: $second; - filter: progid:DXImageTransform.Microsoft.gradient(StartColorStr='#{$first}', EndColorStr='#{$second}'); - background: -webkit-gradient(linear, left top, left bottom, from($first), to($second)); - background: -moz-linear-gradient(top, $first, $second); -} - -@mixin modern-border-radius($size) { - border-radius: $size; - -webkit-border-radius: $size; - -moz-border-radius: $size; -} - -@mixin modern-box-shadow { - -moz-box-shadow: 1px 1px 3px #ddd; - -webkit-box-shadow: 1px 1px 3px #ddd; - box-shadow: 1px 1px 3px #ddd; -} diff --git a/themes/modern/_config.yaml b/themes/paper/_config.yaml similarity index 100% rename from themes/modern/_config.yaml rename to themes/paper/_config.yaml diff --git a/themes/paper/jquery.syntax.core.sass b/themes/paper/jquery.syntax.core.sass new file mode 100644 index 0000000..ce886da --- /dev/null +++ b/themes/paper/jquery.syntax.core.sass @@ -0,0 +1,47 @@ +// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License. +// Copyright (c) 2011 Samuel G. D. Williams. +// See for licensing details. + +code.syntax-theme-paper + font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace + line-height: 1.5em + + .function + color: #33f + + .keyword + color: #cb4b16 + + .access + color: #ffb600 + font-weight: bold + + .type + color: #268bd2 + + .comment + color: #998 + font-style: italic + + .string + color: #2aa198 + + .string .escape + color: #2ab1a8 + + .operator + color: #268bd2 + + .href + color: #00f + text-decoration: underline + + .variable + color: #b58900 + + .constant + color: #099 + +pre code.syntax-theme-paper + > span:nth-child(odd) + background-color: rgba(0, 0, 0, 0.05)