mirror of
https://github.com/go-gitea/gitea
synced 2024-12-24 00:26:12 +01:00
a915a09e4f
* Cleaning up public/ and documenting js/css libs. This commit mostly addresses #1484 by moving vendor'ed plugins into a vendor/ directory and documenting their upstream source and license in vendor/librejs.html. This also proves gitea is using only open source js/css libraries which helps toward reaching #1524. * Removing unused css file. The version of this file in use is located at: vendor/plugins/highlight/github.css * Cleaned up librejs.html and added javascript header A SafeJS function was added to templates/helper.go to allow keeping comments inside of javascript. A javascript comment was added in the header of templates/base/head.tmpl to mark all non-inline source as free. The librejs.html file was updated to meet the current librejs spec. I have now verified that the librejs plugin detects most of the scripts included in gitea and suspect the non-free detections are the result of a bug in the plugin. I believe this commit is enough to meet the C0.0 requirement of #1534. * Updating SafeJS function per lint suggestion * Added VERSIONS file, per request
68 lines
5.0 KiB
JavaScript
68 lines
5.0 KiB
JavaScript
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
|
|
|
// Don't take these too seriously -- the expected results appear to be
|
|
// based on the results of actual runs without any serious manual
|
|
// verification. If a change you made causes them to fail, the test is
|
|
// as likely to wrong as the code.
|
|
|
|
(function() {
|
|
var mode = CodeMirror.getMode({tabSize: 4}, "xquery");
|
|
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
|
|
|
|
MT("eviltest",
|
|
"[keyword xquery] [keyword version] [variable "1][keyword .][atom 0][keyword -][variable ml"][def&variable ;] [comment (: this is : a \"comment\" :)]",
|
|
" [keyword let] [variable $let] [keyword :=] [variable <x] [variable attr][keyword =][variable "value">"test"<func>][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable <][keyword /][variable func><][keyword /][variable x>]",
|
|
" [keyword let] [variable $joe][keyword :=][atom 1]",
|
|
" [keyword return] [keyword element] [variable element] {",
|
|
" [keyword attribute] [variable attribute] { [atom 1] },",
|
|
" [keyword element] [variable test] { [variable 'a'] }, [keyword attribute] [variable foo] { [variable "bar"] },",
|
|
" [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],",
|
|
" [keyword //][variable x] } [comment (: a more 'evil' test :)]",
|
|
" [comment (: Modified Blakeley example (: with nested comment :) ... :)]",
|
|
" [keyword declare] [keyword private] [keyword function] [def&variable local:declare]() {()}[variable ;]",
|
|
" [keyword declare] [keyword private] [keyword function] [def&variable local:private]() {()}[variable ;]",
|
|
" [keyword declare] [keyword private] [keyword function] [def&variable local:function]() {()}[variable ;]",
|
|
" [keyword declare] [keyword private] [keyword function] [def&variable local:local]() {()}[variable ;]",
|
|
" [keyword let] [variable $let] [keyword :=] [variable <let>let] [variable $let] [keyword :=] [variable "let"<][keyword /let][variable >]",
|
|
" [keyword return] [keyword element] [variable element] {",
|
|
" [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },",
|
|
" [keyword attribute] [variable fn:doc] { [variable "bar"] [variable castable] [keyword as] [atom xs:string] },",
|
|
" [keyword element] [variable text] { [keyword text] { [variable "text"] } },",
|
|
" [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],",
|
|
" [keyword //][variable fn:doc]",
|
|
" }");
|
|
|
|
MT("testEmptySequenceKeyword",
|
|
"[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()");
|
|
|
|
MT("testMultiAttr",
|
|
"[tag <p ][attribute a1]=[string \"foo\"] [attribute a2]=[string \"bar\"][tag >][variable hello] [variable world][tag </p>]");
|
|
|
|
MT("test namespaced variable",
|
|
"[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]");
|
|
|
|
MT("test EQName variable",
|
|
"[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]",
|
|
"[tag <out>]{[variable $\"http://www.example.com/ns/my\":var]}[tag </out>]");
|
|
|
|
MT("test EQName function",
|
|
"[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
|
|
" [variable $a] [keyword +] [atom 2]",
|
|
"}[variable ;]",
|
|
"[tag <out>]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag </out>]");
|
|
|
|
MT("test EQName function with single quotes",
|
|
"[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
|
|
" [variable $a] [keyword +] [atom 2]",
|
|
"}[variable ;]",
|
|
"[tag <out>]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag </out>]");
|
|
|
|
MT("testProcessingInstructions",
|
|
"[def&variable data]([comment&meta <?target content?>]) [keyword instance] [keyword of] [atom xs:string]");
|
|
|
|
MT("testQuoteEscapeDouble",
|
|
"[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]",
|
|
"[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])");
|
|
})();
|