apache.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. module.exports = function(hljs) {
  2. var NUMBER = {className: 'number', begin: '[\\$%]\\d+'};
  3. return {
  4. aliases: ['apacheconf'],
  5. case_insensitive: true,
  6. contains: [
  7. hljs.HASH_COMMENT_MODE,
  8. {className: 'section', begin: '</?', end: '>'},
  9. {
  10. className: 'attribute',
  11. begin: /\w+/,
  12. relevance: 0,
  13. // keywords aren’t needed for highlighting per se, they only boost relevance
  14. // for a very generally defined mode (starts with a word, ends with line-end
  15. keywords: {
  16. nomarkup:
  17. 'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' +
  18. 'sethandler errordocument loadmodule options header listen serverroot ' +
  19. 'servername'
  20. },
  21. starts: {
  22. end: /$/,
  23. relevance: 0,
  24. keywords: {
  25. literal: 'on off all'
  26. },
  27. contains: [
  28. {
  29. className: 'meta',
  30. begin: '\\s\\[', end: '\\]$'
  31. },
  32. {
  33. className: 'variable',
  34. begin: '[\\$%]\\{', end: '\\}',
  35. contains: ['self', NUMBER]
  36. },
  37. NUMBER,
  38. hljs.QUOTE_STRING_MODE
  39. ]
  40. }
  41. }
  42. ],
  43. illegal: /\S/
  44. };
  45. };