Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: polymer_1.0.4/bower_components/prism/components/prism-http.js

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_1.0.4/bower_components/prism/components/prism-http.js
diff --git a/polymer_1.0.4/bower_components/prism/components/prism-http.js b/polymer_1.0.4/bower_components/prism/components/prism-http.js
new file mode 100644
index 0000000000000000000000000000000000000000..f94f6de9260f200a5a3519413a16f5443dc1136d
--- /dev/null
+++ b/polymer_1.0.4/bower_components/prism/components/prism-http.js
@@ -0,0 +1,44 @@
+Prism.languages.http = {
+ 'request-line': {
+ pattern: /^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/,
+ inside: {
+ // HTTP Verb
+ property: /^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,
+ // Path or query argument
+ 'attr-name': /:\w+/
+ }
+ },
+ 'response-status': {
+ pattern: /^HTTP\/1.[01] [0-9]+.*/,
+ inside: {
+ // Status, e.g. 200 OK
+ property: /[0-9]+[A-Z\s-]+$/i
+ }
+ },
+ // HTTP header name
+ keyword: /^[\w-]+:(?=.+)/m
+};
+
+// Create a mapping of Content-Type headers to language definitions
+var httpLanguages = {
+ 'application/json': Prism.languages.javascript,
+ 'application/xml': Prism.languages.markup,
+ 'text/xml': Prism.languages.markup,
+ 'text/html': Prism.languages.markup
+};
+
+// Insert each content type parser that has its associated language
+// currently loaded.
+for (var contentType in httpLanguages) {
+ if (httpLanguages[contentType]) {
+ var options = {};
+ options[contentType] = {
+ pattern: new RegExp('(content-type:\\s*' + contentType + '[\\w\\W]*?)\\n\\n[\\w\\W]*', 'i'),
+ lookbehind: true,
+ inside: {
+ rest: httpLanguages[contentType]
+ }
+ };
+ Prism.languages.insertBefore('http', 'keyword', options);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698