ueditor 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +9 -0
- data/app/assets/.gitkeep +0 -0
- data/app/assets/javascripts/ueditor.js +14 -0
- data/app/assets/javascripts/ueditor/CHANGELOG.TXT +152 -0
- data/app/assets/javascripts/ueditor/dialogs/anchor/anchor.html +86 -0
- data/app/assets/javascripts/ueditor/dialogs/code/code.html +158 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/emotion.css +121 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/emotion.html +35 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/emotion.js +137 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0001.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0002.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0003.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0004.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0005.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0006.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0007.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0008.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0009.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0010.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0011.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0012.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0013.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0014.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0015.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0016.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0017.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0018.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0019.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/babycat/bc_0020.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0001.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0002.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0003.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0004.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0005.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0006.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0007.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0008.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0009.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0010.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0011.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0012.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0013.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0014.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0015.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0016.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0017.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0018.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0019.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0020.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0021.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0022.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0023.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0024.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0025.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0026.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0027.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0028.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0029.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0030.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0031.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0032.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0033.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0034.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0035.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0036.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0037.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0038.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0039.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0040.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0041.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0042.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0043.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0044.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0045.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0046.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0047.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0048.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0049.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0050.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0051.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0052.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0053.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0054.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0055.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0056.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0057.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0058.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0059.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0060.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0061.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0062.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/bobo/b_0063.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0001.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0002.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0003.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0004.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0005.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0006.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0007.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0008.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0009.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0010.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0011.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0012.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0013.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0014.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0015.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0016.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0017.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0018.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0019.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0020.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0021.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0022.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0023.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0024.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0025.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0026.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0027.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0028.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0029.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0030.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0031.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0032.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0033.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0034.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0035.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0036.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0037.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0038.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0039.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0040.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0041.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0042.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0043.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0044.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0045.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0046.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0047.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0048.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0049.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/face/f_0050.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0001.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0002.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0003.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0004.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0005.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0006.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0007.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0008.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0009.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0010.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0011.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0012.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0013.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0014.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0015.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0016.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0017.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0018.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0019.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0020.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0021.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0022.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0023.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0024.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0025.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0026.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0027.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0028.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0029.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0030.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0031.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0032.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0033.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0034.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0035.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0036.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0037.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0038.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0039.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0040.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0041.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0042.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0043.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0044.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0045.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0046.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0047.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0048.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0049.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0050.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0051.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0052.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0053.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0054.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0055.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0056.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0057.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0058.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0059.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0060.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0061.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0062.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0063.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0064.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0065.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0066.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0067.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0068.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0069.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0070.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0071.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0072.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0073.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0074.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0075.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0076.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0077.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0078.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0079.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0080.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0081.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0082.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0083.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jx2/j_0084.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0001.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0002.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0003.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0004.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0005.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0006.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0007.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0008.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0009.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0010.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0011.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0012.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0013.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0014.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0015.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0016.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0017.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0018.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0019.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0020.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0021.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0022.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0023.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0024.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0025.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0026.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0027.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0028.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0029.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0030.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0031.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0032.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0033.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0034.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0035.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0036.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0037.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0038.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0039.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0040.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0041.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0042.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0043.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0044.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0045.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0046.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0047.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0048.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0049.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0050.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0051.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/ldw/l_0052.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0001.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0002.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0003.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0004.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0005.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0006.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0007.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0008.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0009.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0010.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0011.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0012.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0013.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0014.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0015.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0016.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0017.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0018.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0019.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0020.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0021.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0022.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0023.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0024.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0025.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0026.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0027.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0028.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0029.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0030.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0031.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0032.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0033.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0034.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0035.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0036.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0037.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0038.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0039.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/tsj/t_0040.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0001.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0002.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0003.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0004.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0005.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0006.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0007.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0008.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0009.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0010.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0011.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0012.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0013.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0014.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0015.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0016.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0017.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0018.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0019.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0020.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0021.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0022.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0023.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0024.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0025.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0026.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0027.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0028.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0029.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0030.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0031.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0032.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0033.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0034.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0035.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0036.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0037.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0038.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0039.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/emotion/images/youa/y_0040.gif +0 -0
- data/app/assets/javascripts/ueditor/dialogs/gmap/gmap.html +104 -0
- data/app/assets/javascripts/ueditor/dialogs/help/help.html +156 -0
- data/app/assets/javascripts/ueditor/dialogs/image/callbacks.js +80 -0
- data/app/assets/javascripts/ueditor/dialogs/image/image.html +628 -0
- data/app/assets/javascripts/ueditor/dialogs/image/imageUploader.swf +0 -0
- data/app/assets/javascripts/ueditor/dialogs/image/tangram.js +1 -0
- data/app/assets/javascripts/ueditor/dialogs/insertframe/insertframe.html +131 -0
- data/app/assets/javascripts/ueditor/dialogs/internal.js +10 -0
- data/app/assets/javascripts/ueditor/dialogs/link/link.html +130 -0
- data/app/assets/javascripts/ueditor/dialogs/map/map.html +132 -0
- data/app/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.html +254 -0
- data/app/assets/javascripts/ueditor/dialogs/spechars/spechars.html +148 -0
- data/app/assets/javascripts/ueditor/dialogs/table/table.html +231 -0
- data/app/assets/javascripts/ueditor/dialogs/video/video.html +113 -0
- data/app/assets/javascripts/ueditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
- data/app/assets/javascripts/ueditor/dialogs/wordimage/wordimage.html +250 -0
- data/app/assets/javascripts/ueditor/editor_all.js +15690 -0
- data/app/assets/javascripts/ueditor/editor_all_min.js +1 -0
- data/app/assets/javascripts/ueditor/editor_config.js +337 -0
- data/app/assets/javascripts/ueditor/themes/default/iframe.css +1 -0
- data/app/assets/javascripts/ueditor/themes/default/images/anchor.gif +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/button-bg.gif +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/copy.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/dialog-title-bg.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/icons-all.gif +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/icons.gif +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/icons.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/imgLable.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/left.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/left_focus.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/localimage.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/lock.gif +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/logo.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/menu/sparator_v.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/neweditor-tab-bg.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/none.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/none_focus.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/pagebreak.gif +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/right.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/right_focus.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/tablepicker/highlighted.gif +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/tablepicker/unhighlighted.gif +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/toolbar_bg.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/topbottom.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/topbottom_focus.jpg +0 -0
- data/app/assets/javascripts/ueditor/themes/default/images/upload.png +0 -0
- data/app/assets/javascripts/ueditor/themes/default/ueditor.css +1090 -0
- data/app/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCore.js +3599 -0
- data/app/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +340 -0
- data/app/assets/javascripts/ueditor/third-party/codemirror2.15/codemirror.css +104 -0
- data/app/assets/javascripts/ueditor/third-party/codemirror2.15/codemirror.js +3581 -0
- data/config/routes.rb +7 -0
- data/lib/ueditor.rb +29 -3
- data/lib/ueditor/config.rb +40 -0
- data/lib/ueditor/engine.rb +24 -0
- data/lib/ueditor/helpers/asset_tag_helper.rb +12 -0
- data/lib/ueditor/helpers/form_builder.rb +11 -0
- data/lib/ueditor/helpers/form_helper.rb +24 -0
- data/lib/ueditor/helpers/form_tag_helper.rb +22 -0
- data/lib/ueditor/utils.rb +51 -0
- data/lib/ueditor/version.rb +1 -1
- metadata +430 -3
@@ -0,0 +1,3599 @@
|
|
1
|
+
/**
|
2
|
+
* SyntaxHighlighter
|
3
|
+
* http://alexgorbatchev.com/SyntaxHighlighter
|
4
|
+
*
|
5
|
+
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
6
|
+
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
7
|
+
*
|
8
|
+
* @version
|
9
|
+
* 3.0.83 (July 02 2010)
|
10
|
+
*
|
11
|
+
* @copyright
|
12
|
+
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
13
|
+
*
|
14
|
+
* @license
|
15
|
+
* Dual licensed under the MIT and GPL licenses.
|
16
|
+
*/
|
17
|
+
//
|
18
|
+
// Begin anonymous function. This is used to contain local scope variables without polutting global scope.
|
19
|
+
//
|
20
|
+
// XRegExp 1.5.0
|
21
|
+
// (c) 2007-2010 Steven Levithan
|
22
|
+
// MIT License
|
23
|
+
// <http://xregexp.com>
|
24
|
+
// Provides an augmented, extensible, cross-browser implementation of regular expressions,
|
25
|
+
// including support for additional syntax, flags, and methods
|
26
|
+
|
27
|
+
var XRegExp;
|
28
|
+
|
29
|
+
if (XRegExp) {
|
30
|
+
// Avoid running twice, since that would break references to native globals
|
31
|
+
throw Error("can't load XRegExp twice in the same frame");
|
32
|
+
}
|
33
|
+
|
34
|
+
// Run within an anonymous function to protect variables and avoid new globals
|
35
|
+
(function () {
|
36
|
+
|
37
|
+
//---------------------------------
|
38
|
+
// Constructor
|
39
|
+
//---------------------------------
|
40
|
+
|
41
|
+
// Accepts a pattern and flags; returns a new, extended `RegExp` object. Differs from a native
|
42
|
+
// regular expression in that additional syntax and flags are supported and cross-browser
|
43
|
+
// syntax inconsistencies are ameliorated
|
44
|
+
XRegExp = function (pattern, flags) {
|
45
|
+
var output = [],
|
46
|
+
currScope = XRegExp.OUTSIDE_CLASS,
|
47
|
+
pos = 0,
|
48
|
+
context, tokenResult, match, chr, regex;
|
49
|
+
|
50
|
+
if (XRegExp.isRegExp(pattern)) {
|
51
|
+
if (flags !== undefined)
|
52
|
+
throw TypeError("can't supply flags when constructing one RegExp from another");
|
53
|
+
return clone(pattern);
|
54
|
+
}
|
55
|
+
// Tokens become part of the regex construction process, so protect against infinite
|
56
|
+
// recursion when an XRegExp is constructed within a token handler or trigger
|
57
|
+
if (isInsideConstructor)
|
58
|
+
throw Error("can't call the XRegExp constructor within token definition functions");
|
59
|
+
|
60
|
+
flags = flags || "";
|
61
|
+
context = { // `this` object for custom tokens
|
62
|
+
hasNamedCapture: false,
|
63
|
+
captureNames: [],
|
64
|
+
hasFlag: function (flag) {return flags.indexOf(flag) > -1;},
|
65
|
+
setFlag: function (flag) {flags += flag;}
|
66
|
+
};
|
67
|
+
|
68
|
+
while (pos < pattern.length) {
|
69
|
+
// Check for custom tokens at the current position
|
70
|
+
tokenResult = runTokens(pattern, pos, currScope, context);
|
71
|
+
|
72
|
+
if (tokenResult) {
|
73
|
+
output.push(tokenResult.output);
|
74
|
+
pos += (tokenResult.match[0].length || 1);
|
75
|
+
} else {
|
76
|
+
// Check for native multicharacter metasequences (excluding character classes) at
|
77
|
+
// the current position
|
78
|
+
if (match = real.exec.call(nativeTokens[currScope], pattern.slice(pos))) {
|
79
|
+
output.push(match[0]);
|
80
|
+
pos += match[0].length;
|
81
|
+
} else {
|
82
|
+
chr = pattern.charAt(pos);
|
83
|
+
if (chr === "[")
|
84
|
+
currScope = XRegExp.INSIDE_CLASS;
|
85
|
+
else if (chr === "]")
|
86
|
+
currScope = XRegExp.OUTSIDE_CLASS;
|
87
|
+
// Advance position one character
|
88
|
+
output.push(chr);
|
89
|
+
pos++;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
regex = RegExp(output.join(""), real.replace.call(flags, flagClip, ""));
|
95
|
+
regex._xregexp = {
|
96
|
+
source: pattern,
|
97
|
+
captureNames: context.hasNamedCapture ? context.captureNames : null
|
98
|
+
};
|
99
|
+
return regex;
|
100
|
+
};
|
101
|
+
|
102
|
+
|
103
|
+
//---------------------------------
|
104
|
+
// Public properties
|
105
|
+
//---------------------------------
|
106
|
+
|
107
|
+
XRegExp.version = "1.5.0";
|
108
|
+
|
109
|
+
// Token scope bitflags
|
110
|
+
XRegExp.INSIDE_CLASS = 1;
|
111
|
+
XRegExp.OUTSIDE_CLASS = 2;
|
112
|
+
|
113
|
+
|
114
|
+
//---------------------------------
|
115
|
+
// Private variables
|
116
|
+
//---------------------------------
|
117
|
+
|
118
|
+
var replacementToken = /\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g,
|
119
|
+
flagClip = /[^gimy]+|([\s\S])(?=[\s\S]*\1)/g, // Nonnative and duplicate flags
|
120
|
+
quantifier = /^(?:[?*+]|{\d+(?:,\d*)?})\??/,
|
121
|
+
isInsideConstructor = false,
|
122
|
+
tokens = [],
|
123
|
+
// Copy native globals for reference ("native" is an ES3 reserved keyword)
|
124
|
+
real = {
|
125
|
+
exec: RegExp.prototype.exec,
|
126
|
+
test: RegExp.prototype.test,
|
127
|
+
match: String.prototype.match,
|
128
|
+
replace: String.prototype.replace,
|
129
|
+
split: String.prototype.split
|
130
|
+
},
|
131
|
+
compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
|
132
|
+
compliantLastIndexIncrement = function () {
|
133
|
+
var x = /^/g;
|
134
|
+
real.test.call(x, "");
|
135
|
+
return !x.lastIndex;
|
136
|
+
}(),
|
137
|
+
compliantLastIndexReset = function () {
|
138
|
+
var x = /x/g;
|
139
|
+
real.replace.call("x", x, "");
|
140
|
+
return !x.lastIndex;
|
141
|
+
}(),
|
142
|
+
hasNativeY = RegExp.prototype.sticky !== undefined,
|
143
|
+
nativeTokens = {};
|
144
|
+
|
145
|
+
// `nativeTokens` match native multicharacter metasequences only (including deprecated octals,
|
146
|
+
// excluding character classes)
|
147
|
+
nativeTokens[XRegExp.INSIDE_CLASS] = /^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/;
|
148
|
+
nativeTokens[XRegExp.OUTSIDE_CLASS] = /^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/;
|
149
|
+
|
150
|
+
|
151
|
+
//---------------------------------
|
152
|
+
// Public methods
|
153
|
+
//---------------------------------
|
154
|
+
|
155
|
+
// Lets you extend or change XRegExp syntax and create custom flags. This is used internally by
|
156
|
+
// the XRegExp library and can be used to create XRegExp plugins. This function is intended for
|
157
|
+
// users with advanced knowledge of JavaScript's regular expression syntax and behavior. It can
|
158
|
+
// be disabled by `XRegExp.freezeTokens`
|
159
|
+
XRegExp.addToken = function (regex, handler, scope, trigger) {
|
160
|
+
tokens.push({
|
161
|
+
pattern: clone(regex, "g" + (hasNativeY ? "y" : "")),
|
162
|
+
handler: handler,
|
163
|
+
scope: scope || XRegExp.OUTSIDE_CLASS,
|
164
|
+
trigger: trigger || null
|
165
|
+
});
|
166
|
+
};
|
167
|
+
|
168
|
+
// Accepts a pattern and flags; returns an extended `RegExp` object. If the pattern and flag
|
169
|
+
// combination has previously been cached, the cached copy is returned; otherwise the newly
|
170
|
+
// created regex is cached
|
171
|
+
XRegExp.cache = function (pattern, flags) {
|
172
|
+
var key = pattern + "/" + (flags || "");
|
173
|
+
return XRegExp.cache[key] || (XRegExp.cache[key] = XRegExp(pattern, flags));
|
174
|
+
};
|
175
|
+
|
176
|
+
// Accepts a `RegExp` instance; returns a copy with the `/g` flag set. The copy has a fresh
|
177
|
+
// `lastIndex` (set to zero). If you want to copy a regex without forcing the `global`
|
178
|
+
// property, use `XRegExp(regex)`. Do not use `RegExp(regex)` because it will not preserve
|
179
|
+
// special properties required for named capture
|
180
|
+
XRegExp.copyAsGlobal = function (regex) {
|
181
|
+
return clone(regex, "g");
|
182
|
+
};
|
183
|
+
|
184
|
+
// Accepts a string; returns the string with regex metacharacters escaped. The returned string
|
185
|
+
// can safely be used at any point within a regex to match the provided literal string. Escaped
|
186
|
+
// characters are [ ] { } ( ) * + ? - . , \ ^ $ | # and whitespace
|
187
|
+
XRegExp.escape = function (str) {
|
188
|
+
return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
189
|
+
};
|
190
|
+
|
191
|
+
// Accepts a string to search, regex to search with, position to start the search within the
|
192
|
+
// string (default: 0), and an optional Boolean indicating whether matches must start at-or-
|
193
|
+
// after the position or at the specified position only. This function ignores the `lastIndex`
|
194
|
+
// property of the provided regex
|
195
|
+
XRegExp.execAt = function (str, regex, pos, anchored) {
|
196
|
+
regex = clone(regex, "g" + ((anchored && hasNativeY) ? "y" : ""));
|
197
|
+
regex.lastIndex = pos = pos || 0;
|
198
|
+
var match = regex.exec(str);
|
199
|
+
if (anchored)
|
200
|
+
return (match && match.index === pos) ? match : null;
|
201
|
+
else
|
202
|
+
return match;
|
203
|
+
};
|
204
|
+
|
205
|
+
// Breaks the unrestorable link to XRegExp's private list of tokens, thereby preventing
|
206
|
+
// syntax and flag changes. Should be run after XRegExp and any plugins are loaded
|
207
|
+
XRegExp.freezeTokens = function () {
|
208
|
+
XRegExp.addToken = function () {
|
209
|
+
throw Error("can't run addToken after freezeTokens");
|
210
|
+
};
|
211
|
+
};
|
212
|
+
|
213
|
+
// Accepts any value; returns a Boolean indicating whether the argument is a `RegExp` object.
|
214
|
+
// Note that this is also `true` for regex literals and regexes created by the `XRegExp`
|
215
|
+
// constructor. This works correctly for variables created in another frame, when `instanceof`
|
216
|
+
// and `constructor` checks would fail to work as intended
|
217
|
+
XRegExp.isRegExp = function (o) {
|
218
|
+
return Object.prototype.toString.call(o) === "[object RegExp]";
|
219
|
+
};
|
220
|
+
|
221
|
+
// Executes `callback` once per match within `str`. Provides a simpler and cleaner way to
|
222
|
+
// iterate over regex matches compared to the traditional approaches of subverting
|
223
|
+
// `String.prototype.replace` or repeatedly calling `exec` within a `while` loop
|
224
|
+
XRegExp.iterate = function (str, origRegex, callback, context) {
|
225
|
+
var regex = clone(origRegex, "g"),
|
226
|
+
i = -1, match;
|
227
|
+
while (match = regex.exec(str)) {
|
228
|
+
callback.call(context, match, ++i, str, regex);
|
229
|
+
if (regex.lastIndex === match.index)
|
230
|
+
regex.lastIndex++;
|
231
|
+
}
|
232
|
+
if (origRegex.global)
|
233
|
+
origRegex.lastIndex = 0;
|
234
|
+
};
|
235
|
+
|
236
|
+
// Accepts a string and an array of regexes; returns the result of using each successive regex
|
237
|
+
// to search within the matches of the previous regex. The array of regexes can also contain
|
238
|
+
// objects with `regex` and `backref` properties, in which case the named or numbered back-
|
239
|
+
// references specified are passed forward to the next regex or returned. E.g.:
|
240
|
+
// var xregexpImgFileNames = XRegExp.matchChain(html, [
|
241
|
+
// {regex: /<img\b([^>]+)>/i, backref: 1}, // <img> tag attributes
|
242
|
+
// {regex: XRegExp('(?ix) \\s src=" (?<src> [^"]+ )'), backref: "src"}, // src attribute values
|
243
|
+
// {regex: XRegExp("^http://xregexp\\.com(/[^#?]+)", "i"), backref: 1}, // xregexp.com paths
|
244
|
+
// /[^\/]+$/ // filenames (strip directory paths)
|
245
|
+
// ]);
|
246
|
+
XRegExp.matchChain = function (str, chain) {
|
247
|
+
return function recurseChain (values, level) {
|
248
|
+
var item = chain[level].regex ? chain[level] : {regex: chain[level]},
|
249
|
+
regex = clone(item.regex, "g"),
|
250
|
+
matches = [], i;
|
251
|
+
for (i = 0; i < values.length; i++) {
|
252
|
+
XRegExp.iterate(values[i], regex, function (match) {
|
253
|
+
matches.push(item.backref ? (match[item.backref] || "") : match[0]);
|
254
|
+
});
|
255
|
+
}
|
256
|
+
return ((level === chain.length - 1) || !matches.length) ?
|
257
|
+
matches : recurseChain(matches, level + 1);
|
258
|
+
}([str], 0);
|
259
|
+
};
|
260
|
+
|
261
|
+
|
262
|
+
//---------------------------------
|
263
|
+
// New RegExp prototype methods
|
264
|
+
//---------------------------------
|
265
|
+
|
266
|
+
// Accepts a context object and arguments array; returns the result of calling `exec` with the
|
267
|
+
// first value in the arguments array. the context is ignored but is accepted for congruity
|
268
|
+
// with `Function.prototype.apply`
|
269
|
+
RegExp.prototype.apply = function (context, args) {
|
270
|
+
return this.exec(args[0]);
|
271
|
+
};
|
272
|
+
|
273
|
+
// Accepts a context object and string; returns the result of calling `exec` with the provided
|
274
|
+
// string. the context is ignored but is accepted for congruity with `Function.prototype.call`
|
275
|
+
RegExp.prototype.call = function (context, str) {
|
276
|
+
return this.exec(str);
|
277
|
+
};
|
278
|
+
|
279
|
+
|
280
|
+
//---------------------------------
|
281
|
+
// Overriden native methods
|
282
|
+
//---------------------------------
|
283
|
+
|
284
|
+
// Adds named capture support (with backreferences returned as `result.name`), and fixes two
|
285
|
+
// cross-browser issues per ES3:
|
286
|
+
// - Captured values for nonparticipating capturing groups should be returned as `undefined`,
|
287
|
+
// rather than the empty string.
|
288
|
+
// - `lastIndex` should not be incremented after zero-length matches.
|
289
|
+
RegExp.prototype.exec = function (str) {
|
290
|
+
var match = real.exec.apply(this, arguments),
|
291
|
+
name, r2;
|
292
|
+
if (match) {
|
293
|
+
// Fix browsers whose `exec` methods don't consistently return `undefined` for
|
294
|
+
// nonparticipating capturing groups
|
295
|
+
if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
|
296
|
+
r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
|
297
|
+
// Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
|
298
|
+
// matching due to characters outside the match
|
299
|
+
real.replace.call(str.toString().slice(match.index), r2, function () {
|
300
|
+
for (var i = 1; i < arguments.length - 2; i++) {
|
301
|
+
if (arguments[i] === undefined)
|
302
|
+
match[i] = undefined;
|
303
|
+
}
|
304
|
+
});
|
305
|
+
}
|
306
|
+
// Attach named capture properties
|
307
|
+
if (this._xregexp && this._xregexp.captureNames) {
|
308
|
+
for (var i = 1; i < match.length; i++) {
|
309
|
+
name = this._xregexp.captureNames[i - 1];
|
310
|
+
if (name)
|
311
|
+
match[name] = match[i];
|
312
|
+
}
|
313
|
+
}
|
314
|
+
// Fix browsers that increment `lastIndex` after zero-length matches
|
315
|
+
if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
|
316
|
+
this.lastIndex--;
|
317
|
+
}
|
318
|
+
return match;
|
319
|
+
};
|
320
|
+
|
321
|
+
// Don't override `test` if it won't change anything
|
322
|
+
if (!compliantLastIndexIncrement) {
|
323
|
+
// Fix browser bug in native method
|
324
|
+
RegExp.prototype.test = function (str) {
|
325
|
+
// Use the native `exec` to skip some processing overhead, even though the overriden
|
326
|
+
// `exec` would take care of the `lastIndex` fix
|
327
|
+
var match = real.exec.call(this, str);
|
328
|
+
// Fix browsers that increment `lastIndex` after zero-length matches
|
329
|
+
if (match && this.global && !match[0].length && (this.lastIndex > match.index))
|
330
|
+
this.lastIndex--;
|
331
|
+
return !!match;
|
332
|
+
};
|
333
|
+
}
|
334
|
+
|
335
|
+
// Adds named capture support and fixes browser bugs in native method
|
336
|
+
String.prototype.match = function (regex) {
|
337
|
+
if (!XRegExp.isRegExp(regex))
|
338
|
+
regex = RegExp(regex); // Native `RegExp`
|
339
|
+
if (regex.global) {
|
340
|
+
var result = real.match.apply(this, arguments);
|
341
|
+
regex.lastIndex = 0; // Fix IE bug
|
342
|
+
return result;
|
343
|
+
}
|
344
|
+
return regex.exec(this); // Run the altered `exec`
|
345
|
+
};
|
346
|
+
|
347
|
+
// Adds support for `${n}` tokens for named and numbered backreferences in replacement text,
|
348
|
+
// and provides named backreferences to replacement functions as `arguments[0].name`. Also
|
349
|
+
// fixes cross-browser differences in replacement text syntax when performing a replacement
|
350
|
+
// using a nonregex search value, and the value of replacement regexes' `lastIndex` property
|
351
|
+
// during replacement iterations. Note that this doesn't support SpiderMonkey's proprietary
|
352
|
+
// third (`flags`) parameter
|
353
|
+
String.prototype.replace = function (search, replacement) {
|
354
|
+
var isRegex = XRegExp.isRegExp(search),
|
355
|
+
captureNames, result, str;
|
356
|
+
|
357
|
+
// There are many combinations of search/replacement types/values and browser bugs that
|
358
|
+
// preclude passing to native `replace`, so just keep this check relatively simple
|
359
|
+
if (isRegex && typeof replacement.valueOf() === "string" && replacement.indexOf("${") === -1 && compliantLastIndexReset)
|
360
|
+
return real.replace.apply(this, arguments);
|
361
|
+
|
362
|
+
if (!isRegex)
|
363
|
+
search = search + ""; // Type conversion
|
364
|
+
else if (search._xregexp)
|
365
|
+
captureNames = search._xregexp.captureNames; // Array or `null`
|
366
|
+
|
367
|
+
if (typeof replacement === "function") {
|
368
|
+
result = real.replace.call(this, search, function () {
|
369
|
+
if (captureNames) {
|
370
|
+
// Change the `arguments[0]` string primitive to a String object which can store properties
|
371
|
+
arguments[0] = new String(arguments[0]);
|
372
|
+
// Store named backreferences on `arguments[0]`
|
373
|
+
for (var i = 0; i < captureNames.length; i++) {
|
374
|
+
if (captureNames[i])
|
375
|
+
arguments[0][captureNames[i]] = arguments[i + 1];
|
376
|
+
}
|
377
|
+
}
|
378
|
+
// Update `lastIndex` before calling `replacement`
|
379
|
+
if (isRegex && search.global)
|
380
|
+
search.lastIndex = arguments[arguments.length - 2] + arguments[0].length;
|
381
|
+
return replacement.apply(null, arguments);
|
382
|
+
});
|
383
|
+
} else {
|
384
|
+
str = this + ""; // Type conversion, so `args[args.length - 1]` will be a string (given nonstring `this`)
|
385
|
+
result = real.replace.call(str, search, function () {
|
386
|
+
var args = arguments; // Keep this function's `arguments` available through closure
|
387
|
+
return real.replace.call(replacement, replacementToken, function ($0, $1, $2) {
|
388
|
+
// Numbered backreference (without delimiters) or special variable
|
389
|
+
if ($1) {
|
390
|
+
switch ($1) {
|
391
|
+
case "$": return "$";
|
392
|
+
case "&": return args[0];
|
393
|
+
case "`": return args[args.length - 1].slice(0, args[args.length - 2]);
|
394
|
+
case "'": return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
|
395
|
+
// Numbered backreference
|
396
|
+
default:
|
397
|
+
// What does "$10" mean?
|
398
|
+
// - Backreference 10, if 10 or more capturing groups exist
|
399
|
+
// - Backreference 1 followed by "0", if 1-9 capturing groups exist
|
400
|
+
// - Otherwise, it's the string "$10"
|
401
|
+
// Also note:
|
402
|
+
// - Backreferences cannot be more than two digits (enforced by `replacementToken`)
|
403
|
+
// - "$01" is equivalent to "$1" if a capturing group exists, otherwise it's the string "$01"
|
404
|
+
// - There is no "$0" token ("$&" is the entire match)
|
405
|
+
var literalNumbers = "";
|
406
|
+
$1 = +$1; // Type conversion; drop leading zero
|
407
|
+
if (!$1) // `$1` was "0" or "00"
|
408
|
+
return $0;
|
409
|
+
while ($1 > args.length - 3) {
|
410
|
+
literalNumbers = String.prototype.slice.call($1, -1) + literalNumbers;
|
411
|
+
$1 = Math.floor($1 / 10); // Drop the last digit
|
412
|
+
}
|
413
|
+
return ($1 ? args[$1] || "" : "$") + literalNumbers;
|
414
|
+
}
|
415
|
+
// Named backreference or delimited numbered backreference
|
416
|
+
} else {
|
417
|
+
// What does "${n}" mean?
|
418
|
+
// - Backreference to numbered capture n. Two differences from "$n":
|
419
|
+
// - n can be more than two digits
|
420
|
+
// - Backreference 0 is allowed, and is the entire match
|
421
|
+
// - Backreference to named capture n, if it exists and is not a number overridden by numbered capture
|
422
|
+
// - Otherwise, it's the string "${n}"
|
423
|
+
var n = +$2; // Type conversion; drop leading zeros
|
424
|
+
if (n <= args.length - 3)
|
425
|
+
return args[n];
|
426
|
+
n = captureNames ? indexOf(captureNames, $2) : -1;
|
427
|
+
return n > -1 ? args[n + 1] : $0;
|
428
|
+
}
|
429
|
+
});
|
430
|
+
});
|
431
|
+
}
|
432
|
+
|
433
|
+
if (isRegex && search.global)
|
434
|
+
search.lastIndex = 0; // Fix IE bug
|
435
|
+
|
436
|
+
return result;
|
437
|
+
};
|
438
|
+
|
439
|
+
// A consistent cross-browser, ES3 compliant `split`
|
440
|
+
String.prototype.split = function (s /* separator */, limit) {
|
441
|
+
// If separator `s` is not a regex, use the native `split`
|
442
|
+
if (!XRegExp.isRegExp(s))
|
443
|
+
return real.split.apply(this, arguments);
|
444
|
+
|
445
|
+
var str = this + "", // Type conversion
|
446
|
+
output = [],
|
447
|
+
lastLastIndex = 0,
|
448
|
+
match, lastLength;
|
449
|
+
|
450
|
+
// Behavior for `limit`: if it's...
|
451
|
+
// - `undefined`: No limit
|
452
|
+
// - `NaN` or zero: Return an empty array
|
453
|
+
// - A positive number: Use `Math.floor(limit)`
|
454
|
+
// - A negative number: No limit
|
455
|
+
// - Other: Type-convert, then use the above rules
|
456
|
+
if (limit === undefined || +limit < 0) {
|
457
|
+
limit = Infinity;
|
458
|
+
} else {
|
459
|
+
limit = Math.floor(+limit);
|
460
|
+
if (!limit)
|
461
|
+
return [];
|
462
|
+
}
|
463
|
+
|
464
|
+
// This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero
|
465
|
+
// and restore it to its original value when we're done using the regex
|
466
|
+
s = XRegExp.copyAsGlobal(s);
|
467
|
+
|
468
|
+
while (match = s.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
|
469
|
+
if (s.lastIndex > lastLastIndex) {
|
470
|
+
output.push(str.slice(lastLastIndex, match.index));
|
471
|
+
|
472
|
+
if (match.length > 1 && match.index < str.length)
|
473
|
+
Array.prototype.push.apply(output, match.slice(1));
|
474
|
+
|
475
|
+
lastLength = match[0].length;
|
476
|
+
lastLastIndex = s.lastIndex;
|
477
|
+
|
478
|
+
if (output.length >= limit)
|
479
|
+
break;
|
480
|
+
}
|
481
|
+
|
482
|
+
if (s.lastIndex === match.index)
|
483
|
+
s.lastIndex++;
|
484
|
+
}
|
485
|
+
|
486
|
+
if (lastLastIndex === str.length) {
|
487
|
+
if (!real.test.call(s, "") || lastLength)
|
488
|
+
output.push("");
|
489
|
+
} else {
|
490
|
+
output.push(str.slice(lastLastIndex));
|
491
|
+
}
|
492
|
+
|
493
|
+
return output.length > limit ? output.slice(0, limit) : output;
|
494
|
+
};
|
495
|
+
|
496
|
+
|
497
|
+
//---------------------------------
|
498
|
+
// Private helper functions
|
499
|
+
//---------------------------------
|
500
|
+
|
501
|
+
// Supporting function for `XRegExp`, `XRegExp.copyAsGlobal`, etc. Returns a copy of a `RegExp`
|
502
|
+
// instance with a fresh `lastIndex` (set to zero), preserving properties required for named
|
503
|
+
// capture. Also allows adding new flags in the process of copying the regex
|
504
|
+
function clone (regex, additionalFlags) {
|
505
|
+
if (!XRegExp.isRegExp(regex))
|
506
|
+
throw TypeError("type RegExp expected");
|
507
|
+
var x = regex._xregexp;
|
508
|
+
regex = XRegExp(regex.source, getNativeFlags(regex) + (additionalFlags || ""));
|
509
|
+
if (x) {
|
510
|
+
regex._xregexp = {
|
511
|
+
source: x.source,
|
512
|
+
captureNames: x.captureNames ? x.captureNames.slice(0) : null
|
513
|
+
};
|
514
|
+
}
|
515
|
+
return regex;
|
516
|
+
};
|
517
|
+
|
518
|
+
function getNativeFlags (regex) {
|
519
|
+
return (regex.global ? "g" : "") +
|
520
|
+
(regex.ignoreCase ? "i" : "") +
|
521
|
+
(regex.multiline ? "m" : "") +
|
522
|
+
(regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
|
523
|
+
(regex.sticky ? "y" : "");
|
524
|
+
};
|
525
|
+
|
526
|
+
function runTokens (pattern, index, scope, context) {
|
527
|
+
var i = tokens.length,
|
528
|
+
result, match, t;
|
529
|
+
// Protect against constructing XRegExps within token handler and trigger functions
|
530
|
+
isInsideConstructor = true;
|
531
|
+
// Must reset `isInsideConstructor`, even if a `trigger` or `handler` throws
|
532
|
+
try {
|
533
|
+
while (i--) { // Run in reverse order
|
534
|
+
t = tokens[i];
|
535
|
+
if ((scope & t.scope) && (!t.trigger || t.trigger.call(context))) {
|
536
|
+
t.pattern.lastIndex = index;
|
537
|
+
match = t.pattern.exec(pattern); // Running the altered `exec` here allows use of named backreferences, etc.
|
538
|
+
if (match && match.index === index) {
|
539
|
+
result = {
|
540
|
+
output: t.handler.call(context, match, scope),
|
541
|
+
match: match
|
542
|
+
};
|
543
|
+
break;
|
544
|
+
}
|
545
|
+
}
|
546
|
+
}
|
547
|
+
} catch (err) {
|
548
|
+
throw err;
|
549
|
+
} finally {
|
550
|
+
isInsideConstructor = false;
|
551
|
+
}
|
552
|
+
return result;
|
553
|
+
};
|
554
|
+
|
555
|
+
function indexOf (array, item, from) {
|
556
|
+
if (Array.prototype.indexOf) // Use the native array method if available
|
557
|
+
return array.indexOf(item, from);
|
558
|
+
for (var i = from || 0; i < array.length; i++) {
|
559
|
+
if (array[i] === item)
|
560
|
+
return i;
|
561
|
+
}
|
562
|
+
return -1;
|
563
|
+
};
|
564
|
+
|
565
|
+
|
566
|
+
//---------------------------------
|
567
|
+
// Built-in tokens
|
568
|
+
//---------------------------------
|
569
|
+
|
570
|
+
// Augment XRegExp's regular expression syntax and flags. Note that when adding tokens, the
|
571
|
+
// third (`scope`) argument defaults to `XRegExp.OUTSIDE_CLASS`
|
572
|
+
|
573
|
+
// Comment pattern: (?# )
|
574
|
+
XRegExp.addToken(
|
575
|
+
/\(\?#[^)]*\)/,
|
576
|
+
function (match) {
|
577
|
+
// Keep tokens separated unless the following token is a quantifier
|
578
|
+
return real.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
|
579
|
+
}
|
580
|
+
);
|
581
|
+
|
582
|
+
// Capturing group (match the opening parenthesis only).
|
583
|
+
// Required for support of named capturing groups
|
584
|
+
XRegExp.addToken(
|
585
|
+
/\((?!\?)/,
|
586
|
+
function () {
|
587
|
+
this.captureNames.push(null);
|
588
|
+
return "(";
|
589
|
+
}
|
590
|
+
);
|
591
|
+
|
592
|
+
// Named capturing group (match the opening delimiter only): (?<name>
|
593
|
+
XRegExp.addToken(
|
594
|
+
/\(\?<([$\w]+)>/,
|
595
|
+
function (match) {
|
596
|
+
this.captureNames.push(match[1]);
|
597
|
+
this.hasNamedCapture = true;
|
598
|
+
return "(";
|
599
|
+
}
|
600
|
+
);
|
601
|
+
|
602
|
+
// Named backreference: \k<name>
|
603
|
+
XRegExp.addToken(
|
604
|
+
/\\k<([\w$]+)>/,
|
605
|
+
function (match) {
|
606
|
+
var index = indexOf(this.captureNames, match[1]);
|
607
|
+
// Keep backreferences separate from subsequent literal numbers. Preserve back-
|
608
|
+
// references to named groups that are undefined at this point as literal strings
|
609
|
+
return index > -1 ?
|
610
|
+
"\\" + (index + 1) + (isNaN(match.input.charAt(match.index + match[0].length)) ? "" : "(?:)") :
|
611
|
+
match[0];
|
612
|
+
}
|
613
|
+
);
|
614
|
+
|
615
|
+
// Empty character class: [] or [^]
|
616
|
+
XRegExp.addToken(
|
617
|
+
/\[\^?]/,
|
618
|
+
function (match) {
|
619
|
+
// For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S].
|
620
|
+
// (?!) should work like \b\B, but is unreliable in Firefox
|
621
|
+
return match[0] === "[]" ? "\\b\\B" : "[\\s\\S]";
|
622
|
+
}
|
623
|
+
);
|
624
|
+
|
625
|
+
// Mode modifier at the start of the pattern only, with any combination of flags imsx: (?imsx)
|
626
|
+
// Does not support x(?i), (?-i), (?i-m), (?i: ), (?i)(?m), etc.
|
627
|
+
XRegExp.addToken(
|
628
|
+
/^\(\?([imsx]+)\)/,
|
629
|
+
function (match) {
|
630
|
+
this.setFlag(match[1]);
|
631
|
+
return "";
|
632
|
+
}
|
633
|
+
);
|
634
|
+
|
635
|
+
// Whitespace and comments, in free-spacing (aka extended) mode only
|
636
|
+
XRegExp.addToken(
|
637
|
+
/(?:\s+|#.*)+/,
|
638
|
+
function (match) {
|
639
|
+
// Keep tokens separated unless the following token is a quantifier
|
640
|
+
return real.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
|
641
|
+
},
|
642
|
+
XRegExp.OUTSIDE_CLASS,
|
643
|
+
function () {return this.hasFlag("x");}
|
644
|
+
);
|
645
|
+
|
646
|
+
// Dot, in dotall (aka singleline) mode only
|
647
|
+
XRegExp.addToken(
|
648
|
+
/\./,
|
649
|
+
function () {return "[\\s\\S]";},
|
650
|
+
XRegExp.OUTSIDE_CLASS,
|
651
|
+
function () {return this.hasFlag("s");}
|
652
|
+
);
|
653
|
+
|
654
|
+
|
655
|
+
//---------------------------------
|
656
|
+
// Backward compatibility
|
657
|
+
//---------------------------------
|
658
|
+
|
659
|
+
// Uncomment the following block for compatibility with XRegExp 1.0-1.2:
|
660
|
+
/*
|
661
|
+
XRegExp.matchWithinChain = XRegExp.matchChain;
|
662
|
+
RegExp.prototype.addFlags = function (s) {return clone(this, s);};
|
663
|
+
RegExp.prototype.execAll = function (s) {var r = []; XRegExp.iterate(s, this, function (m) {r.push(m);}); return r;};
|
664
|
+
RegExp.prototype.forEachExec = function (s, f, c) {return XRegExp.iterate(s, this, f, c);};
|
665
|
+
RegExp.prototype.validate = function (s) {var r = RegExp("^(?:" + this.source + ")$(?!\\s)", getNativeFlags(this)); if (this.global) this.lastIndex = 0; return s.search(r) === 0;};
|
666
|
+
*/
|
667
|
+
|
668
|
+
})();
|
669
|
+
|
670
|
+
// CommonJS
|
671
|
+
typeof(exports) != 'undefined' ? exports.XRegExp = XRegExp : null;
|
672
|
+
var SyntaxHighlighter = function() {
|
673
|
+
|
674
|
+
// CommonJS
|
675
|
+
if (typeof(require) != 'undefined' && typeof(XRegExp) == 'undefined')
|
676
|
+
{
|
677
|
+
XRegExp = require('XRegExp').XRegExp;
|
678
|
+
}
|
679
|
+
|
680
|
+
// Shortcut object which will be assigned to the SyntaxHighlighter variable.
|
681
|
+
// This is a shorthand for local reference in order to avoid long namespace
|
682
|
+
// references to SyntaxHighlighter.whatever...
|
683
|
+
var sh = {
|
684
|
+
defaults : {
|
685
|
+
/** Additional CSS class names to be added to highlighter elements. */
|
686
|
+
'class-name' : '',
|
687
|
+
|
688
|
+
/** First line number. */
|
689
|
+
'first-line' : 1,
|
690
|
+
|
691
|
+
/**
|
692
|
+
* Pads line numbers. Possible values are:
|
693
|
+
*
|
694
|
+
* false - don't pad line numbers.
|
695
|
+
* true - automaticaly pad numbers with minimum required number of leading zeroes.
|
696
|
+
* [int] - length up to which pad line numbers.
|
697
|
+
*/
|
698
|
+
'pad-line-numbers' : false,
|
699
|
+
|
700
|
+
/** Lines to highlight. */
|
701
|
+
'highlight' : null,
|
702
|
+
|
703
|
+
/** Title to be displayed above the code block. */
|
704
|
+
'title' : null,
|
705
|
+
|
706
|
+
/** Enables or disables smart tabs. */
|
707
|
+
'smart-tabs' : true,
|
708
|
+
|
709
|
+
/** Gets or sets tab size. */
|
710
|
+
'tab-size' : 4,
|
711
|
+
|
712
|
+
/** Enables or disables gutter. */
|
713
|
+
'gutter' : true,
|
714
|
+
|
715
|
+
/** Enables or disables toolbar. */
|
716
|
+
'toolbar' : true,
|
717
|
+
|
718
|
+
/** Enables quick code copy and paste from double click. */
|
719
|
+
'quick-code' : true,
|
720
|
+
|
721
|
+
/** Forces code view to be collapsed. */
|
722
|
+
'collapse' : false,
|
723
|
+
|
724
|
+
/** Enables or disables automatic links. */
|
725
|
+
'auto-links' : true,
|
726
|
+
|
727
|
+
/** Gets or sets light mode. Equavalent to turning off gutter and toolbar. */
|
728
|
+
'light' : false,
|
729
|
+
|
730
|
+
'html-script' : false
|
731
|
+
},
|
732
|
+
|
733
|
+
config : {
|
734
|
+
space : ' ',
|
735
|
+
|
736
|
+
/** Enables use of <SCRIPT type="syntaxhighlighter" /> tags. */
|
737
|
+
useScriptTags : true,
|
738
|
+
|
739
|
+
/** Blogger mode flag. */
|
740
|
+
bloggerMode : false,
|
741
|
+
|
742
|
+
stripBrs : false,
|
743
|
+
|
744
|
+
/** Name of the tag that SyntaxHighlighter will automatically look for. */
|
745
|
+
tagName : 'pre',
|
746
|
+
|
747
|
+
strings : {
|
748
|
+
expandSource : 'expand source',
|
749
|
+
help : '?',
|
750
|
+
alert: 'SyntaxHighlighter\n\n',
|
751
|
+
noBrush : 'Can\'t find brush for: ',
|
752
|
+
brushNotHtmlScript : 'Brush wasn\'t configured for html-script option: ',
|
753
|
+
|
754
|
+
// this is populated by the build script
|
755
|
+
aboutDialog : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>About SyntaxHighlighter</title></head><body style="font-family:Geneva,Arial,Helvetica,sans-serif;background-color:#fff;color:#000;font-size:1em;text-align:center;"><div style="text-align:center;margin-top:1.5em;"><div style="font-size:xx-large;">SyntaxHighlighter</div><div style="font-size:.75em;margin-bottom:3em;"><div>version 3.0.83 (July 02 2010)</div><div><a href="http://alexgorbatchev.com/SyntaxHighlighter" target="_blank" style="color:#005896">http://alexgorbatchev.com/SyntaxHighlighter</a></div><div>JavaScript code syntax highlighter.</div><div>Copyright 2004-2010 Alex Gorbatchev.</div></div><div>If you like this script, please <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2930402" style="color:#005896">donate</a> to <br/>keep development active!</div></div></body></html>'
|
756
|
+
}
|
757
|
+
},
|
758
|
+
|
759
|
+
/** Internal 'global' variables. */
|
760
|
+
vars : {
|
761
|
+
discoveredBrushes : null,
|
762
|
+
highlighters : {}
|
763
|
+
},
|
764
|
+
|
765
|
+
/** This object is populated by user included external brush files. */
|
766
|
+
brushes : {},
|
767
|
+
|
768
|
+
/** Common regular expressions. */
|
769
|
+
regexLib : {
|
770
|
+
multiLineCComments : /\/\*[\s\S]*?\*\//gm,
|
771
|
+
singleLineCComments : /\/\/.*$/gm,
|
772
|
+
singleLinePerlComments : /#.*$/gm,
|
773
|
+
doubleQuotedString : /"([^\\"\n]|\\.)*"/g,
|
774
|
+
singleQuotedString : /'([^\\'\n]|\\.)*'/g,
|
775
|
+
multiLineDoubleQuotedString : new XRegExp('"([^\\\\"]|\\\\.)*"', 'gs'),
|
776
|
+
multiLineSingleQuotedString : new XRegExp("'([^\\\\']|\\\\.)*'", 'gs'),
|
777
|
+
xmlComments : /(<|<)!--[\s\S]*?--(>|>)/gm,
|
778
|
+
url : /\w+:\/\/[\w-.\/?%&=:@;]*/g,
|
779
|
+
|
780
|
+
/** <?= ?> tags. */
|
781
|
+
phpScriptTags : { left: /(<|<)\?=?/g, right: /\?(>|>)/g },
|
782
|
+
|
783
|
+
/** <%= %> tags. */
|
784
|
+
aspScriptTags : { left: /(<|<)%=?/g, right: /%(>|>)/g },
|
785
|
+
|
786
|
+
/** <script></script> tags. */
|
787
|
+
scriptScriptTags : { left: /(<|<)\s*script.*?(>|>)/gi, right: /(<|<)\/\s*script\s*(>|>)/gi }
|
788
|
+
},
|
789
|
+
|
790
|
+
toolbar: {
|
791
|
+
/**
|
792
|
+
* Generates HTML markup for the toolbar.
|
793
|
+
* @param {Highlighter} highlighter Highlighter instance.
|
794
|
+
* @return {String} Returns HTML markup.
|
795
|
+
*/
|
796
|
+
getHtml: function(highlighter)
|
797
|
+
{
|
798
|
+
var html = '<div class="toolbar">',
|
799
|
+
items = sh.toolbar.items,
|
800
|
+
list = items.list
|
801
|
+
;
|
802
|
+
|
803
|
+
function defaultGetHtml(highlighter, name)
|
804
|
+
{
|
805
|
+
return sh.toolbar.getButtonHtml(highlighter, name, sh.config.strings[name]);
|
806
|
+
};
|
807
|
+
|
808
|
+
for (var i = 0; i < list.length; i++)
|
809
|
+
html += (items[list[i]].getHtml || defaultGetHtml)(highlighter, list[i]);
|
810
|
+
|
811
|
+
html += '</div>';
|
812
|
+
|
813
|
+
return html;
|
814
|
+
},
|
815
|
+
|
816
|
+
/**
|
817
|
+
* Generates HTML markup for a regular button in the toolbar.
|
818
|
+
* @param {Highlighter} highlighter Highlighter instance.
|
819
|
+
* @param {String} commandName Command name that would be executed.
|
820
|
+
* @param {String} label Label text to display.
|
821
|
+
* @return {String} Returns HTML markup.
|
822
|
+
*/
|
823
|
+
getButtonHtml: function(highlighter, commandName, label)
|
824
|
+
{
|
825
|
+
return '<span><a href="#" class="toolbar_item'
|
826
|
+
+ ' command_' + commandName
|
827
|
+
+ ' ' + commandName
|
828
|
+
+ '">' + label + '</a></span>'
|
829
|
+
;
|
830
|
+
},
|
831
|
+
|
832
|
+
/**
|
833
|
+
* Event handler for a toolbar anchor.
|
834
|
+
*/
|
835
|
+
handler: function(e)
|
836
|
+
{
|
837
|
+
var target = e.target,
|
838
|
+
className = target.className || ''
|
839
|
+
;
|
840
|
+
|
841
|
+
function getValue(name)
|
842
|
+
{
|
843
|
+
var r = new RegExp(name + '_(\\w+)'),
|
844
|
+
match = r.exec(className)
|
845
|
+
;
|
846
|
+
|
847
|
+
return match ? match[1] : null;
|
848
|
+
};
|
849
|
+
|
850
|
+
var highlighter = getHighlighterById(findParentElement(target, '.syntaxhighlighter').id),
|
851
|
+
commandName = getValue('command')
|
852
|
+
;
|
853
|
+
|
854
|
+
// execute the toolbar command
|
855
|
+
if (highlighter && commandName)
|
856
|
+
sh.toolbar.items[commandName].execute(highlighter);
|
857
|
+
|
858
|
+
// disable default A click behaviour
|
859
|
+
e.preventDefault();
|
860
|
+
},
|
861
|
+
|
862
|
+
/** Collection of toolbar items. */
|
863
|
+
items : {
|
864
|
+
// Ordered lis of items in the toolbar. Can't expect `for (var n in items)` to be consistent.
|
865
|
+
list: ['expandSource', 'help'],
|
866
|
+
|
867
|
+
expandSource: {
|
868
|
+
getHtml: function(highlighter)
|
869
|
+
{
|
870
|
+
if (highlighter.getParam('collapse') != true)
|
871
|
+
return '';
|
872
|
+
|
873
|
+
var title = highlighter.getParam('title');
|
874
|
+
return sh.toolbar.getButtonHtml(highlighter, 'expandSource', title ? title : sh.config.strings.expandSource);
|
875
|
+
},
|
876
|
+
|
877
|
+
execute: function(highlighter)
|
878
|
+
{
|
879
|
+
var div = getHighlighterDivById(highlighter.id);
|
880
|
+
removeClass(div, 'collapsed');
|
881
|
+
}
|
882
|
+
},
|
883
|
+
|
884
|
+
/** Command to display the about dialog window. */
|
885
|
+
help: {
|
886
|
+
execute: function(highlighter)
|
887
|
+
{
|
888
|
+
var wnd = popup('', '_blank', 500, 250, 'scrollbars=0'),
|
889
|
+
doc = wnd.document
|
890
|
+
;
|
891
|
+
|
892
|
+
doc.write(sh.config.strings.aboutDialog);
|
893
|
+
doc.close();
|
894
|
+
wnd.focus();
|
895
|
+
}
|
896
|
+
}
|
897
|
+
}
|
898
|
+
},
|
899
|
+
getHighlighterDivId : function(){
|
900
|
+
return highlighterDivId;
|
901
|
+
},
|
902
|
+
/**
|
903
|
+
* Finds all elements on the page which should be processes by SyntaxHighlighter.
|
904
|
+
*
|
905
|
+
* @param {Object} globalParams Optional parameters which override element's
|
906
|
+
* parameters. Only used if element is specified.
|
907
|
+
*
|
908
|
+
* @param {Object} element Optional element to highlight. If none is
|
909
|
+
* provided, all elements in the current document
|
910
|
+
* are returned which qualify.
|
911
|
+
*
|
912
|
+
* @return {Array} Returns list of <code>{ target: DOMElement, params: Object }</code> objects.
|
913
|
+
*/
|
914
|
+
findElements: function(globalParams, element)
|
915
|
+
{
|
916
|
+
var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)),
|
917
|
+
conf = sh.config,
|
918
|
+
result = []
|
919
|
+
;
|
920
|
+
|
921
|
+
// support for <SCRIPT TYPE="syntaxhighlighter" /> feature
|
922
|
+
if (conf.useScriptTags)
|
923
|
+
elements = elements.concat(getSyntaxHighlighterScriptTags());
|
924
|
+
|
925
|
+
if (elements.length === 0)
|
926
|
+
return result;
|
927
|
+
|
928
|
+
for (var i = 0; i < elements.length; i++)
|
929
|
+
{
|
930
|
+
var item = {
|
931
|
+
target: elements[i],
|
932
|
+
// local params take precedence over globals
|
933
|
+
params: merge(globalParams, parseParams(elements[i].className))
|
934
|
+
};
|
935
|
+
|
936
|
+
if (item.params['brush'] == null)
|
937
|
+
continue;
|
938
|
+
|
939
|
+
result.push(item);
|
940
|
+
}
|
941
|
+
|
942
|
+
return result;
|
943
|
+
},
|
944
|
+
|
945
|
+
/**
|
946
|
+
* Shorthand to highlight all elements on the page that are marked as
|
947
|
+
* SyntaxHighlighter source code.
|
948
|
+
*
|
949
|
+
* @param {Object} globalParams Optional parameters which override element's
|
950
|
+
* parameters. Only used if element is specified.
|
951
|
+
*
|
952
|
+
* @param {Object} element Optional element to highlight. If none is
|
953
|
+
* provided, all elements in the current document
|
954
|
+
* are highlighted.
|
955
|
+
*/
|
956
|
+
highlight: function(globalParams, element,print)
|
957
|
+
{
|
958
|
+
|
959
|
+
var elements = this.findElements(globalParams, element),
|
960
|
+
propertyName = 'innerHTML',
|
961
|
+
highlighter = null,
|
962
|
+
conf = sh.config
|
963
|
+
;
|
964
|
+
|
965
|
+
if (elements.length === 0)
|
966
|
+
return;
|
967
|
+
|
968
|
+
for (var i = 0; i < elements.length; i++)
|
969
|
+
{
|
970
|
+
var element = elements[i],
|
971
|
+
target = element.target,
|
972
|
+
params = element.params,
|
973
|
+
brushName = params.brush,
|
974
|
+
code
|
975
|
+
;
|
976
|
+
|
977
|
+
if (brushName == null)
|
978
|
+
continue;
|
979
|
+
|
980
|
+
// Instantiate a brush
|
981
|
+
if (params['html-script'] == 'true' || sh.defaults['html-script'] == true)
|
982
|
+
{
|
983
|
+
highlighter = new sh.HtmlScript(brushName);
|
984
|
+
brushName = 'htmlscript';
|
985
|
+
}
|
986
|
+
else
|
987
|
+
{
|
988
|
+
var brush = findBrush(brushName);
|
989
|
+
|
990
|
+
if (brush)
|
991
|
+
highlighter = new brush();
|
992
|
+
else
|
993
|
+
continue;
|
994
|
+
}
|
995
|
+
|
996
|
+
code = target[propertyName];
|
997
|
+
// remove CDATA from <SCRIPT/> tags if it's present
|
998
|
+
if (conf.useScriptTags)
|
999
|
+
code = stripCData(code);
|
1000
|
+
|
1001
|
+
// Inject title if the attribute is present
|
1002
|
+
if ((target.title || '') != '')
|
1003
|
+
params.title = target.title;
|
1004
|
+
|
1005
|
+
params['brush'] = brushName;
|
1006
|
+
highlighter.init(params);
|
1007
|
+
element = highlighter.getDiv(code);
|
1008
|
+
|
1009
|
+
// carry over ID
|
1010
|
+
if ((target.id || '') != '')
|
1011
|
+
element.id = target.id;
|
1012
|
+
|
1013
|
+
|
1014
|
+
|
1015
|
+
if(print)
|
1016
|
+
return element.innerHTML;
|
1017
|
+
target.parentNode.replaceChild(element, target);
|
1018
|
+
}
|
1019
|
+
},
|
1020
|
+
|
1021
|
+
/**
|
1022
|
+
* Main entry point for the SyntaxHighlighter.
|
1023
|
+
* @param {Object} params Optional params to apply to all highlighted elements.
|
1024
|
+
*/
|
1025
|
+
all: function(params)
|
1026
|
+
{
|
1027
|
+
|
1028
|
+
attachEvent(
|
1029
|
+
window,
|
1030
|
+
'load',
|
1031
|
+
function() { sh.highlight(params); }
|
1032
|
+
);
|
1033
|
+
}
|
1034
|
+
}; // end of sh
|
1035
|
+
|
1036
|
+
sh['all'] = sh.all;
|
1037
|
+
sh['highlight'] = sh.highlight;
|
1038
|
+
|
1039
|
+
/**
|
1040
|
+
* Checks if target DOM elements has specified CSS class.
|
1041
|
+
* @param {DOMElement} target Target DOM element to check.
|
1042
|
+
* @param {String} className Name of the CSS class to check for.
|
1043
|
+
* @return {Boolean} Returns true if class name is present, false otherwise.
|
1044
|
+
*/
|
1045
|
+
function hasClass(target, className)
|
1046
|
+
{
|
1047
|
+
return target.className.indexOf(className) != -1;
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
/**
|
1051
|
+
* Adds CSS class name to the target DOM element.
|
1052
|
+
* @param {DOMElement} target Target DOM element.
|
1053
|
+
* @param {String} className New CSS class to add.
|
1054
|
+
*/
|
1055
|
+
function addClass(target, className)
|
1056
|
+
{
|
1057
|
+
if (!hasClass(target, className))
|
1058
|
+
target.className += ' ' + className;
|
1059
|
+
};
|
1060
|
+
|
1061
|
+
/**
|
1062
|
+
* Removes CSS class name from the target DOM element.
|
1063
|
+
* @param {DOMElement} target Target DOM element.
|
1064
|
+
* @param {String} className CSS class to remove.
|
1065
|
+
*/
|
1066
|
+
function removeClass(target, className)
|
1067
|
+
{
|
1068
|
+
target.className = target.className.replace(className, '');
|
1069
|
+
};
|
1070
|
+
|
1071
|
+
/**
|
1072
|
+
* Converts the source to array object. Mostly used for function arguments and
|
1073
|
+
* lists returned by getElementsByTagName() which aren't Array objects.
|
1074
|
+
* @param {List} source Source list.
|
1075
|
+
* @return {Array} Returns array.
|
1076
|
+
*/
|
1077
|
+
function toArray(source)
|
1078
|
+
{
|
1079
|
+
var result = [];
|
1080
|
+
|
1081
|
+
for (var i = 0; i < source.length; i++)
|
1082
|
+
result.push(source[i]);
|
1083
|
+
|
1084
|
+
return result;
|
1085
|
+
};
|
1086
|
+
|
1087
|
+
/**
|
1088
|
+
* Splits block of text into lines.
|
1089
|
+
* @param {String} block Block of text.
|
1090
|
+
* @return {Array} Returns array of lines.
|
1091
|
+
*/
|
1092
|
+
function splitLines(block)
|
1093
|
+
{
|
1094
|
+
return block.split('\n');
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
/**
|
1098
|
+
* Generates HTML ID for the highlighter.
|
1099
|
+
* @param {String} highlighterId Highlighter ID.
|
1100
|
+
* @return {String} Returns HTML ID.
|
1101
|
+
*/
|
1102
|
+
var highlighterDivId;
|
1103
|
+
function getHighlighterId(id)
|
1104
|
+
{
|
1105
|
+
var prefix = 'highlighter_';
|
1106
|
+
highlighterDivId = id.indexOf(prefix) == 0 ? id : prefix + id;
|
1107
|
+
return highlighterDivId
|
1108
|
+
};
|
1109
|
+
|
1110
|
+
/**
|
1111
|
+
* Finds Highlighter instance by ID.
|
1112
|
+
* @param {String} highlighterId Highlighter ID.
|
1113
|
+
* @return {Highlighter} Returns instance of the highlighter.
|
1114
|
+
*/
|
1115
|
+
|
1116
|
+
function getHighlighterById(id)
|
1117
|
+
{
|
1118
|
+
return sh.vars.highlighters[getHighlighterId(id)];
|
1119
|
+
};
|
1120
|
+
|
1121
|
+
/**
|
1122
|
+
* Finds highlighter's DIV container.
|
1123
|
+
* @param {String} highlighterId Highlighter ID.
|
1124
|
+
* @return {Element} Returns highlighter's DIV element.
|
1125
|
+
*/
|
1126
|
+
|
1127
|
+
function getHighlighterDivById(id)
|
1128
|
+
{
|
1129
|
+
|
1130
|
+
return document.getElementById(getHighlighterId(id))
|
1131
|
+
};
|
1132
|
+
|
1133
|
+
/**
|
1134
|
+
* Stores highlighter so that getHighlighterById() can do its thing. Each
|
1135
|
+
* highlighter must call this method to preserve itself.
|
1136
|
+
* @param {Highilghter} highlighter Highlighter instance.
|
1137
|
+
*/
|
1138
|
+
function storeHighlighter(highlighter)
|
1139
|
+
{
|
1140
|
+
sh.vars.highlighters[getHighlighterId(highlighter.id)] = highlighter;
|
1141
|
+
};
|
1142
|
+
|
1143
|
+
/**
|
1144
|
+
* Looks for a child or parent node which has specified classname.
|
1145
|
+
* Equivalent to jQuery's $(container).find(".className")
|
1146
|
+
* @param {Element} target Target element.
|
1147
|
+
* @param {String} search Class name or node name to look for.
|
1148
|
+
* @param {Boolean} reverse If set to true, will go up the node tree instead of down.
|
1149
|
+
* @return {Element} Returns found child or parent element on null.
|
1150
|
+
*/
|
1151
|
+
function findElement(target, search, reverse /* optional */)
|
1152
|
+
{
|
1153
|
+
if (target == null)
|
1154
|
+
return null;
|
1155
|
+
|
1156
|
+
var nodes = reverse != true ? target.childNodes : [ target.parentNode ],
|
1157
|
+
propertyToFind = { '#' : 'id', '.' : 'className' }[search.substr(0, 1)] || 'nodeName',
|
1158
|
+
expectedValue,
|
1159
|
+
found
|
1160
|
+
;
|
1161
|
+
|
1162
|
+
expectedValue = propertyToFind != 'nodeName'
|
1163
|
+
? search.substr(1)
|
1164
|
+
: search.toUpperCase()
|
1165
|
+
;
|
1166
|
+
|
1167
|
+
// main return of the found node
|
1168
|
+
if ((target[propertyToFind] || '').indexOf(expectedValue) != -1)
|
1169
|
+
return target;
|
1170
|
+
|
1171
|
+
for (var i = 0; nodes && i < nodes.length && found == null; i++)
|
1172
|
+
found = findElement(nodes[i], search, reverse);
|
1173
|
+
|
1174
|
+
return found;
|
1175
|
+
};
|
1176
|
+
|
1177
|
+
/**
|
1178
|
+
* Looks for a parent node which has specified classname.
|
1179
|
+
* This is an alias to <code>findElement(container, className, true)</code>.
|
1180
|
+
* @param {Element} target Target element.
|
1181
|
+
* @param {String} className Class name to look for.
|
1182
|
+
* @return {Element} Returns found parent element on null.
|
1183
|
+
*/
|
1184
|
+
function findParentElement(target, className)
|
1185
|
+
{
|
1186
|
+
return findElement(target, className, true);
|
1187
|
+
};
|
1188
|
+
|
1189
|
+
/**
|
1190
|
+
* Finds an index of element in the array.
|
1191
|
+
* @ignore
|
1192
|
+
* @param {Object} searchElement
|
1193
|
+
* @param {Number} fromIndex
|
1194
|
+
* @return {Number} Returns index of element if found; -1 otherwise.
|
1195
|
+
*/
|
1196
|
+
function indexOf(array, searchElement, fromIndex)
|
1197
|
+
{
|
1198
|
+
fromIndex = Math.max(fromIndex || 0, 0);
|
1199
|
+
|
1200
|
+
for (var i = fromIndex; i < array.length; i++)
|
1201
|
+
if(array[i] == searchElement)
|
1202
|
+
return i;
|
1203
|
+
|
1204
|
+
return -1;
|
1205
|
+
};
|
1206
|
+
|
1207
|
+
/**
|
1208
|
+
* Generates a unique element ID.
|
1209
|
+
*/
|
1210
|
+
function guid(prefix)
|
1211
|
+
{
|
1212
|
+
return (prefix || '') + Math.round(Math.random() * 1000000).toString();
|
1213
|
+
};
|
1214
|
+
|
1215
|
+
/**
|
1216
|
+
* Merges two objects. Values from obj2 override values in obj1.
|
1217
|
+
* Function is NOT recursive and works only for one dimensional objects.
|
1218
|
+
* @param {Object} obj1 First object.
|
1219
|
+
* @param {Object} obj2 Second object.
|
1220
|
+
* @return {Object} Returns combination of both objects.
|
1221
|
+
*/
|
1222
|
+
function merge(obj1, obj2)
|
1223
|
+
{
|
1224
|
+
var result = {}, name;
|
1225
|
+
|
1226
|
+
for (name in obj1)
|
1227
|
+
result[name] = obj1[name];
|
1228
|
+
|
1229
|
+
for (name in obj2)
|
1230
|
+
result[name] = obj2[name];
|
1231
|
+
|
1232
|
+
return result;
|
1233
|
+
};
|
1234
|
+
|
1235
|
+
/**
|
1236
|
+
* Attempts to convert string to boolean.
|
1237
|
+
* @param {String} value Input string.
|
1238
|
+
* @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise.
|
1239
|
+
*/
|
1240
|
+
function toBoolean(value)
|
1241
|
+
{
|
1242
|
+
var result = { "true" : true, "false" : false }[value];
|
1243
|
+
return result == null ? value : result;
|
1244
|
+
};
|
1245
|
+
|
1246
|
+
/**
|
1247
|
+
* Opens up a centered popup window.
|
1248
|
+
* @param {String} url URL to open in the window.
|
1249
|
+
* @param {String} name Popup name.
|
1250
|
+
* @param {int} width Popup width.
|
1251
|
+
* @param {int} height Popup height.
|
1252
|
+
* @param {String} options window.open() options.
|
1253
|
+
* @return {Window} Returns window instance.
|
1254
|
+
*/
|
1255
|
+
function popup(url, name, width, height, options)
|
1256
|
+
{
|
1257
|
+
var x = (screen.width - width) / 2,
|
1258
|
+
y = (screen.height - height) / 2
|
1259
|
+
;
|
1260
|
+
|
1261
|
+
options += ', left=' + x +
|
1262
|
+
', top=' + y +
|
1263
|
+
', width=' + width +
|
1264
|
+
', height=' + height
|
1265
|
+
;
|
1266
|
+
options = options.replace(/^,/, '');
|
1267
|
+
|
1268
|
+
var win = window.open(url, name, options);
|
1269
|
+
win.focus();
|
1270
|
+
return win;
|
1271
|
+
};
|
1272
|
+
|
1273
|
+
/**
|
1274
|
+
* Adds event handler to the target object.
|
1275
|
+
* @param {Object} obj Target object.
|
1276
|
+
* @param {String} type Name of the event.
|
1277
|
+
* @param {Function} func Handling function.
|
1278
|
+
*/
|
1279
|
+
function attachEvent(obj, type, func, scope)
|
1280
|
+
{
|
1281
|
+
function handler(e)
|
1282
|
+
{
|
1283
|
+
e = e || window.event;
|
1284
|
+
|
1285
|
+
if (!e.target)
|
1286
|
+
{
|
1287
|
+
e.target = e.srcElement;
|
1288
|
+
e.preventDefault = function()
|
1289
|
+
{
|
1290
|
+
this.returnValue = false;
|
1291
|
+
};
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
func.call(scope || window, e);
|
1295
|
+
};
|
1296
|
+
|
1297
|
+
if (obj.attachEvent)
|
1298
|
+
{
|
1299
|
+
obj.attachEvent('on' + type, handler);
|
1300
|
+
}
|
1301
|
+
else
|
1302
|
+
{
|
1303
|
+
obj.addEventListener(type, handler, false);
|
1304
|
+
}
|
1305
|
+
};
|
1306
|
+
|
1307
|
+
/**
|
1308
|
+
* Displays an alert.
|
1309
|
+
* @param {String} str String to display.
|
1310
|
+
*/
|
1311
|
+
function alert(str)
|
1312
|
+
{
|
1313
|
+
window.alert(sh.config.strings.alert + str);
|
1314
|
+
};
|
1315
|
+
|
1316
|
+
/**
|
1317
|
+
* Finds a brush by its alias.
|
1318
|
+
*
|
1319
|
+
* @param {String} alias Brush alias.
|
1320
|
+
* @param {Boolean} showAlert Suppresses the alert if false.
|
1321
|
+
* @return {Brush} Returns bursh constructor if found, null otherwise.
|
1322
|
+
*/
|
1323
|
+
function findBrush(alias, showAlert)
|
1324
|
+
{
|
1325
|
+
var brushes = sh.vars.discoveredBrushes,
|
1326
|
+
result = null
|
1327
|
+
;
|
1328
|
+
|
1329
|
+
if (brushes == null)
|
1330
|
+
{
|
1331
|
+
brushes = {};
|
1332
|
+
|
1333
|
+
// Find all brushes
|
1334
|
+
for (var brush in sh.brushes)
|
1335
|
+
{
|
1336
|
+
var info = sh.brushes[brush],
|
1337
|
+
aliases = info.aliases
|
1338
|
+
;
|
1339
|
+
|
1340
|
+
if (aliases == null)
|
1341
|
+
continue;
|
1342
|
+
|
1343
|
+
// keep the brush name
|
1344
|
+
info.brushName = brush.toLowerCase();
|
1345
|
+
|
1346
|
+
for (var i = 0; i < aliases.length; i++)
|
1347
|
+
brushes[aliases[i]] = brush;
|
1348
|
+
}
|
1349
|
+
|
1350
|
+
sh.vars.discoveredBrushes = brushes;
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
result = sh.brushes[brushes[alias]];
|
1354
|
+
|
1355
|
+
if (result == null && showAlert != false)
|
1356
|
+
alert(sh.config.strings.noBrush + alias);
|
1357
|
+
|
1358
|
+
return result;
|
1359
|
+
};
|
1360
|
+
|
1361
|
+
/**
|
1362
|
+
* Executes a callback on each line and replaces each line with result from the callback.
|
1363
|
+
* @param {Object} str Input string.
|
1364
|
+
* @param {Object} callback Callback function taking one string argument and returning a string.
|
1365
|
+
*/
|
1366
|
+
function eachLine(str, callback)
|
1367
|
+
{
|
1368
|
+
var lines = splitLines(str);
|
1369
|
+
|
1370
|
+
for (var i = 0; i < lines.length; i++)
|
1371
|
+
lines[i] = callback(lines[i], i);
|
1372
|
+
|
1373
|
+
return lines.join('\n');
|
1374
|
+
};
|
1375
|
+
|
1376
|
+
/**
|
1377
|
+
* This is a special trim which only removes first and last empty lines
|
1378
|
+
* and doesn't affect valid leading space on the first line.
|
1379
|
+
*
|
1380
|
+
* @param {String} str Input string
|
1381
|
+
* @return {String} Returns string without empty first and last lines.
|
1382
|
+
*/
|
1383
|
+
function trimFirstAndLastLines(str)
|
1384
|
+
{
|
1385
|
+
return str.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, '');
|
1386
|
+
};
|
1387
|
+
|
1388
|
+
/**
|
1389
|
+
* Parses key/value pairs into hash object.
|
1390
|
+
*
|
1391
|
+
* Understands the following formats:
|
1392
|
+
* - name: word;
|
1393
|
+
* - name: [word, word];
|
1394
|
+
* - name: "string";
|
1395
|
+
* - name: 'string';
|
1396
|
+
*
|
1397
|
+
* For example:
|
1398
|
+
* name1: value; name2: [value, value]; name3: 'value'
|
1399
|
+
*
|
1400
|
+
* @param {String} str Input string.
|
1401
|
+
* @return {Object} Returns deserialized object.
|
1402
|
+
*/
|
1403
|
+
function parseParams(str)
|
1404
|
+
{
|
1405
|
+
var match,
|
1406
|
+
result = {},
|
1407
|
+
arrayRegex = new XRegExp("^\\[(?<values>(.*?))\\]$"),
|
1408
|
+
regex = new XRegExp(
|
1409
|
+
"(?<name>[\\w-]+)" +
|
1410
|
+
"\\s*:\\s*" +
|
1411
|
+
"(?<value>" +
|
1412
|
+
"[\\w-%#]+|" + // word
|
1413
|
+
"\\[.*?\\]|" + // [] array
|
1414
|
+
'".*?"|' + // "" string
|
1415
|
+
"'.*?'" + // '' string
|
1416
|
+
")\\s*;?",
|
1417
|
+
"g"
|
1418
|
+
)
|
1419
|
+
;
|
1420
|
+
|
1421
|
+
while ((match = regex.exec(str)) != null)
|
1422
|
+
{
|
1423
|
+
var value = match.value
|
1424
|
+
.replace(/^['"]|['"]$/g, '') // strip quotes from end of strings
|
1425
|
+
;
|
1426
|
+
|
1427
|
+
// try to parse array value
|
1428
|
+
if (value != null && arrayRegex.test(value))
|
1429
|
+
{
|
1430
|
+
var m = arrayRegex.exec(value);
|
1431
|
+
value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : [];
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
result[match.name] = value;
|
1435
|
+
}
|
1436
|
+
|
1437
|
+
return result;
|
1438
|
+
};
|
1439
|
+
|
1440
|
+
/**
|
1441
|
+
* Wraps each line of the string into <code/> tag with given style applied to it.
|
1442
|
+
*
|
1443
|
+
* @param {String} str Input string.
|
1444
|
+
* @param {String} css Style name to apply to the string.
|
1445
|
+
* @return {String} Returns input string with each line surrounded by <span/> tag.
|
1446
|
+
*/
|
1447
|
+
function wrapLinesWithCode(str, css)
|
1448
|
+
{
|
1449
|
+
if (str == null || str.length == 0 || str == '\n')
|
1450
|
+
return str;
|
1451
|
+
|
1452
|
+
str = str.replace(/</g, '<');
|
1453
|
+
|
1454
|
+
// Replace two or more sequential spaces with leaving last space untouched.
|
1455
|
+
str = str.replace(/ {2,}/g, function(m)
|
1456
|
+
{
|
1457
|
+
var spaces = '';
|
1458
|
+
|
1459
|
+
for (var i = 0; i < m.length - 1; i++)
|
1460
|
+
spaces += sh.config.space;
|
1461
|
+
|
1462
|
+
return spaces + ' ';
|
1463
|
+
});
|
1464
|
+
|
1465
|
+
// Split each line and apply <span class="...">...</span> to them so that
|
1466
|
+
// leading spaces aren't included.
|
1467
|
+
if (css != null)
|
1468
|
+
str = eachLine(str, function(line)
|
1469
|
+
{
|
1470
|
+
if (line.length == 0)
|
1471
|
+
return '';
|
1472
|
+
|
1473
|
+
var spaces = '';
|
1474
|
+
|
1475
|
+
line = line.replace(/^( | )+/, function(s)
|
1476
|
+
{
|
1477
|
+
spaces = s;
|
1478
|
+
return '';
|
1479
|
+
});
|
1480
|
+
|
1481
|
+
if (line.length == 0)
|
1482
|
+
return spaces;
|
1483
|
+
|
1484
|
+
return spaces + '<code class="' + css + '">' + line + '</code>';
|
1485
|
+
});
|
1486
|
+
|
1487
|
+
return str;
|
1488
|
+
};
|
1489
|
+
|
1490
|
+
/**
|
1491
|
+
* Pads number with zeros until it's length is the same as given length.
|
1492
|
+
*
|
1493
|
+
* @param {Number} number Number to pad.
|
1494
|
+
* @param {Number} length Max string length with.
|
1495
|
+
* @return {String} Returns a string padded with proper amount of '0'.
|
1496
|
+
*/
|
1497
|
+
function padNumber(number, length)
|
1498
|
+
{
|
1499
|
+
var result = number.toString();
|
1500
|
+
|
1501
|
+
while (result.length < length)
|
1502
|
+
result = '0' + result;
|
1503
|
+
|
1504
|
+
return result;
|
1505
|
+
};
|
1506
|
+
|
1507
|
+
/**
|
1508
|
+
* Replaces tabs with spaces.
|
1509
|
+
*
|
1510
|
+
* @param {String} code Source code.
|
1511
|
+
* @param {Number} tabSize Size of the tab.
|
1512
|
+
* @return {String} Returns code with all tabs replaces by spaces.
|
1513
|
+
*/
|
1514
|
+
function processTabs(code, tabSize)
|
1515
|
+
{
|
1516
|
+
var tab = '';
|
1517
|
+
|
1518
|
+
for (var i = 0; i < tabSize; i++)
|
1519
|
+
tab += ' ';
|
1520
|
+
|
1521
|
+
return code.replace(/\t/g, tab);
|
1522
|
+
};
|
1523
|
+
|
1524
|
+
/**
|
1525
|
+
* Replaces tabs with smart spaces.
|
1526
|
+
*
|
1527
|
+
* @param {String} code Code to fix the tabs in.
|
1528
|
+
* @param {Number} tabSize Number of spaces in a column.
|
1529
|
+
* @return {String} Returns code with all tabs replaces with roper amount of spaces.
|
1530
|
+
*/
|
1531
|
+
function processSmartTabs(code, tabSize)
|
1532
|
+
{
|
1533
|
+
var lines = splitLines(code),
|
1534
|
+
tab = '\t',
|
1535
|
+
spaces = ''
|
1536
|
+
;
|
1537
|
+
|
1538
|
+
// Create a string with 1000 spaces to copy spaces from...
|
1539
|
+
// It's assumed that there would be no indentation longer than that.
|
1540
|
+
for (var i = 0; i < 50; i++)
|
1541
|
+
spaces += ' '; // 20 spaces * 50
|
1542
|
+
|
1543
|
+
// This function inserts specified amount of spaces in the string
|
1544
|
+
// where a tab is while removing that given tab.
|
1545
|
+
function insertSpaces(line, pos, count)
|
1546
|
+
{
|
1547
|
+
return line.substr(0, pos)
|
1548
|
+
+ spaces.substr(0, count)
|
1549
|
+
+ line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
|
1550
|
+
;
|
1551
|
+
};
|
1552
|
+
|
1553
|
+
// Go through all the lines and do the 'smart tabs' magic.
|
1554
|
+
code = eachLine(code, function(line)
|
1555
|
+
{
|
1556
|
+
if (line.indexOf(tab) == -1)
|
1557
|
+
return line;
|
1558
|
+
|
1559
|
+
var pos = 0;
|
1560
|
+
|
1561
|
+
while ((pos = line.indexOf(tab)) != -1)
|
1562
|
+
{
|
1563
|
+
// This is pretty much all there is to the 'smart tabs' logic.
|
1564
|
+
// Based on the position within the line and size of a tab,
|
1565
|
+
// calculate the amount of spaces we need to insert.
|
1566
|
+
var spaces = tabSize - pos % tabSize;
|
1567
|
+
line = insertSpaces(line, pos, spaces);
|
1568
|
+
}
|
1569
|
+
|
1570
|
+
return line;
|
1571
|
+
});
|
1572
|
+
|
1573
|
+
return code;
|
1574
|
+
};
|
1575
|
+
|
1576
|
+
/**
|
1577
|
+
* Performs various string fixes based on configuration.
|
1578
|
+
*/
|
1579
|
+
function fixInputString(str)
|
1580
|
+
{
|
1581
|
+
var br = /<br\s*\/?>|<br\s*\/?>/gi;
|
1582
|
+
|
1583
|
+
if (sh.config.bloggerMode == true)
|
1584
|
+
str = str.replace(br, '\n');
|
1585
|
+
|
1586
|
+
if (sh.config.stripBrs == true)
|
1587
|
+
str = str.replace(br, '');
|
1588
|
+
|
1589
|
+
return str;
|
1590
|
+
};
|
1591
|
+
|
1592
|
+
/**
|
1593
|
+
* Removes all white space at the begining and end of a string.
|
1594
|
+
*
|
1595
|
+
* @param {String} str String to trim.
|
1596
|
+
* @return {String} Returns string without leading and following white space characters.
|
1597
|
+
*/
|
1598
|
+
function trim(str)
|
1599
|
+
{
|
1600
|
+
return str.replace(/^\s+|\s+$/g, '');
|
1601
|
+
};
|
1602
|
+
|
1603
|
+
/**
|
1604
|
+
* Unindents a block of text by the lowest common indent amount.
|
1605
|
+
* @param {String} str Text to unindent.
|
1606
|
+
* @return {String} Returns unindented text block.
|
1607
|
+
*/
|
1608
|
+
function unindent(str)
|
1609
|
+
{
|
1610
|
+
var lines = splitLines(fixInputString(str)),
|
1611
|
+
indents = new Array(),
|
1612
|
+
regex = /^\s*/,
|
1613
|
+
min = 1000
|
1614
|
+
;
|
1615
|
+
|
1616
|
+
// go through every line and check for common number of indents
|
1617
|
+
for (var i = 0; i < lines.length && min > 0; i++)
|
1618
|
+
{
|
1619
|
+
var line = lines[i];
|
1620
|
+
|
1621
|
+
if (trim(line).length == 0)
|
1622
|
+
continue;
|
1623
|
+
|
1624
|
+
var matches = regex.exec(line);
|
1625
|
+
|
1626
|
+
// In the event that just one line doesn't have leading white space
|
1627
|
+
// we can't unindent anything, so bail completely.
|
1628
|
+
if (matches == null)
|
1629
|
+
return str;
|
1630
|
+
|
1631
|
+
min = Math.min(matches[0].length, min);
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
// trim minimum common number of white space from the begining of every line
|
1635
|
+
if (min > 0)
|
1636
|
+
for (var i = 0; i < lines.length; i++)
|
1637
|
+
lines[i] = lines[i].substr(min);
|
1638
|
+
|
1639
|
+
return lines.join('\n');
|
1640
|
+
};
|
1641
|
+
|
1642
|
+
/**
|
1643
|
+
* Callback method for Array.sort() which sorts matches by
|
1644
|
+
* index position and then by length.
|
1645
|
+
*
|
1646
|
+
* @param {Match} m1 Left object.
|
1647
|
+
* @param {Match} m2 Right object.
|
1648
|
+
* @return {Number} Returns -1, 0 or -1 as a comparison result.
|
1649
|
+
*/
|
1650
|
+
function matchesSortCallback(m1, m2)
|
1651
|
+
{
|
1652
|
+
// sort matches by index first
|
1653
|
+
if(m1.index < m2.index)
|
1654
|
+
return -1;
|
1655
|
+
else if(m1.index > m2.index)
|
1656
|
+
return 1;
|
1657
|
+
else
|
1658
|
+
{
|
1659
|
+
// if index is the same, sort by length
|
1660
|
+
if(m1.length < m2.length)
|
1661
|
+
return -1;
|
1662
|
+
else if(m1.length > m2.length)
|
1663
|
+
return 1;
|
1664
|
+
}
|
1665
|
+
|
1666
|
+
return 0;
|
1667
|
+
};
|
1668
|
+
|
1669
|
+
/**
|
1670
|
+
* Executes given regular expression on provided code and returns all
|
1671
|
+
* matches that are found.
|
1672
|
+
*
|
1673
|
+
* @param {String} code Code to execute regular expression on.
|
1674
|
+
* @param {Object} regex Regular expression item info from <code>regexList</code> collection.
|
1675
|
+
* @return {Array} Returns a list of Match objects.
|
1676
|
+
*/
|
1677
|
+
function getMatches(code, regexInfo)
|
1678
|
+
{
|
1679
|
+
function defaultAdd(match, regexInfo)
|
1680
|
+
{
|
1681
|
+
return match[0];
|
1682
|
+
};
|
1683
|
+
|
1684
|
+
var index = 0,
|
1685
|
+
match = null,
|
1686
|
+
matches = [],
|
1687
|
+
func = regexInfo.func ? regexInfo.func : defaultAdd
|
1688
|
+
;
|
1689
|
+
|
1690
|
+
while((match = regexInfo.regex.exec(code)) != null)
|
1691
|
+
{
|
1692
|
+
var resultMatch = func(match, regexInfo);
|
1693
|
+
|
1694
|
+
if (typeof(resultMatch) == 'string')
|
1695
|
+
resultMatch = [new sh.Match(resultMatch, match.index, regexInfo.css)];
|
1696
|
+
|
1697
|
+
matches = matches.concat(resultMatch);
|
1698
|
+
}
|
1699
|
+
|
1700
|
+
return matches;
|
1701
|
+
};
|
1702
|
+
|
1703
|
+
/**
|
1704
|
+
* Turns all URLs in the code into <a/> tags.
|
1705
|
+
* @param {String} code Input code.
|
1706
|
+
* @return {String} Returns code with </a> tags.
|
1707
|
+
*/
|
1708
|
+
function processUrls(code)
|
1709
|
+
{
|
1710
|
+
var gt = /(.*)((>|<).*)/;
|
1711
|
+
|
1712
|
+
return code.replace(sh.regexLib.url, function(m)
|
1713
|
+
{
|
1714
|
+
var suffix = '',
|
1715
|
+
match = null
|
1716
|
+
;
|
1717
|
+
|
1718
|
+
// We include < and > in the URL for the common cases like <http://google.com>
|
1719
|
+
// The problem is that they get transformed into <http://google.com>
|
1720
|
+
// Where as > easily looks like part of the URL string.
|
1721
|
+
|
1722
|
+
if (match = gt.exec(m))
|
1723
|
+
{
|
1724
|
+
m = match[1];
|
1725
|
+
suffix = match[2];
|
1726
|
+
}
|
1727
|
+
|
1728
|
+
return '<a href="' + m + '">' + m + '</a>' + suffix;
|
1729
|
+
});
|
1730
|
+
};
|
1731
|
+
|
1732
|
+
/**
|
1733
|
+
* Finds all <SCRIPT TYPE="syntaxhighlighter" /> elementss.
|
1734
|
+
* @return {Array} Returns array of all found SyntaxHighlighter tags.
|
1735
|
+
*/
|
1736
|
+
function getSyntaxHighlighterScriptTags()
|
1737
|
+
{
|
1738
|
+
var tags = document.getElementsByTagName('script'),
|
1739
|
+
result = []
|
1740
|
+
;
|
1741
|
+
|
1742
|
+
for (var i = 0; i < tags.length; i++)
|
1743
|
+
if (tags[i].type == 'syntaxhighlighter')
|
1744
|
+
result.push(tags[i]);
|
1745
|
+
|
1746
|
+
return result;
|
1747
|
+
};
|
1748
|
+
|
1749
|
+
/**
|
1750
|
+
* Strips <![CDATA[]]> from <SCRIPT /> content because it should be used
|
1751
|
+
* there in most cases for XHTML compliance.
|
1752
|
+
* @param {String} original Input code.
|
1753
|
+
* @return {String} Returns code without leading <![CDATA[]]> tags.
|
1754
|
+
*/
|
1755
|
+
function stripCData(original)
|
1756
|
+
{
|
1757
|
+
var left = '<![CDATA[',
|
1758
|
+
right = ']]>',
|
1759
|
+
// for some reason IE inserts some leading blanks here
|
1760
|
+
copy = trim(original),
|
1761
|
+
changed = false,
|
1762
|
+
leftLength = left.length,
|
1763
|
+
rightLength = right.length
|
1764
|
+
;
|
1765
|
+
|
1766
|
+
if (copy.indexOf(left) == 0)
|
1767
|
+
{
|
1768
|
+
copy = copy.substring(leftLength);
|
1769
|
+
changed = true;
|
1770
|
+
}
|
1771
|
+
|
1772
|
+
var copyLength = copy.length;
|
1773
|
+
|
1774
|
+
if (copy.indexOf(right) == copyLength - rightLength)
|
1775
|
+
{
|
1776
|
+
copy = copy.substring(0, copyLength - rightLength);
|
1777
|
+
changed = true;
|
1778
|
+
}
|
1779
|
+
|
1780
|
+
return changed ? copy : original;
|
1781
|
+
};
|
1782
|
+
|
1783
|
+
|
1784
|
+
/**
|
1785
|
+
* Quick code mouse double click handler.
|
1786
|
+
*/
|
1787
|
+
function quickCodeHandler(e)
|
1788
|
+
{
|
1789
|
+
var target = e.target,
|
1790
|
+
highlighterDiv = findParentElement(target, '.syntaxhighlighter'),
|
1791
|
+
container = findParentElement(target, '.container'),
|
1792
|
+
textarea = document.createElement('textarea'),
|
1793
|
+
highlighter
|
1794
|
+
;
|
1795
|
+
|
1796
|
+
if (!container || !highlighterDiv || findElement(container, 'textarea'))
|
1797
|
+
return;
|
1798
|
+
|
1799
|
+
highlighter = getHighlighterById(highlighterDiv.id);
|
1800
|
+
|
1801
|
+
// add source class name
|
1802
|
+
addClass(highlighterDiv, 'source');
|
1803
|
+
|
1804
|
+
// Have to go over each line and grab it's text, can't just do it on the
|
1805
|
+
// container because Firefox loses all \n where as Webkit doesn't.
|
1806
|
+
var lines = container.childNodes,
|
1807
|
+
code = []
|
1808
|
+
;
|
1809
|
+
|
1810
|
+
for (var i = 0; i < lines.length; i++)
|
1811
|
+
code.push(lines[i].innerText || lines[i].textContent);
|
1812
|
+
|
1813
|
+
// using \r instead of \r or \r\n makes this work equally well on IE, FF and Webkit
|
1814
|
+
code = code.join('\r');
|
1815
|
+
|
1816
|
+
// inject <textarea/> tag
|
1817
|
+
textarea.appendChild(document.createTextNode(code));
|
1818
|
+
container.appendChild(textarea);
|
1819
|
+
|
1820
|
+
// preselect all text
|
1821
|
+
textarea.focus();
|
1822
|
+
textarea.select();
|
1823
|
+
|
1824
|
+
// set up handler for lost focus
|
1825
|
+
attachEvent(textarea, 'blur', function(e)
|
1826
|
+
{
|
1827
|
+
textarea.parentNode.removeChild(textarea);
|
1828
|
+
removeClass(highlighterDiv, 'source');
|
1829
|
+
});
|
1830
|
+
};
|
1831
|
+
|
1832
|
+
/**
|
1833
|
+
* Match object.
|
1834
|
+
*/
|
1835
|
+
sh.Match = function(value, index, css)
|
1836
|
+
{
|
1837
|
+
this.value = value;
|
1838
|
+
this.index = index;
|
1839
|
+
this.length = value.length;
|
1840
|
+
this.css = css;
|
1841
|
+
this.brushName = null;
|
1842
|
+
};
|
1843
|
+
|
1844
|
+
sh.Match.prototype.toString = function()
|
1845
|
+
{
|
1846
|
+
return this.value;
|
1847
|
+
};
|
1848
|
+
|
1849
|
+
/**
|
1850
|
+
* Simulates HTML code with a scripting language embedded.
|
1851
|
+
*
|
1852
|
+
* @param {String} scriptBrushName Brush name of the scripting language.
|
1853
|
+
*/
|
1854
|
+
sh.HtmlScript = function(scriptBrushName)
|
1855
|
+
{
|
1856
|
+
var brushClass = findBrush(scriptBrushName),
|
1857
|
+
scriptBrush,
|
1858
|
+
xmlBrush = new sh.brushes.Xml(),
|
1859
|
+
bracketsRegex = null,
|
1860
|
+
ref = this,
|
1861
|
+
methodsToExpose = 'getDiv getHtml init'.split(' ')
|
1862
|
+
;
|
1863
|
+
|
1864
|
+
if (brushClass == null)
|
1865
|
+
return;
|
1866
|
+
|
1867
|
+
scriptBrush = new brushClass();
|
1868
|
+
|
1869
|
+
for(var i = 0; i < methodsToExpose.length; i++)
|
1870
|
+
// make a closure so we don't lose the name after i changes
|
1871
|
+
(function() {
|
1872
|
+
var name = methodsToExpose[i];
|
1873
|
+
|
1874
|
+
ref[name] = function()
|
1875
|
+
{
|
1876
|
+
return xmlBrush[name].apply(xmlBrush, arguments);
|
1877
|
+
};
|
1878
|
+
})();
|
1879
|
+
|
1880
|
+
if (scriptBrush.htmlScript == null)
|
1881
|
+
{
|
1882
|
+
alert(sh.config.strings.brushNotHtmlScript + scriptBrushName);
|
1883
|
+
return;
|
1884
|
+
}
|
1885
|
+
|
1886
|
+
xmlBrush.regexList.push(
|
1887
|
+
{ regex: scriptBrush.htmlScript.code, func: process }
|
1888
|
+
);
|
1889
|
+
|
1890
|
+
function offsetMatches(matches, offset)
|
1891
|
+
{
|
1892
|
+
for (var j = 0; j < matches.length; j++)
|
1893
|
+
matches[j].index += offset;
|
1894
|
+
}
|
1895
|
+
|
1896
|
+
function process(match, info)
|
1897
|
+
{
|
1898
|
+
var code = match.code,
|
1899
|
+
matches = [],
|
1900
|
+
regexList = scriptBrush.regexList,
|
1901
|
+
offset = match.index + match.left.length,
|
1902
|
+
htmlScript = scriptBrush.htmlScript,
|
1903
|
+
result
|
1904
|
+
;
|
1905
|
+
|
1906
|
+
// add all matches from the code
|
1907
|
+
for (var i = 0; i < regexList.length; i++)
|
1908
|
+
{
|
1909
|
+
result = getMatches(code, regexList[i]);
|
1910
|
+
offsetMatches(result, offset);
|
1911
|
+
matches = matches.concat(result);
|
1912
|
+
}
|
1913
|
+
|
1914
|
+
// add left script bracket
|
1915
|
+
if (htmlScript.left != null && match.left != null)
|
1916
|
+
{
|
1917
|
+
result = getMatches(match.left, htmlScript.left);
|
1918
|
+
offsetMatches(result, match.index);
|
1919
|
+
matches = matches.concat(result);
|
1920
|
+
}
|
1921
|
+
|
1922
|
+
// add right script bracket
|
1923
|
+
if (htmlScript.right != null && match.right != null)
|
1924
|
+
{
|
1925
|
+
result = getMatches(match.right, htmlScript.right);
|
1926
|
+
offsetMatches(result, match.index + match[0].lastIndexOf(match.right));
|
1927
|
+
matches = matches.concat(result);
|
1928
|
+
}
|
1929
|
+
|
1930
|
+
for (var j = 0; j < matches.length; j++)
|
1931
|
+
matches[j].brushName = brushClass.brushName;
|
1932
|
+
|
1933
|
+
return matches;
|
1934
|
+
}
|
1935
|
+
};
|
1936
|
+
|
1937
|
+
/**
|
1938
|
+
* Main Highlither class.
|
1939
|
+
* @constructor
|
1940
|
+
*/
|
1941
|
+
sh.Highlighter = function()
|
1942
|
+
{
|
1943
|
+
// not putting any code in here because of the prototype inheritance
|
1944
|
+
};
|
1945
|
+
|
1946
|
+
sh.Highlighter.prototype = {
|
1947
|
+
/**
|
1948
|
+
* Returns value of the parameter passed to the highlighter.
|
1949
|
+
* @param {String} name Name of the parameter.
|
1950
|
+
* @param {Object} defaultValue Default value.
|
1951
|
+
* @return {Object} Returns found value or default value otherwise.
|
1952
|
+
*/
|
1953
|
+
getParam: function(name, defaultValue)
|
1954
|
+
{
|
1955
|
+
var result = this.params[name];
|
1956
|
+
return toBoolean(result == null ? defaultValue : result);
|
1957
|
+
},
|
1958
|
+
|
1959
|
+
/**
|
1960
|
+
* Shortcut to document.createElement().
|
1961
|
+
* @param {String} name Name of the element to create (DIV, A, etc).
|
1962
|
+
* @return {HTMLElement} Returns new HTML element.
|
1963
|
+
*/
|
1964
|
+
create: function(name)
|
1965
|
+
{
|
1966
|
+
return document.createElement(name);
|
1967
|
+
},
|
1968
|
+
|
1969
|
+
/**
|
1970
|
+
* Applies all regular expression to the code and stores all found
|
1971
|
+
* matches in the `this.matches` array.
|
1972
|
+
* @param {Array} regexList List of regular expressions.
|
1973
|
+
* @param {String} code Source code.
|
1974
|
+
* @return {Array} Returns list of matches.
|
1975
|
+
*/
|
1976
|
+
findMatches: function(regexList, code)
|
1977
|
+
{
|
1978
|
+
var result = [];
|
1979
|
+
|
1980
|
+
if (regexList != null)
|
1981
|
+
for (var i = 0; i < regexList.length; i++)
|
1982
|
+
// BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com)
|
1983
|
+
if (typeof (regexList[i]) == "object")
|
1984
|
+
result = result.concat(getMatches(code, regexList[i]));
|
1985
|
+
|
1986
|
+
// sort and remove nested the matches
|
1987
|
+
return this.removeNestedMatches(result.sort(matchesSortCallback));
|
1988
|
+
},
|
1989
|
+
|
1990
|
+
/**
|
1991
|
+
* Checks to see if any of the matches are inside of other matches.
|
1992
|
+
* This process would get rid of highligted strings inside comments,
|
1993
|
+
* keywords inside strings and so on.
|
1994
|
+
*/
|
1995
|
+
removeNestedMatches: function(matches)
|
1996
|
+
{
|
1997
|
+
// Optimized by Jose Prado (http://joseprado.com)
|
1998
|
+
for (var i = 0; i < matches.length; i++)
|
1999
|
+
{
|
2000
|
+
if (matches[i] === null)
|
2001
|
+
continue;
|
2002
|
+
|
2003
|
+
var itemI = matches[i],
|
2004
|
+
itemIEndPos = itemI.index + itemI.length
|
2005
|
+
;
|
2006
|
+
|
2007
|
+
for (var j = i + 1; j < matches.length && matches[i] !== null; j++)
|
2008
|
+
{
|
2009
|
+
var itemJ = matches[j];
|
2010
|
+
|
2011
|
+
if (itemJ === null)
|
2012
|
+
continue;
|
2013
|
+
else if (itemJ.index > itemIEndPos)
|
2014
|
+
break;
|
2015
|
+
else if (itemJ.index == itemI.index && itemJ.length > itemI.length)
|
2016
|
+
matches[i] = null;
|
2017
|
+
else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos)
|
2018
|
+
matches[j] = null;
|
2019
|
+
}
|
2020
|
+
}
|
2021
|
+
|
2022
|
+
return matches;
|
2023
|
+
},
|
2024
|
+
|
2025
|
+
/**
|
2026
|
+
* Creates an array containing integer line numbers starting from the 'first-line' param.
|
2027
|
+
* @return {Array} Returns array of integers.
|
2028
|
+
*/
|
2029
|
+
figureOutLineNumbers: function(code)
|
2030
|
+
{
|
2031
|
+
var lines = [],
|
2032
|
+
firstLine = parseInt(this.getParam('first-line'))
|
2033
|
+
;
|
2034
|
+
|
2035
|
+
eachLine(code, function(line, index)
|
2036
|
+
{
|
2037
|
+
lines.push(index + firstLine);
|
2038
|
+
});
|
2039
|
+
|
2040
|
+
return lines;
|
2041
|
+
},
|
2042
|
+
|
2043
|
+
/**
|
2044
|
+
* Determines if specified line number is in the highlighted list.
|
2045
|
+
*/
|
2046
|
+
isLineHighlighted: function(lineNumber)
|
2047
|
+
{
|
2048
|
+
var list = this.getParam('highlight', []);
|
2049
|
+
|
2050
|
+
if (typeof(list) != 'object' && list.push == null)
|
2051
|
+
list = [ list ];
|
2052
|
+
|
2053
|
+
return indexOf(list, lineNumber.toString()) != -1;
|
2054
|
+
},
|
2055
|
+
|
2056
|
+
/**
|
2057
|
+
* Generates HTML markup for a single line of code while determining alternating line style.
|
2058
|
+
* @param {Integer} lineNumber Line number.
|
2059
|
+
* @param {String} code Line HTML markup.
|
2060
|
+
* @return {String} Returns HTML markup.
|
2061
|
+
*/
|
2062
|
+
getLineHtml: function(lineIndex, lineNumber, code)
|
2063
|
+
{
|
2064
|
+
var classes = [
|
2065
|
+
'line',
|
2066
|
+
'number' + lineNumber,
|
2067
|
+
'index' + lineIndex,
|
2068
|
+
'alt' + (lineNumber % 2 == 0 ? 1 : 2).toString()
|
2069
|
+
];
|
2070
|
+
|
2071
|
+
if (this.isLineHighlighted(lineNumber))
|
2072
|
+
classes.push('highlighted');
|
2073
|
+
|
2074
|
+
if (lineNumber == 0)
|
2075
|
+
classes.push('break');
|
2076
|
+
|
2077
|
+
return '<div class="' + classes.join(' ') + '">' + code + '</div>';
|
2078
|
+
},
|
2079
|
+
|
2080
|
+
/**
|
2081
|
+
* Generates HTML markup for line number column.
|
2082
|
+
* @param {String} code Complete code HTML markup.
|
2083
|
+
* @param {Array} lineNumbers Calculated line numbers.
|
2084
|
+
* @return {String} Returns HTML markup.
|
2085
|
+
*/
|
2086
|
+
getLineNumbersHtml: function(code, lineNumbers)
|
2087
|
+
{
|
2088
|
+
var html = '',
|
2089
|
+
count = splitLines(code).length,
|
2090
|
+
firstLine = parseInt(this.getParam('first-line')),
|
2091
|
+
pad = this.getParam('pad-line-numbers')
|
2092
|
+
;
|
2093
|
+
|
2094
|
+
if (pad == true)
|
2095
|
+
pad = (firstLine + count - 1).toString().length;
|
2096
|
+
else if (isNaN(pad) == true)
|
2097
|
+
pad = 0;
|
2098
|
+
|
2099
|
+
for (var i = 0; i < count; i++)
|
2100
|
+
{
|
2101
|
+
var lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i,
|
2102
|
+
code = lineNumber == 0 ? sh.config.space : padNumber(lineNumber, pad)
|
2103
|
+
;
|
2104
|
+
|
2105
|
+
html += this.getLineHtml(i, lineNumber, code);
|
2106
|
+
}
|
2107
|
+
|
2108
|
+
return html;
|
2109
|
+
},
|
2110
|
+
|
2111
|
+
/**
|
2112
|
+
* Splits block of text into individual DIV lines.
|
2113
|
+
* @param {String} code Code to highlight.
|
2114
|
+
* @param {Array} lineNumbers Calculated line numbers.
|
2115
|
+
* @return {String} Returns highlighted code in HTML form.
|
2116
|
+
*/
|
2117
|
+
getCodeLinesHtml: function(html, lineNumbers)
|
2118
|
+
{
|
2119
|
+
html = trim(html);
|
2120
|
+
|
2121
|
+
var lines = splitLines(html),
|
2122
|
+
padLength = this.getParam('pad-line-numbers'),
|
2123
|
+
firstLine = parseInt(this.getParam('first-line')),
|
2124
|
+
html = '',
|
2125
|
+
brushName = this.getParam('brush')
|
2126
|
+
;
|
2127
|
+
|
2128
|
+
for (var i = 0; i < lines.length; i++)
|
2129
|
+
{
|
2130
|
+
var line = lines[i],
|
2131
|
+
indent = /^( |\s)+/.exec(line),
|
2132
|
+
spaces = null,
|
2133
|
+
lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i;
|
2134
|
+
;
|
2135
|
+
|
2136
|
+
if (indent != null)
|
2137
|
+
{
|
2138
|
+
spaces = indent[0].toString();
|
2139
|
+
line = line.substr(spaces.length);
|
2140
|
+
spaces = spaces.replace(' ', sh.config.space);
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
line = trim(line);
|
2144
|
+
|
2145
|
+
if (line.length == 0)
|
2146
|
+
line = sh.config.space;
|
2147
|
+
|
2148
|
+
html += this.getLineHtml(
|
2149
|
+
i,
|
2150
|
+
lineNumber,
|
2151
|
+
(spaces != null ? '<code class="' + brushName + ' spaces">' + spaces + '</code>' : '') + line
|
2152
|
+
);
|
2153
|
+
}
|
2154
|
+
|
2155
|
+
return html;
|
2156
|
+
},
|
2157
|
+
|
2158
|
+
/**
|
2159
|
+
* Returns HTML for the table title or empty string if title is null.
|
2160
|
+
*/
|
2161
|
+
getTitleHtml: function(title)
|
2162
|
+
{
|
2163
|
+
return title ? '<caption>' + title + '</caption>' : '';
|
2164
|
+
},
|
2165
|
+
|
2166
|
+
/**
|
2167
|
+
* Finds all matches in the source code.
|
2168
|
+
* @param {String} code Source code to process matches in.
|
2169
|
+
* @param {Array} matches Discovered regex matches.
|
2170
|
+
* @return {String} Returns formatted HTML with processed mathes.
|
2171
|
+
*/
|
2172
|
+
getMatchesHtml: function(code, matches)
|
2173
|
+
{
|
2174
|
+
var pos = 0,
|
2175
|
+
result = '',
|
2176
|
+
brushName = this.getParam('brush', '')
|
2177
|
+
;
|
2178
|
+
|
2179
|
+
function getBrushNameCss(match)
|
2180
|
+
{
|
2181
|
+
var result = match ? (match.brushName || brushName) : brushName;
|
2182
|
+
return result ? result + ' ' : '';
|
2183
|
+
};
|
2184
|
+
|
2185
|
+
// Finally, go through the final list of matches and pull the all
|
2186
|
+
// together adding everything in between that isn't a match.
|
2187
|
+
for (var i = 0; i < matches.length; i++)
|
2188
|
+
{
|
2189
|
+
var match = matches[i],
|
2190
|
+
matchBrushName
|
2191
|
+
;
|
2192
|
+
|
2193
|
+
if (match === null || match.length === 0)
|
2194
|
+
continue;
|
2195
|
+
|
2196
|
+
matchBrushName = getBrushNameCss(match);
|
2197
|
+
|
2198
|
+
result += wrapLinesWithCode(code.substr(pos, match.index - pos), matchBrushName + 'plain')
|
2199
|
+
+ wrapLinesWithCode(match.value, matchBrushName + match.css)
|
2200
|
+
;
|
2201
|
+
|
2202
|
+
pos = match.index + match.length + (match.offset || 0);
|
2203
|
+
}
|
2204
|
+
|
2205
|
+
// don't forget to add whatever's remaining in the string
|
2206
|
+
result += wrapLinesWithCode(code.substr(pos), getBrushNameCss() + 'plain');
|
2207
|
+
|
2208
|
+
return result;
|
2209
|
+
},
|
2210
|
+
|
2211
|
+
/**
|
2212
|
+
* Generates HTML markup for the whole syntax highlighter.
|
2213
|
+
* @param {String} code Source code.
|
2214
|
+
* @return {String} Returns HTML markup.
|
2215
|
+
*/
|
2216
|
+
getHtml: function(code)
|
2217
|
+
{
|
2218
|
+
var html = '',
|
2219
|
+
classes = [ 'syntaxhighlighter' ],
|
2220
|
+
tabSize,
|
2221
|
+
matches,
|
2222
|
+
lineNumbers
|
2223
|
+
;
|
2224
|
+
|
2225
|
+
// process light mode
|
2226
|
+
if (this.getParam('light') == true)
|
2227
|
+
this.params.toolbar = this.params.gutter = false;
|
2228
|
+
|
2229
|
+
className = 'syntaxhighlighter';
|
2230
|
+
|
2231
|
+
if (this.getParam('collapse') == true)
|
2232
|
+
classes.push('collapsed');
|
2233
|
+
|
2234
|
+
if ((gutter = this.getParam('gutter')) == false)
|
2235
|
+
classes.push('nogutter');
|
2236
|
+
|
2237
|
+
// add custom user style name
|
2238
|
+
classes.push(this.getParam('class-name'));
|
2239
|
+
|
2240
|
+
// add brush alias to the class name for custom CSS
|
2241
|
+
classes.push(this.getParam('brush'));
|
2242
|
+
|
2243
|
+
code = trimFirstAndLastLines(code)
|
2244
|
+
.replace(/\r/g, ' ') // IE lets these buggers through
|
2245
|
+
;
|
2246
|
+
|
2247
|
+
tabSize = this.getParam('tab-size');
|
2248
|
+
|
2249
|
+
// replace tabs with spaces
|
2250
|
+
code = this.getParam('smart-tabs') == true
|
2251
|
+
? processSmartTabs(code, tabSize)
|
2252
|
+
: processTabs(code, tabSize)
|
2253
|
+
;
|
2254
|
+
|
2255
|
+
// unindent code by the common indentation
|
2256
|
+
code = unindent(code);
|
2257
|
+
|
2258
|
+
if (gutter)
|
2259
|
+
lineNumbers = this.figureOutLineNumbers(code);
|
2260
|
+
|
2261
|
+
// find matches in the code using brushes regex list
|
2262
|
+
matches = this.findMatches(this.regexList, code);
|
2263
|
+
// processes found matches into the html
|
2264
|
+
html = this.getMatchesHtml(code, matches);
|
2265
|
+
// finally, split all lines so that they wrap well
|
2266
|
+
html = this.getCodeLinesHtml(html, lineNumbers);
|
2267
|
+
|
2268
|
+
// finally, process the links
|
2269
|
+
if (this.getParam('auto-links'))
|
2270
|
+
html = processUrls(html);
|
2271
|
+
|
2272
|
+
if (typeof(navigator) != 'undefined' && navigator.userAgent && navigator.userAgent.match(/MSIE/))
|
2273
|
+
classes.push('ie');
|
2274
|
+
|
2275
|
+
html =
|
2276
|
+
'<div id="' + getHighlighterId(this.id) + '" class="' + classes.join(' ') + '">'
|
2277
|
+
+ (this.getParam('toolbar') ? sh.toolbar.getHtml(this) : '')
|
2278
|
+
+ '<table border="0" cellpadding="0" cellspacing="0">'
|
2279
|
+
+ this.getTitleHtml(this.getParam('title'))
|
2280
|
+
+ '<tbody>'
|
2281
|
+
+ '<tr>'
|
2282
|
+
+ (gutter ? '<td class="gutter">' + this.getLineNumbersHtml(code) + '</td>' : '')
|
2283
|
+
+ '<td class="code">'
|
2284
|
+
+ '<div class="container">'
|
2285
|
+
+ html
|
2286
|
+
+ '</div>'
|
2287
|
+
+ '</td>'
|
2288
|
+
+ '</tr>'
|
2289
|
+
+ '</tbody>'
|
2290
|
+
+ '</table>'
|
2291
|
+
+ '</div>'
|
2292
|
+
;
|
2293
|
+
|
2294
|
+
return html;
|
2295
|
+
},
|
2296
|
+
|
2297
|
+
/**
|
2298
|
+
* Highlights the code and returns complete HTML.
|
2299
|
+
* @param {String} code Code to highlight.
|
2300
|
+
* @return {Element} Returns container DIV element with all markup.
|
2301
|
+
*/
|
2302
|
+
getDiv: function(code)
|
2303
|
+
{
|
2304
|
+
if (code === null)
|
2305
|
+
code = '';
|
2306
|
+
|
2307
|
+
this.code = code;
|
2308
|
+
|
2309
|
+
var div = this.create('div');
|
2310
|
+
|
2311
|
+
// create main HTML
|
2312
|
+
div.innerHTML = this.getHtml(code);
|
2313
|
+
|
2314
|
+
// set up click handlers
|
2315
|
+
if (this.getParam('toolbar'))
|
2316
|
+
attachEvent(findElement(div, '.toolbar'), 'click', sh.toolbar.handler);
|
2317
|
+
|
2318
|
+
if (this.getParam('quick-code'))
|
2319
|
+
attachEvent(findElement(div, '.code'), 'dblclick', quickCodeHandler);
|
2320
|
+
|
2321
|
+
return div;
|
2322
|
+
},
|
2323
|
+
|
2324
|
+
/**
|
2325
|
+
* Initializes the highlighter/brush.
|
2326
|
+
*
|
2327
|
+
* Constructor isn't used for initialization so that nothing executes during necessary
|
2328
|
+
* `new SyntaxHighlighter.Highlighter()` call when setting up brush inheritence.
|
2329
|
+
*
|
2330
|
+
* @param {Hash} params Highlighter parameters.
|
2331
|
+
*/
|
2332
|
+
init: function(params)
|
2333
|
+
{
|
2334
|
+
this.id = guid();
|
2335
|
+
|
2336
|
+
// register this instance in the highlighters list
|
2337
|
+
storeHighlighter(this);
|
2338
|
+
|
2339
|
+
// local params take precedence over defaults
|
2340
|
+
this.params = merge(sh.defaults, params || {})
|
2341
|
+
|
2342
|
+
// process light mode
|
2343
|
+
if (this.getParam('light') == true)
|
2344
|
+
this.params.toolbar = this.params.gutter = false;
|
2345
|
+
},
|
2346
|
+
|
2347
|
+
/**
|
2348
|
+
* Converts space separated list of keywords into a regular expression string.
|
2349
|
+
* @param {String} str Space separated keywords.
|
2350
|
+
* @return {String} Returns regular expression string.
|
2351
|
+
*/
|
2352
|
+
getKeywords: function(str)
|
2353
|
+
{
|
2354
|
+
str = str
|
2355
|
+
.replace(/^\s+|\s+$/g, '')
|
2356
|
+
.replace(/\s+/g, '|')
|
2357
|
+
;
|
2358
|
+
|
2359
|
+
return '\\b(?:' + str + ')\\b';
|
2360
|
+
},
|
2361
|
+
|
2362
|
+
/**
|
2363
|
+
* Makes a brush compatible with the `html-script` functionality.
|
2364
|
+
* @param {Object} regexGroup Object containing `left` and `right` regular expressions.
|
2365
|
+
*/
|
2366
|
+
forHtmlScript: function(regexGroup)
|
2367
|
+
{
|
2368
|
+
this.htmlScript = {
|
2369
|
+
left : { regex: regexGroup.left, css: 'script' },
|
2370
|
+
right : { regex: regexGroup.right, css: 'script' },
|
2371
|
+
code : new XRegExp(
|
2372
|
+
"(?<left>" + regexGroup.left.source + ")" +
|
2373
|
+
"(?<code>.*?)" +
|
2374
|
+
"(?<right>" + regexGroup.right.source + ")",
|
2375
|
+
"sgi"
|
2376
|
+
)
|
2377
|
+
};
|
2378
|
+
}
|
2379
|
+
}; // end of Highlighter
|
2380
|
+
|
2381
|
+
return sh;
|
2382
|
+
}(); // end of anonymous function
|
2383
|
+
|
2384
|
+
// CommonJS
|
2385
|
+
typeof(exports) != 'undefined' ? exports['SyntaxHighlighter'] = SyntaxHighlighter : null;
|
2386
|
+
|
2387
|
+
|
2388
|
+
;(function()
|
2389
|
+
{
|
2390
|
+
// CommonJS
|
2391
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2392
|
+
|
2393
|
+
function Brush()
|
2394
|
+
{
|
2395
|
+
// Created by Peter Atoria @ http://iAtoria.com
|
2396
|
+
|
2397
|
+
var inits = 'class interface function package';
|
2398
|
+
|
2399
|
+
var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' +
|
2400
|
+
'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' +
|
2401
|
+
'extends false final finally flash_proxy for get if implements import in include Infinity ' +
|
2402
|
+
'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' +
|
2403
|
+
'Null Number Object object_proxy override parseFloat parseInt private protected public ' +
|
2404
|
+
'return set static String super switch this throw true try typeof uint undefined unescape ' +
|
2405
|
+
'use void while with'
|
2406
|
+
;
|
2407
|
+
|
2408
|
+
this.regexList = [
|
2409
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
2410
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
2411
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
2412
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
2413
|
+
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
|
2414
|
+
{ regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations
|
2415
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
2416
|
+
{ regex: new RegExp('var', 'gm'), css: 'variable' }, // variable
|
2417
|
+
{ regex: new RegExp('trace', 'gm'), css: 'color1' } // trace
|
2418
|
+
];
|
2419
|
+
|
2420
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
|
2421
|
+
};
|
2422
|
+
|
2423
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2424
|
+
Brush.aliases = ['actionscript3', 'as3'];
|
2425
|
+
|
2426
|
+
SyntaxHighlighter.brushes.AS3 = Brush;
|
2427
|
+
|
2428
|
+
// CommonJS
|
2429
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2430
|
+
})();
|
2431
|
+
|
2432
|
+
;(function()
|
2433
|
+
{
|
2434
|
+
// CommonJS
|
2435
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2436
|
+
|
2437
|
+
function Brush()
|
2438
|
+
{
|
2439
|
+
var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne ge le';
|
2440
|
+
var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' +
|
2441
|
+
'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' +
|
2442
|
+
'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' +
|
2443
|
+
'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' +
|
2444
|
+
'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' +
|
2445
|
+
'import install join kill less let ln local locate logname logout look lpc lpr lprint ' +
|
2446
|
+
'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' +
|
2447
|
+
'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' +
|
2448
|
+
'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' +
|
2449
|
+
'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' +
|
2450
|
+
'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' +
|
2451
|
+
'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' +
|
2452
|
+
'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' +
|
2453
|
+
'vi watch wc whereis which who whoami Wget xargs yes'
|
2454
|
+
;
|
2455
|
+
|
2456
|
+
this.regexList = [
|
2457
|
+
{ regex: /^#!.*$/gm, css: 'preprocessor bold' },
|
2458
|
+
{ regex: /\/[\w-\/]+/gm, css: 'plain' },
|
2459
|
+
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
|
2460
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
2461
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
2462
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
2463
|
+
{ regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands
|
2464
|
+
];
|
2465
|
+
}
|
2466
|
+
|
2467
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2468
|
+
Brush.aliases = ['bash', 'shell'];
|
2469
|
+
|
2470
|
+
SyntaxHighlighter.brushes.Bash = Brush;
|
2471
|
+
|
2472
|
+
// CommonJS
|
2473
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2474
|
+
})();
|
2475
|
+
|
2476
|
+
;(function()
|
2477
|
+
{
|
2478
|
+
// CommonJS
|
2479
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2480
|
+
|
2481
|
+
function Brush()
|
2482
|
+
{
|
2483
|
+
// Contributed by Jen
|
2484
|
+
// http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter-plus
|
2485
|
+
|
2486
|
+
var funcs = 'Abs ACos AddSOAPRequestHeader AddSOAPResponseHeader AjaxLink AjaxOnLoad ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ' +
|
2487
|
+
'ArrayInsertAt ArrayIsDefined ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArraySet ArraySort ArraySum ArraySwap ArrayToList ' +
|
2488
|
+
'Asc ASin Atn BinaryDecode BinaryEncode BitAnd BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN BitSHRN BitXor ' +
|
2489
|
+
'Ceiling CharsetDecode CharsetEncode Chr CJustify Compare CompareNoCase Cos CreateDate CreateDateTime CreateObject ' +
|
2490
|
+
'CreateODBCDate CreateODBCDateTime CreateODBCTime CreateTime CreateTimeSpan CreateUUID DateAdd DateCompare DateConvert ' +
|
2491
|
+
'DateDiff DateFormat DatePart Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear DE DecimalFormat DecrementValue ' +
|
2492
|
+
'Decrypt DecryptBinary DeleteClientVariable DeserializeJSON DirectoryExists DollarFormat DotNetToCFType Duplicate Encrypt ' +
|
2493
|
+
'EncryptBinary Evaluate Exp ExpandPath FileClose FileCopy FileDelete FileExists FileIsEOF FileMove FileOpen FileRead ' +
|
2494
|
+
'FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute FileSetLastModified FileWrite Find FindNoCase FindOneOf ' +
|
2495
|
+
'FirstDayOfMonth Fix FormatBaseN GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList GetBaseTemplatePath ' +
|
2496
|
+
'GetClientVariablesList GetComponentMetaData GetContextRoot GetCurrentTemplatePath GetDirectoryFromPath GetEncoding ' +
|
2497
|
+
'GetException GetFileFromPath GetFileInfo GetFunctionList GetGatewayHelper GetHttpRequestData GetHttpTimeString ' +
|
2498
|
+
'GetK2ServerDocCount GetK2ServerDocCountLimit GetLocale GetLocaleDisplayName GetLocalHostIP GetMetaData GetMetricData ' +
|
2499
|
+
'GetPageContext GetPrinterInfo GetProfileSections GetProfileString GetReadableImageFormats GetSOAPRequest GetSOAPRequestHeader ' +
|
2500
|
+
'GetSOAPResponse GetSOAPResponseHeader GetTempDirectory GetTempFile GetTemplatePath GetTickCount GetTimeZoneInfo GetToken ' +
|
2501
|
+
'GetUserRoles GetWriteableImageFormats Hash Hour HTMLCodeFormat HTMLEditFormat IIf ImageAddBorder ImageBlur ImageClearRect ' +
|
2502
|
+
'ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect ImageDrawCubicCurve ImageDrawLine ImageDrawLines ImageDrawOval ' +
|
2503
|
+
'ImageDrawPoint ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob ImageGetBufferedImage ' +
|
2504
|
+
'ImageGetEXIFTag ImageGetHeight ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay ImagePaste ' +
|
2505
|
+
'ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit ImageSetAntialiasing ImageSetBackgroundColor ' +
|
2506
|
+
'ImageSetDrawingColor ImageSetDrawingStroke ImageSetDrawingTransparency ImageSharpen ImageShear ImageShearDrawingAxis ImageTranslate ' +
|
2507
|
+
'ImageTranslateDrawingAxis ImageWrite ImageWriteBase64 ImageXORDrawingMode IncrementValue InputBaseN Insert Int IsArray IsBinary ' +
|
2508
|
+
'IsBoolean IsCustomFunction IsDate IsDDX IsDebugMode IsDefined IsImage IsImageFile IsInstanceOf IsJSON IsLeapYear IsLocalHost ' +
|
2509
|
+
'IsNumeric IsNumericDate IsObject IsPDFFile IsPDFObject IsQuery IsSimpleValue IsSOAPRequest IsStruct IsUserInAnyRole IsUserInRole ' +
|
2510
|
+
'IsUserLoggedIn IsValid IsWDDX IsXML IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot JavaCast JSStringFormat LCase Left Len ' +
|
2511
|
+
'ListAppend ListChangeDelims ListContains ListContainsNoCase ListDeleteAt ListFind ListFindNoCase ListFirst ListGetAt ListInsertAt ' +
|
2512
|
+
'ListLast ListLen ListPrepend ListQualify ListRest ListSetAt ListSort ListToArray ListValueCount ListValueCountNoCase LJustify Log ' +
|
2513
|
+
'Log10 LSCurrencyFormat LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime ' +
|
2514
|
+
'LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Max Mid Min Minute Month MonthAsString Now NumberFormat ParagraphFormat ParseDateTime ' +
|
2515
|
+
'Pi PrecisionEvaluate PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow QueryConvertForGrid QueryNew QuerySetCell QuotedValueList Rand ' +
|
2516
|
+
'Randomize RandRange REFind REFindNoCase ReleaseComObject REMatch REMatchNoCase RemoveChars RepeatString Replace ReplaceList ReplaceNoCase ' +
|
2517
|
+
'REReplace REReplaceNoCase Reverse Right RJustify Round RTrim Second SendGatewayMessage SerializeJSON SetEncoding SetLocale SetProfileString ' +
|
2518
|
+
'SetVariable Sgn Sin Sleep SpanExcluding SpanIncluding Sqr StripCR StructAppend StructClear StructCopy StructCount StructDelete StructFind ' +
|
2519
|
+
'StructFindKey StructFindValue StructGet StructInsert StructIsEmpty StructKeyArray StructKeyExists StructKeyList StructKeyList StructNew ' +
|
2520
|
+
'StructSort StructUpdate Tan TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase URLDecode URLEncodedFormat URLSessionFormat Val ' +
|
2521
|
+
'ValueList VerifyClient Week Wrap Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform ' +
|
2522
|
+
'XmlValidate Year YesNoFormat';
|
2523
|
+
|
2524
|
+
var keywords = 'cfabort cfajaximport cfajaxproxy cfapplet cfapplication cfargument cfassociate cfbreak cfcache cfcalendar ' +
|
2525
|
+
'cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection cfcomponent cfcontent cfcookie cfdbinfo ' +
|
2526
|
+
'cfdefaultcase cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror ' +
|
2527
|
+
'cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask ' +
|
2528
|
+
'cfexecute cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid cfgridcolumn ' +
|
2529
|
+
'cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage cfimport cfinclude cfindex ' +
|
2530
|
+
'cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflocation cflock cflog ' +
|
2531
|
+
'cflogin cfloginuser cflogout cfloop cfmail cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate ' +
|
2532
|
+
'cfobject cfobjectcache cfoutput cfparam cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop ' +
|
2533
|
+
'cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult ' +
|
2534
|
+
'cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow cfreturn cfsavecontent cfschedule ' +
|
2535
|
+
'cfscript cfsearch cfselect cfset cfsetting cfsilent cfslider cfsprydataset cfstoredproc cfswitch cftable ' +
|
2536
|
+
'cftextarea cfthread cfthrow cftimer cftooltip cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx ' +
|
2537
|
+
'cfwindow cfxml cfzip cfzipparam';
|
2538
|
+
|
2539
|
+
var operators = 'all and any between cross in join like not null or outer some';
|
2540
|
+
|
2541
|
+
this.regexList = [
|
2542
|
+
{ regex: new RegExp('--(.*)$', 'gm'), css: 'comments' }, // one line and multiline comments
|
2543
|
+
{ regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // single quoted strings
|
2544
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
2545
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
2546
|
+
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // functions
|
2547
|
+
{ regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
|
2548
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
|
2549
|
+
];
|
2550
|
+
}
|
2551
|
+
|
2552
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2553
|
+
Brush.aliases = ['coldfusion','cf'];
|
2554
|
+
|
2555
|
+
SyntaxHighlighter.brushes.ColdFusion = Brush;
|
2556
|
+
|
2557
|
+
// CommonJS
|
2558
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2559
|
+
})();
|
2560
|
+
|
2561
|
+
;(function()
|
2562
|
+
{
|
2563
|
+
// CommonJS
|
2564
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2565
|
+
|
2566
|
+
function Brush()
|
2567
|
+
{
|
2568
|
+
// Copyright 2006 Shin, YoungJin
|
2569
|
+
|
2570
|
+
var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' +
|
2571
|
+
'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' +
|
2572
|
+
'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' +
|
2573
|
+
'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' +
|
2574
|
+
'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' +
|
2575
|
+
'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' +
|
2576
|
+
'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' +
|
2577
|
+
'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' +
|
2578
|
+
'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' +
|
2579
|
+
'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' +
|
2580
|
+
'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' +
|
2581
|
+
'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' +
|
2582
|
+
'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' +
|
2583
|
+
'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' +
|
2584
|
+
'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' +
|
2585
|
+
'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' +
|
2586
|
+
'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' +
|
2587
|
+
'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' +
|
2588
|
+
'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' +
|
2589
|
+
'__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' +
|
2590
|
+
'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' +
|
2591
|
+
'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' +
|
2592
|
+
'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' +
|
2593
|
+
'va_list wchar_t wctrans_t wctype_t wint_t signed';
|
2594
|
+
|
2595
|
+
var keywords = 'break case catch class const __finally __exception __try ' +
|
2596
|
+
'const_cast continue private public protected __declspec ' +
|
2597
|
+
'default delete deprecated dllexport dllimport do dynamic_cast ' +
|
2598
|
+
'else enum explicit extern if for friend goto inline ' +
|
2599
|
+
'mutable naked namespace new noinline noreturn nothrow ' +
|
2600
|
+
'register reinterpret_cast return selectany ' +
|
2601
|
+
'sizeof static static_cast struct switch template this ' +
|
2602
|
+
'thread throw true false try typedef typeid typename union ' +
|
2603
|
+
'using uuid virtual void volatile whcar_t while';
|
2604
|
+
|
2605
|
+
var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' +
|
2606
|
+
'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' +
|
2607
|
+
'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' +
|
2608
|
+
'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' +
|
2609
|
+
'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' +
|
2610
|
+
'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' +
|
2611
|
+
'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' +
|
2612
|
+
'fwrite getc getchar gets perror printf putc putchar puts remove ' +
|
2613
|
+
'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' +
|
2614
|
+
'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' +
|
2615
|
+
'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' +
|
2616
|
+
'mbtowc qsort rand realloc srand strtod strtol strtoul system ' +
|
2617
|
+
'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' +
|
2618
|
+
'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' +
|
2619
|
+
'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' +
|
2620
|
+
'clock ctime difftime gmtime localtime mktime strftime time';
|
2621
|
+
|
2622
|
+
this.regexList = [
|
2623
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
2624
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
2625
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
2626
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
2627
|
+
{ regex: /^ *#.*/gm, css: 'preprocessor' },
|
2628
|
+
{ regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' },
|
2629
|
+
{ regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' },
|
2630
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' }
|
2631
|
+
];
|
2632
|
+
};
|
2633
|
+
|
2634
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2635
|
+
Brush.aliases = ['cpp', 'c'];
|
2636
|
+
|
2637
|
+
SyntaxHighlighter.brushes.Cpp = Brush;
|
2638
|
+
|
2639
|
+
// CommonJS
|
2640
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2641
|
+
})();
|
2642
|
+
|
2643
|
+
;(function()
|
2644
|
+
{
|
2645
|
+
// CommonJS
|
2646
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2647
|
+
|
2648
|
+
function Brush()
|
2649
|
+
{
|
2650
|
+
var keywords = 'abstract as base bool break byte case catch char checked class const ' +
|
2651
|
+
'continue decimal default delegate do double else enum event explicit ' +
|
2652
|
+
'extern false finally fixed float for foreach get goto if implicit in int ' +
|
2653
|
+
'interface internal is lock long namespace new null object operator out ' +
|
2654
|
+
'override params private protected public readonly ref return sbyte sealed set ' +
|
2655
|
+
'short sizeof stackalloc static string struct switch this throw true try ' +
|
2656
|
+
'typeof uint ulong unchecked unsafe ushort using virtual void while';
|
2657
|
+
|
2658
|
+
function fixComments(match, regexInfo)
|
2659
|
+
{
|
2660
|
+
var css = (match[0].indexOf("///") == 0)
|
2661
|
+
? 'color1'
|
2662
|
+
: 'comments'
|
2663
|
+
;
|
2664
|
+
|
2665
|
+
return [new SyntaxHighlighter.Match(match[0], match.index, css)];
|
2666
|
+
}
|
2667
|
+
|
2668
|
+
this.regexList = [
|
2669
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments
|
2670
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
2671
|
+
{ regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings
|
2672
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
2673
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
2674
|
+
{ regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
2675
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword
|
2676
|
+
{ regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial'
|
2677
|
+
{ regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield'
|
2678
|
+
];
|
2679
|
+
|
2680
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
2681
|
+
};
|
2682
|
+
|
2683
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2684
|
+
Brush.aliases = ['c#', 'c-sharp', 'csharp'];
|
2685
|
+
|
2686
|
+
SyntaxHighlighter.brushes.CSharp = Brush;
|
2687
|
+
|
2688
|
+
// CommonJS
|
2689
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2690
|
+
})();
|
2691
|
+
|
2692
|
+
;(function()
|
2693
|
+
{
|
2694
|
+
// CommonJS
|
2695
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2696
|
+
|
2697
|
+
function Brush()
|
2698
|
+
{
|
2699
|
+
function getKeywordsCSS(str)
|
2700
|
+
{
|
2701
|
+
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
|
2702
|
+
};
|
2703
|
+
|
2704
|
+
function getValuesCSS(str)
|
2705
|
+
{
|
2706
|
+
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
|
2707
|
+
};
|
2708
|
+
|
2709
|
+
var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
|
2710
|
+
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
|
2711
|
+
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
|
2712
|
+
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
|
2713
|
+
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
|
2714
|
+
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
|
2715
|
+
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
|
2716
|
+
'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
|
2717
|
+
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
|
2718
|
+
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
|
2719
|
+
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
|
2720
|
+
'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
|
2721
|
+
'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
|
2722
|
+
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';
|
2723
|
+
|
2724
|
+
var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
|
2725
|
+
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
|
2726
|
+
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+
|
2727
|
+
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
|
2728
|
+
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
|
2729
|
+
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
|
2730
|
+
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
|
2731
|
+
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
|
2732
|
+
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
|
2733
|
+
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
|
2734
|
+
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
|
2735
|
+
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
|
2736
|
+
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
|
2737
|
+
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
|
2738
|
+
|
2739
|
+
var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
|
2740
|
+
|
2741
|
+
this.regexList = [
|
2742
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
2743
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
2744
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
2745
|
+
{ regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors
|
2746
|
+
{ regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes
|
2747
|
+
{ regex: /!important/g, css: 'color3' }, // !important
|
2748
|
+
{ regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords
|
2749
|
+
{ regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values
|
2750
|
+
{ regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts
|
2751
|
+
];
|
2752
|
+
|
2753
|
+
this.forHtmlScript({
|
2754
|
+
left: /(<|<)\s*style.*?(>|>)/gi,
|
2755
|
+
right: /(<|<)\/\s*style\s*(>|>)/gi
|
2756
|
+
});
|
2757
|
+
};
|
2758
|
+
|
2759
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2760
|
+
Brush.aliases = ['css'];
|
2761
|
+
|
2762
|
+
SyntaxHighlighter.brushes.CSS = Brush;
|
2763
|
+
|
2764
|
+
// CommonJS
|
2765
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2766
|
+
})();
|
2767
|
+
|
2768
|
+
;(function()
|
2769
|
+
{
|
2770
|
+
// CommonJS
|
2771
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2772
|
+
|
2773
|
+
function Brush()
|
2774
|
+
{
|
2775
|
+
var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' +
|
2776
|
+
'case char class comp const constructor currency destructor div do double ' +
|
2777
|
+
'downto else end except exports extended false file finalization finally ' +
|
2778
|
+
'for function goto if implementation in inherited int64 initialization ' +
|
2779
|
+
'integer interface is label library longint longword mod nil not object ' +
|
2780
|
+
'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' +
|
2781
|
+
'pint64 pointer private procedure program property pshortstring pstring ' +
|
2782
|
+
'pvariant pwidechar pwidestring protected public published raise real real48 ' +
|
2783
|
+
'record repeat set shl shortint shortstring shr single smallint string then ' +
|
2784
|
+
'threadvar to true try type unit until uses val var varirnt while widechar ' +
|
2785
|
+
'widestring with word write writeln xor';
|
2786
|
+
|
2787
|
+
this.regexList = [
|
2788
|
+
{ regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *)
|
2789
|
+
{ regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { }
|
2790
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line
|
2791
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
2792
|
+
{ regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags
|
2793
|
+
{ regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345
|
2794
|
+
{ regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3
|
2795
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
|
2796
|
+
];
|
2797
|
+
};
|
2798
|
+
|
2799
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2800
|
+
Brush.aliases = ['delphi', 'pascal', 'pas'];
|
2801
|
+
|
2802
|
+
SyntaxHighlighter.brushes.Delphi = Brush;
|
2803
|
+
|
2804
|
+
// CommonJS
|
2805
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2806
|
+
})();
|
2807
|
+
|
2808
|
+
;(function()
|
2809
|
+
{
|
2810
|
+
// CommonJS
|
2811
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2812
|
+
|
2813
|
+
function Brush()
|
2814
|
+
{
|
2815
|
+
this.regexList = [
|
2816
|
+
{ regex: /^\+\+\+.*$/gm, css: 'color2' },
|
2817
|
+
{ regex: /^\-\-\-.*$/gm, css: 'color2' },
|
2818
|
+
{ regex: /^\s.*$/gm, css: 'color1' },
|
2819
|
+
{ regex: /^@@.*@@$/gm, css: 'variable' },
|
2820
|
+
{ regex: /^\+[^\+]{1}.*$/gm, css: 'string' },
|
2821
|
+
{ regex: /^\-[^\-]{1}.*$/gm, css: 'comments' }
|
2822
|
+
];
|
2823
|
+
};
|
2824
|
+
|
2825
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2826
|
+
Brush.aliases = ['diff', 'patch'];
|
2827
|
+
|
2828
|
+
SyntaxHighlighter.brushes.Diff = Brush;
|
2829
|
+
|
2830
|
+
// CommonJS
|
2831
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2832
|
+
})();
|
2833
|
+
|
2834
|
+
;(function()
|
2835
|
+
{
|
2836
|
+
// CommonJS
|
2837
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2838
|
+
|
2839
|
+
function Brush()
|
2840
|
+
{
|
2841
|
+
// Contributed by Jean-Lou Dupont
|
2842
|
+
// http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html
|
2843
|
+
|
2844
|
+
// According to: http://erlang.org/doc/reference_manual/introduction.html#1.5
|
2845
|
+
var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+
|
2846
|
+
'case catch cond div end fun if let not of or orelse '+
|
2847
|
+
'query receive rem try when xor'+
|
2848
|
+
// additional
|
2849
|
+
' module export import define';
|
2850
|
+
|
2851
|
+
this.regexList = [
|
2852
|
+
{ regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' },
|
2853
|
+
{ regex: new RegExp("\\%.+", 'gm'), css: 'comments' },
|
2854
|
+
{ regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' },
|
2855
|
+
{ regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' },
|
2856
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
|
2857
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
|
2858
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
|
2859
|
+
];
|
2860
|
+
};
|
2861
|
+
|
2862
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2863
|
+
Brush.aliases = ['erl', 'erlang'];
|
2864
|
+
|
2865
|
+
SyntaxHighlighter.brushes.Erland = Brush;
|
2866
|
+
|
2867
|
+
// CommonJS
|
2868
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2869
|
+
})();
|
2870
|
+
|
2871
|
+
;(function()
|
2872
|
+
{
|
2873
|
+
// CommonJS
|
2874
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2875
|
+
|
2876
|
+
function Brush()
|
2877
|
+
{
|
2878
|
+
// Contributed by Andres Almiray
|
2879
|
+
// http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter
|
2880
|
+
|
2881
|
+
var keywords = 'as assert break case catch class continue def default do else extends finally ' +
|
2882
|
+
'if in implements import instanceof interface new package property return switch ' +
|
2883
|
+
'throw throws try while public protected private static';
|
2884
|
+
var types = 'void boolean byte char short int long float double';
|
2885
|
+
var constants = 'null';
|
2886
|
+
var methods = 'allProperties count get size '+
|
2887
|
+
'collect each eachProperty eachPropertyName eachWithIndex find findAll ' +
|
2888
|
+
'findIndexOf grep inject max min reverseEach sort ' +
|
2889
|
+
'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' +
|
2890
|
+
'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' +
|
2891
|
+
'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' +
|
2892
|
+
'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' +
|
2893
|
+
'transformChar transformLine withOutputStream withPrintWriter withStream ' +
|
2894
|
+
'withStreams withWriter withWriterAppend write writeLine '+
|
2895
|
+
'dump inspect invokeMethod print println step times upto use waitForOrKill '+
|
2896
|
+
'getText';
|
2897
|
+
|
2898
|
+
this.regexList = [
|
2899
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
2900
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
2901
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
2902
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
2903
|
+
{ regex: /""".*"""/g, css: 'string' }, // GStrings
|
2904
|
+
{ regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers
|
2905
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword
|
2906
|
+
{ regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type
|
2907
|
+
{ regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants
|
2908
|
+
{ regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods
|
2909
|
+
];
|
2910
|
+
|
2911
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
2912
|
+
}
|
2913
|
+
|
2914
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2915
|
+
Brush.aliases = ['groovy'];
|
2916
|
+
|
2917
|
+
SyntaxHighlighter.brushes.Groovy = Brush;
|
2918
|
+
|
2919
|
+
// CommonJS
|
2920
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2921
|
+
})();
|
2922
|
+
|
2923
|
+
;(function()
|
2924
|
+
{
|
2925
|
+
// CommonJS
|
2926
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2927
|
+
|
2928
|
+
function Brush()
|
2929
|
+
{
|
2930
|
+
var keywords = 'abstract assert boolean break byte case catch char class const ' +
|
2931
|
+
'continue default do double else enum extends ' +
|
2932
|
+
'false final finally float for goto if implements import ' +
|
2933
|
+
'instanceof int interface long native new null ' +
|
2934
|
+
'package private protected public return ' +
|
2935
|
+
'short static strictfp super switch synchronized this throw throws true ' +
|
2936
|
+
'transient try void volatile while';
|
2937
|
+
|
2938
|
+
this.regexList = [
|
2939
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
2940
|
+
{ regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments
|
2941
|
+
{ regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments
|
2942
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
2943
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
2944
|
+
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
|
2945
|
+
{ regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno
|
2946
|
+
{ regex: /\@interface\b/g, css: 'color2' }, // @interface keyword
|
2947
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword
|
2948
|
+
];
|
2949
|
+
|
2950
|
+
this.forHtmlScript({
|
2951
|
+
left : /(<|<)%[@!=]?/g,
|
2952
|
+
right : /%(>|>)/g
|
2953
|
+
});
|
2954
|
+
};
|
2955
|
+
|
2956
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
2957
|
+
Brush.aliases = ['java'];
|
2958
|
+
|
2959
|
+
SyntaxHighlighter.brushes.Java = Brush;
|
2960
|
+
|
2961
|
+
// CommonJS
|
2962
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
2963
|
+
})();
|
2964
|
+
|
2965
|
+
;(function()
|
2966
|
+
{
|
2967
|
+
// CommonJS
|
2968
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
2969
|
+
|
2970
|
+
function Brush()
|
2971
|
+
{
|
2972
|
+
// Contributed by Patrick Webster
|
2973
|
+
// http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html
|
2974
|
+
var datatypes = 'Boolean Byte Character Double Duration '
|
2975
|
+
+ 'Float Integer Long Number Short String Void'
|
2976
|
+
;
|
2977
|
+
|
2978
|
+
var keywords = 'abstract after and as assert at before bind bound break catch class '
|
2979
|
+
+ 'continue def delete else exclusive extends false finally first for from '
|
2980
|
+
+ 'function if import in indexof init insert instanceof into inverse last '
|
2981
|
+
+ 'lazy mixin mod nativearray new not null on or override package postinit '
|
2982
|
+
+ 'protected public public-init public-read replace return reverse sizeof '
|
2983
|
+
+ 'step super then this throw true try tween typeof var where while with '
|
2984
|
+
+ 'attribute let private readonly static trigger'
|
2985
|
+
;
|
2986
|
+
|
2987
|
+
this.regexList = [
|
2988
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' },
|
2989
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' },
|
2990
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
|
2991
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
|
2992
|
+
{ regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers
|
2993
|
+
{ regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes
|
2994
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
|
2995
|
+
];
|
2996
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
2997
|
+
};
|
2998
|
+
|
2999
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3000
|
+
Brush.aliases = ['jfx', 'javafx'];
|
3001
|
+
|
3002
|
+
SyntaxHighlighter.brushes.JavaFX = Brush;
|
3003
|
+
|
3004
|
+
// CommonJS
|
3005
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3006
|
+
})();
|
3007
|
+
|
3008
|
+
;(function()
|
3009
|
+
{
|
3010
|
+
// CommonJS
|
3011
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3012
|
+
|
3013
|
+
function Brush()
|
3014
|
+
{
|
3015
|
+
var keywords = 'break case catch continue ' +
|
3016
|
+
'default delete do else false ' +
|
3017
|
+
'for function if in instanceof ' +
|
3018
|
+
'new null return super switch ' +
|
3019
|
+
'this throw true try typeof var while with'
|
3020
|
+
;
|
3021
|
+
|
3022
|
+
var r = SyntaxHighlighter.regexLib;
|
3023
|
+
|
3024
|
+
this.regexList = [
|
3025
|
+
{ regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
|
3026
|
+
{ regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
|
3027
|
+
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
|
3028
|
+
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
|
3029
|
+
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
3030
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
|
3031
|
+
];
|
3032
|
+
|
3033
|
+
this.forHtmlScript(r.scriptScriptTags);
|
3034
|
+
};
|
3035
|
+
|
3036
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3037
|
+
Brush.aliases = ['js', 'jscript', 'javascript'];
|
3038
|
+
|
3039
|
+
SyntaxHighlighter.brushes.JScript = Brush;
|
3040
|
+
|
3041
|
+
// CommonJS
|
3042
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3043
|
+
})();
|
3044
|
+
|
3045
|
+
;(function()
|
3046
|
+
{
|
3047
|
+
// CommonJS
|
3048
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3049
|
+
|
3050
|
+
function Brush()
|
3051
|
+
{
|
3052
|
+
// Contributed by David Simmons-Duffin and Marty Kube
|
3053
|
+
|
3054
|
+
var funcs =
|
3055
|
+
'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' +
|
3056
|
+
'chroot close closedir connect cos crypt defined delete each endgrent ' +
|
3057
|
+
'endhostent endnetent endprotoent endpwent endservent eof exec exists ' +
|
3058
|
+
'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' +
|
3059
|
+
'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' +
|
3060
|
+
'getnetbyname getnetent getpeername getpgrp getppid getpriority ' +
|
3061
|
+
'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' +
|
3062
|
+
'getservbyname getservbyport getservent getsockname getsockopt glob ' +
|
3063
|
+
'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' +
|
3064
|
+
'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' +
|
3065
|
+
'oct open opendir ord pack pipe pop pos print printf prototype push ' +
|
3066
|
+
'quotemeta rand read readdir readline readlink readpipe recv rename ' +
|
3067
|
+
'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' +
|
3068
|
+
'semget semop send setgrent sethostent setnetent setpgrp setpriority ' +
|
3069
|
+
'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' +
|
3070
|
+
'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' +
|
3071
|
+
'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' +
|
3072
|
+
'system syswrite tell telldir time times tr truncate uc ucfirst umask ' +
|
3073
|
+
'undef unlink unpack unshift utime values vec wait waitpid warn write';
|
3074
|
+
|
3075
|
+
var keywords =
|
3076
|
+
'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' +
|
3077
|
+
'for foreach goto if import last local my next no our package redo ref ' +
|
3078
|
+
'require return sub tie tied unless untie until use wantarray while';
|
3079
|
+
|
3080
|
+
this.regexList = [
|
3081
|
+
{ regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' },
|
3082
|
+
{ regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang
|
3083
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
|
3084
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
|
3085
|
+
{ regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' },
|
3086
|
+
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
|
3087
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
|
3088
|
+
];
|
3089
|
+
|
3090
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
|
3091
|
+
}
|
3092
|
+
|
3093
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3094
|
+
Brush.aliases = ['perl', 'Perl', 'pl'];
|
3095
|
+
|
3096
|
+
SyntaxHighlighter.brushes.Perl = Brush;
|
3097
|
+
|
3098
|
+
// CommonJS
|
3099
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3100
|
+
})();
|
3101
|
+
|
3102
|
+
;(function()
|
3103
|
+
{
|
3104
|
+
// CommonJS
|
3105
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3106
|
+
|
3107
|
+
function Brush()
|
3108
|
+
{
|
3109
|
+
var funcs = 'abs acos acosh addcslashes addslashes ' +
|
3110
|
+
'array_change_key_case array_chunk array_combine array_count_values array_diff '+
|
3111
|
+
'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
|
3112
|
+
'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
|
3113
|
+
'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
|
3114
|
+
'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
|
3115
|
+
'array_push array_rand array_reduce array_reverse array_search array_shift '+
|
3116
|
+
'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
|
3117
|
+
'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
|
3118
|
+
'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
|
3119
|
+
'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
|
3120
|
+
'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
|
3121
|
+
'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
|
3122
|
+
'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
|
3123
|
+
'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
|
3124
|
+
'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
|
3125
|
+
'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
|
3126
|
+
'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
|
3127
|
+
'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
|
3128
|
+
'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
|
3129
|
+
'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
|
3130
|
+
'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
|
3131
|
+
'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
|
3132
|
+
'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
|
3133
|
+
'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
|
3134
|
+
'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
|
3135
|
+
'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
|
3136
|
+
'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
|
3137
|
+
'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+
|
3138
|
+
'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
|
3139
|
+
'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
|
3140
|
+
'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
|
3141
|
+
'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
|
3142
|
+
'strtoupper strtr strval substr substr_compare';
|
3143
|
+
|
3144
|
+
var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' +
|
3145
|
+
'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' +
|
3146
|
+
'function include include_once global goto if implements interface instanceof namespace new ' +
|
3147
|
+
'old_function or private protected public return require require_once static switch ' +
|
3148
|
+
'throw try use var while xor ';
|
3149
|
+
|
3150
|
+
var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
|
3151
|
+
|
3152
|
+
this.regexList = [
|
3153
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
3154
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
3155
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
3156
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
3157
|
+
{ regex: /\$\w+/g, css: 'variable' }, // variables
|
3158
|
+
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
|
3159
|
+
{ regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
|
3160
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
|
3161
|
+
];
|
3162
|
+
|
3163
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
|
3164
|
+
};
|
3165
|
+
|
3166
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3167
|
+
Brush.aliases = ['php'];
|
3168
|
+
|
3169
|
+
SyntaxHighlighter.brushes.Php = Brush;
|
3170
|
+
|
3171
|
+
// CommonJS
|
3172
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3173
|
+
})();
|
3174
|
+
|
3175
|
+
;(function()
|
3176
|
+
{
|
3177
|
+
// CommonJS
|
3178
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3179
|
+
|
3180
|
+
function Brush()
|
3181
|
+
{
|
3182
|
+
};
|
3183
|
+
|
3184
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3185
|
+
Brush.aliases = ['text', 'plain'];
|
3186
|
+
|
3187
|
+
SyntaxHighlighter.brushes.Plain = Brush;
|
3188
|
+
|
3189
|
+
// CommonJS
|
3190
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3191
|
+
})();
|
3192
|
+
|
3193
|
+
;(function()
|
3194
|
+
{
|
3195
|
+
// CommonJS
|
3196
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3197
|
+
|
3198
|
+
function Brush()
|
3199
|
+
{
|
3200
|
+
// Contributes by B.v.Zanten, Getronics
|
3201
|
+
// http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro
|
3202
|
+
|
3203
|
+
var keywords = 'Add-Content Add-History Add-Member Add-PSSnapin Clear(-Content)? Clear-Item ' +
|
3204
|
+
'Clear-ItemProperty Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ' +
|
3205
|
+
'ConvertTo-Html ConvertTo-SecureString Copy(-Item)? Copy-ItemProperty Export-Alias ' +
|
3206
|
+
'Export-Clixml Export-Console Export-Csv ForEach(-Object)? Format-Custom Format-List ' +
|
3207
|
+
'Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command ' +
|
3208
|
+
'Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy ' +
|
3209
|
+
'Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member ' +
|
3210
|
+
'Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service ' +
|
3211
|
+
'Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object ' +
|
3212
|
+
'Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item ' +
|
3213
|
+
'Join-Path Measure-Command Measure-Object Move(-Item)? Move-ItemProperty New-Alias ' +
|
3214
|
+
'New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan ' +
|
3215
|
+
'New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location ' +
|
3216
|
+
'Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin ' +
|
3217
|
+
'Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service ' +
|
3218
|
+
'Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content ' +
|
3219
|
+
'Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug ' +
|
3220
|
+
'Set-Service Set-TraceSource Set(-Variable)? Sort-Object Split-Path Start-Service ' +
|
3221
|
+
'Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service ' +
|
3222
|
+
'Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where(-Object)? ' +
|
3223
|
+
'Write-Debug Write-Error Write(-Host)? Write-Output Write-Progress Write-Verbose Write-Warning';
|
3224
|
+
var alias = 'ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl ' +
|
3225
|
+
'ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv ' +
|
3226
|
+
'gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ' +
|
3227
|
+
'ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp ' +
|
3228
|
+
'spps spsv sv tee cat cd cp h history kill lp ls ' +
|
3229
|
+
'mount mv popd ps pushd pwd r rm rmdir echo cls chdir del dir ' +
|
3230
|
+
'erase rd ren type % \\?';
|
3231
|
+
|
3232
|
+
this.regexList = [
|
3233
|
+
{ regex: /#.*$/gm, css: 'comments' }, // one line comments
|
3234
|
+
{ regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // variables $Computer1
|
3235
|
+
{ regex: /\-[a-zA-Z]+\b/g, css: 'keyword' }, // Operators -not -and -eq
|
3236
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
3237
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
3238
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' },
|
3239
|
+
{ regex: new RegExp(this.getKeywords(alias), 'gmi'), css: 'keyword' }
|
3240
|
+
];
|
3241
|
+
};
|
3242
|
+
|
3243
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3244
|
+
Brush.aliases = ['powershell', 'ps'];
|
3245
|
+
|
3246
|
+
SyntaxHighlighter.brushes.PowerShell = Brush;
|
3247
|
+
|
3248
|
+
// CommonJS
|
3249
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3250
|
+
})();
|
3251
|
+
|
3252
|
+
;(function()
|
3253
|
+
{
|
3254
|
+
// CommonJS
|
3255
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3256
|
+
|
3257
|
+
function Brush()
|
3258
|
+
{
|
3259
|
+
// Contributed by Gheorghe Milas and Ahmad Sherif
|
3260
|
+
|
3261
|
+
var keywords = 'and assert break class continue def del elif else ' +
|
3262
|
+
'except exec finally for from global if import in is ' +
|
3263
|
+
'lambda not or pass print raise return try yield while';
|
3264
|
+
|
3265
|
+
var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' +
|
3266
|
+
'chr classmethod cmp coerce compile complex delattr dict dir ' +
|
3267
|
+
'divmod enumerate eval execfile file filter float format frozenset ' +
|
3268
|
+
'getattr globals hasattr hash help hex id input int intern ' +
|
3269
|
+
'isinstance issubclass iter len list locals long map max min next ' +
|
3270
|
+
'object oct open ord pow print property range raw_input reduce ' +
|
3271
|
+
'reload repr reversed round set setattr slice sorted staticmethod ' +
|
3272
|
+
'str sum super tuple type type unichr unicode vars xrange zip';
|
3273
|
+
|
3274
|
+
var special = 'None True False self cls class_';
|
3275
|
+
|
3276
|
+
this.regexList = [
|
3277
|
+
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
|
3278
|
+
{ regex: /^\s*@\w+/gm, css: 'decorator' },
|
3279
|
+
{ regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' },
|
3280
|
+
{ regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' },
|
3281
|
+
{ regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' },
|
3282
|
+
{ regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' },
|
3283
|
+
{ regex: /\b\d+\.?\w*/g, css: 'value' },
|
3284
|
+
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
|
3285
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
|
3286
|
+
{ regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }
|
3287
|
+
];
|
3288
|
+
|
3289
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
3290
|
+
};
|
3291
|
+
|
3292
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3293
|
+
Brush.aliases = ['py', 'python'];
|
3294
|
+
|
3295
|
+
SyntaxHighlighter.brushes.Python = Brush;
|
3296
|
+
|
3297
|
+
// CommonJS
|
3298
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3299
|
+
})();
|
3300
|
+
|
3301
|
+
;(function()
|
3302
|
+
{
|
3303
|
+
// CommonJS
|
3304
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3305
|
+
|
3306
|
+
function Brush()
|
3307
|
+
{
|
3308
|
+
// Contributed by Erik Peterson.
|
3309
|
+
|
3310
|
+
var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' +
|
3311
|
+
'END end ensure false for if in module new next nil not or raise redo rescue retry return ' +
|
3312
|
+
'self super then throw true undef unless until when while yield';
|
3313
|
+
|
3314
|
+
var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' +
|
3315
|
+
'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' +
|
3316
|
+
'ThreadGroup Thread Time TrueClass';
|
3317
|
+
|
3318
|
+
this.regexList = [
|
3319
|
+
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
|
3320
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
3321
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
3322
|
+
{ regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants
|
3323
|
+
{ regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols
|
3324
|
+
{ regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables
|
3325
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
3326
|
+
{ regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins
|
3327
|
+
];
|
3328
|
+
|
3329
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
3330
|
+
};
|
3331
|
+
|
3332
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3333
|
+
Brush.aliases = ['ruby', 'rails', 'ror', 'rb'];
|
3334
|
+
|
3335
|
+
SyntaxHighlighter.brushes.Ruby = Brush;
|
3336
|
+
|
3337
|
+
// CommonJS
|
3338
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3339
|
+
})();
|
3340
|
+
|
3341
|
+
;(function()
|
3342
|
+
{
|
3343
|
+
// CommonJS
|
3344
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3345
|
+
|
3346
|
+
function Brush()
|
3347
|
+
{
|
3348
|
+
function getKeywordsCSS(str)
|
3349
|
+
{
|
3350
|
+
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
|
3351
|
+
};
|
3352
|
+
|
3353
|
+
function getValuesCSS(str)
|
3354
|
+
{
|
3355
|
+
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
|
3356
|
+
};
|
3357
|
+
|
3358
|
+
var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
|
3359
|
+
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
|
3360
|
+
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
|
3361
|
+
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
|
3362
|
+
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
|
3363
|
+
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
|
3364
|
+
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
|
3365
|
+
'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
|
3366
|
+
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
|
3367
|
+
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
|
3368
|
+
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
|
3369
|
+
'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
|
3370
|
+
'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
|
3371
|
+
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';
|
3372
|
+
|
3373
|
+
var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
|
3374
|
+
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
|
3375
|
+
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero digits disc dotted double '+
|
3376
|
+
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
|
3377
|
+
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
|
3378
|
+
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
|
3379
|
+
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
|
3380
|
+
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
|
3381
|
+
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
|
3382
|
+
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
|
3383
|
+
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
|
3384
|
+
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
|
3385
|
+
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
|
3386
|
+
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
|
3387
|
+
|
3388
|
+
var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
|
3389
|
+
|
3390
|
+
var statements = '!important !default';
|
3391
|
+
var preprocessor = '@import @extend @debug @warn @if @for @while @mixin @include';
|
3392
|
+
|
3393
|
+
var r = SyntaxHighlighter.regexLib;
|
3394
|
+
|
3395
|
+
this.regexList = [
|
3396
|
+
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
|
3397
|
+
{ regex: r.singleLineCComments, css: 'comments' }, // singleline comments
|
3398
|
+
{ regex: r.doubleQuotedString, css: 'string' }, // double quoted strings
|
3399
|
+
{ regex: r.singleQuotedString, css: 'string' }, // single quoted strings
|
3400
|
+
{ regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors
|
3401
|
+
{ regex: /\b(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)\b/g, css: 'value' }, // sizes
|
3402
|
+
{ regex: /\$\w+/g, css: 'variable' }, // variables
|
3403
|
+
{ regex: new RegExp(this.getKeywords(statements), 'g'), css: 'color3' }, // statements
|
3404
|
+
{ regex: new RegExp(this.getKeywords(preprocessor), 'g'), css: 'preprocessor' }, // preprocessor
|
3405
|
+
{ regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords
|
3406
|
+
{ regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values
|
3407
|
+
{ regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts
|
3408
|
+
];
|
3409
|
+
};
|
3410
|
+
|
3411
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3412
|
+
Brush.aliases = ['sass', 'scss'];
|
3413
|
+
|
3414
|
+
SyntaxHighlighter.brushes.Sass = Brush;
|
3415
|
+
|
3416
|
+
// CommonJS
|
3417
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3418
|
+
})();
|
3419
|
+
|
3420
|
+
;(function()
|
3421
|
+
{
|
3422
|
+
// CommonJS
|
3423
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3424
|
+
|
3425
|
+
function Brush()
|
3426
|
+
{
|
3427
|
+
// Contributed by Yegor Jbanov and David Bernard.
|
3428
|
+
|
3429
|
+
var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' +
|
3430
|
+
'override try lazy for var catch throw type extends class while with new final yield abstract ' +
|
3431
|
+
'else do if return protected private this package false';
|
3432
|
+
|
3433
|
+
var keyops = '[_:=><%#@]+';
|
3434
|
+
|
3435
|
+
this.regexList = [
|
3436
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
3437
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
3438
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings
|
3439
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string
|
3440
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
3441
|
+
{ regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers
|
3442
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
3443
|
+
{ regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword
|
3444
|
+
];
|
3445
|
+
}
|
3446
|
+
|
3447
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3448
|
+
Brush.aliases = ['scala'];
|
3449
|
+
|
3450
|
+
SyntaxHighlighter.brushes.Scala = Brush;
|
3451
|
+
|
3452
|
+
// CommonJS
|
3453
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3454
|
+
})();
|
3455
|
+
|
3456
|
+
;(function()
|
3457
|
+
{
|
3458
|
+
// CommonJS
|
3459
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3460
|
+
|
3461
|
+
function Brush()
|
3462
|
+
{
|
3463
|
+
var funcs = 'abs avg case cast coalesce convert count current_timestamp ' +
|
3464
|
+
'current_user day isnull left lower month nullif replace right ' +
|
3465
|
+
'session_user space substring sum system_user upper user year';
|
3466
|
+
|
3467
|
+
var keywords = 'absolute action add after alter as asc at authorization begin bigint ' +
|
3468
|
+
'binary bit by cascade char character check checkpoint close collate ' +
|
3469
|
+
'column commit committed connect connection constraint contains continue ' +
|
3470
|
+
'create cube current current_date current_time cursor database date ' +
|
3471
|
+
'deallocate dec decimal declare default delete desc distinct double drop ' +
|
3472
|
+
'dynamic else end end-exec escape except exec execute false fetch first ' +
|
3473
|
+
'float for force foreign forward free from full function global goto grant ' +
|
3474
|
+
'group grouping having hour ignore index inner insensitive insert instead ' +
|
3475
|
+
'int integer intersect into is isolation key last level load local max min ' +
|
3476
|
+
'minute modify move name national nchar next no numeric of off on only ' +
|
3477
|
+
'open option order out output partial password precision prepare primary ' +
|
3478
|
+
'prior privileges procedure public read real references relative repeatable ' +
|
3479
|
+
'restrict return returns revoke rollback rollup rows rule schema scroll ' +
|
3480
|
+
'second section select sequence serializable set size smallint static ' +
|
3481
|
+
'statistics table temp temporary then time timestamp to top transaction ' +
|
3482
|
+
'translation trigger true truncate uncommitted union unique update values ' +
|
3483
|
+
'varchar varying view when where with work';
|
3484
|
+
|
3485
|
+
var operators = 'all and any between cross in join like not null or outer some';
|
3486
|
+
|
3487
|
+
this.regexList = [
|
3488
|
+
{ regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments
|
3489
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
|
3490
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
|
3491
|
+
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions
|
3492
|
+
{ regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
|
3493
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
|
3494
|
+
];
|
3495
|
+
};
|
3496
|
+
|
3497
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3498
|
+
Brush.aliases = ['sql'];
|
3499
|
+
|
3500
|
+
SyntaxHighlighter.brushes.Sql = Brush;
|
3501
|
+
|
3502
|
+
// CommonJS
|
3503
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3504
|
+
})();
|
3505
|
+
|
3506
|
+
;(function()
|
3507
|
+
{
|
3508
|
+
// CommonJS
|
3509
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3510
|
+
|
3511
|
+
function Brush()
|
3512
|
+
{
|
3513
|
+
var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' +
|
3514
|
+
'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' +
|
3515
|
+
'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' +
|
3516
|
+
'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' +
|
3517
|
+
'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' +
|
3518
|
+
'Function Get GetType GoSub GoTo Handles If Implements Imports In ' +
|
3519
|
+
'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' +
|
3520
|
+
'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' +
|
3521
|
+
'NotInheritable NotOverridable Object On Option Optional Or OrElse ' +
|
3522
|
+
'Overloads Overridable Overrides ParamArray Preserve Private Property ' +
|
3523
|
+
'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' +
|
3524
|
+
'Return Select Set Shadows Shared Short Single Static Step Stop String ' +
|
3525
|
+
'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' +
|
3526
|
+
'Variant When While With WithEvents WriteOnly Xor';
|
3527
|
+
|
3528
|
+
this.regexList = [
|
3529
|
+
{ regex: /'.*$/gm, css: 'comments' }, // one line comments
|
3530
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
3531
|
+
{ regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
3532
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword
|
3533
|
+
];
|
3534
|
+
|
3535
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
3536
|
+
};
|
3537
|
+
|
3538
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3539
|
+
Brush.aliases = ['vb', 'vbnet'];
|
3540
|
+
|
3541
|
+
SyntaxHighlighter.brushes.Vb = Brush;
|
3542
|
+
|
3543
|
+
// CommonJS
|
3544
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3545
|
+
})();
|
3546
|
+
|
3547
|
+
;(function()
|
3548
|
+
{
|
3549
|
+
// CommonJS
|
3550
|
+
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
3551
|
+
|
3552
|
+
function Brush()
|
3553
|
+
{
|
3554
|
+
function process(match, regexInfo)
|
3555
|
+
{
|
3556
|
+
var constructor = SyntaxHighlighter.Match,
|
3557
|
+
code = match[0],
|
3558
|
+
tag = new XRegExp('(<|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code),
|
3559
|
+
result = []
|
3560
|
+
;
|
3561
|
+
|
3562
|
+
if (match.attributes != null)
|
3563
|
+
{
|
3564
|
+
var attributes,
|
3565
|
+
regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' +
|
3566
|
+
'\\s*=\\s*' +
|
3567
|
+
'(?<value> ".*?"|\'.*?\'|\\w+)',
|
3568
|
+
'xg');
|
3569
|
+
|
3570
|
+
while ((attributes = regex.exec(code)) != null)
|
3571
|
+
{
|
3572
|
+
result.push(new constructor(attributes.name, match.index + attributes.index, 'color1'));
|
3573
|
+
result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string'));
|
3574
|
+
}
|
3575
|
+
}
|
3576
|
+
|
3577
|
+
if (tag != null)
|
3578
|
+
result.push(
|
3579
|
+
new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword')
|
3580
|
+
);
|
3581
|
+
|
3582
|
+
return result;
|
3583
|
+
}
|
3584
|
+
|
3585
|
+
this.regexList = [
|
3586
|
+
{ regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]>
|
3587
|
+
{ regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... -->
|
3588
|
+
{ regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process }
|
3589
|
+
];
|
3590
|
+
};
|
3591
|
+
|
3592
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
3593
|
+
Brush.aliases = ['xml', 'xhtml', 'xslt', 'html'];
|
3594
|
+
|
3595
|
+
SyntaxHighlighter.brushes.Xml = Brush;
|
3596
|
+
|
3597
|
+
// CommonJS
|
3598
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
3599
|
+
})();
|