prism-bbcode.js 609 B

1234567891011121314151617181920212223242526272829
  1. Prism.languages.bbcode = {
  2. 'tag': {
  3. pattern: /\[\/?[^\s=\]]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))?(?:\s+[^\s=\]]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))*\s*\]/,
  4. inside: {
  5. 'tag': {
  6. pattern: /^\[\/?[^\s=\]]+/,
  7. inside: {
  8. 'punctuation': /^\[\/?/
  9. }
  10. },
  11. 'attr-value': {
  12. pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+)/,
  13. inside: {
  14. 'punctuation': [
  15. /^=/,
  16. {
  17. pattern: /^(\s*)["']|["']$/,
  18. lookbehind: true
  19. }
  20. ]
  21. }
  22. },
  23. 'punctuation': /\]/,
  24. 'attr-name': /[^\s=\]]+/
  25. }
  26. }
  27. };
  28. Prism.languages.shortcode = Prism.languages.bbcode;