Sha256: 15393c81f518296877af4af4403abd256343ceac500c7347dd7a8bec95989098

Contents?: true

Size: 1.33 KB

Versions: 10

Compression:

Stored size: 1.33 KB

Contents

Prism.languages.http = {
	'request-line': {
		pattern: /^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/m,
		inside: {
			// HTTP Verb
			property: /^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,
			// Path or query argument
			'attr-name': /:\w+/
		}
	},
	'response-status': {
		pattern: /^HTTP\/1.[01] [0-9]+.*/m,
		inside: {
			// Status, e.g. 200 OK
			property: {
                pattern: /(^HTTP\/1.[01] )[0-9]+.*/i,
                lookbehind: true
            }
		}
	},
	// HTTP header name
	'header-name': {
        pattern: /^[\w-]+:(?=.)/m,
        alias: 'keyword'
    }
};

// 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]*?)(?:\\r?\\n|\\r){2}[\\w\\W]*', 'i'),
			lookbehind: true,
			inside: {
				rest: httpLanguages[contentType]
			}
		};
		Prism.languages.insertBefore('http', 'header-name', options);
	}
}

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
prism-rails-1.6.0.3 vendor/assets/javascripts/prism/prism-http.js
prism-rails-1.6.0.2 vendor/assets/javascripts/prism/prism-http.js
prism-rails-1.6.0.1 vendor/assets/javascripts/prism/prism-http.js
prism-rails-1.5.1.2 vendor/assets/javascripts/prism-http.js
prism-rails-1.5.1 vendor/assets/javascripts/prism-http.js
highlighting-0.1.4 vendor/assets/javascripts/prism-http.js
highlighting-0.1.3 vendor/assets/javascripts/prism-http.js
highlighting-0.1.2 vendor/assets/javascripts/prism-http.js
highlighting-0.1.1 vendor/assets/javascripts/prism-http.js
highlighting-0.1.0 vendor/assets/javascripts/prism-http.js