kiso_themes 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (944) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +12 -0
  3. data/LICENSE +170 -0
  4. data/README.rdoc +6 -0
  5. data/Rakefile +516 -0
  6. data/VERSION +1 -0
  7. data/app/assets/fonts/font-awesome/FontAwesome.otf +0 -0
  8. data/app/assets/fonts/font-awesome/fontawesome-webfont.eot +0 -0
  9. data/app/assets/fonts/font-awesome/fontawesome-webfont.svg +2671 -0
  10. data/app/assets/fonts/font-awesome/fontawesome-webfont.ttf +0 -0
  11. data/app/assets/fonts/font-awesome/fontawesome-webfont.woff +0 -0
  12. data/app/assets/fonts/font-awesome/fontawesome-webfont.woff2 +0 -0
  13. data/app/assets/fonts/ionicons/ionicons.eot +0 -0
  14. data/app/assets/fonts/ionicons/ionicons.svg +2230 -0
  15. data/app/assets/fonts/ionicons/ionicons.ttf +0 -0
  16. data/app/assets/fonts/ionicons/ionicons.woff +0 -0
  17. data/app/assets/fonts/mdiicons/LICENSE.txt +428 -0
  18. data/app/assets/fonts/mdiicons/MaterialIcons-Regular.eot +0 -0
  19. data/app/assets/fonts/mdiicons/MaterialIcons-Regular.ijmap +1 -0
  20. data/app/assets/fonts/mdiicons/MaterialIcons-Regular.svg +2373 -0
  21. data/app/assets/fonts/mdiicons/MaterialIcons-Regular.ttf +0 -0
  22. data/app/assets/fonts/mdiicons/MaterialIcons-Regular.woff +0 -0
  23. data/app/assets/fonts/mdiicons/MaterialIcons-Regular.woff2 +0 -0
  24. data/app/assets/fonts/mdiicons/README.md +9 -0
  25. data/app/assets/fonts/mdiicons/codepoints +932 -0
  26. data/app/assets/fonts/themify/themify.eot +0 -0
  27. data/app/assets/fonts/themify/themify.svg +362 -0
  28. data/app/assets/fonts/themify/themify.ttf +0 -0
  29. data/app/assets/fonts/themify/themify.woff +0 -0
  30. data/app/assets/images/kiso_themes/app_video_placeholder.png +0 -0
  31. data/app/assets/images/kiso_themes/arrow-1.svg +8 -0
  32. data/app/assets/images/kiso_themes/arrow-2.svg +7 -0
  33. data/app/assets/images/kiso_themes/creditcards/amex.png +0 -0
  34. data/app/assets/images/kiso_themes/creditcards/credit.png +0 -0
  35. data/app/assets/images/kiso_themes/creditcards/dankort.png +0 -0
  36. data/app/assets/images/kiso_themes/creditcards/diners.png +0 -0
  37. data/app/assets/images/kiso_themes/creditcards/discover.png +0 -0
  38. data/app/assets/images/kiso_themes/creditcards/forbru.png +0 -0
  39. data/app/assets/images/kiso_themes/creditcards/google.png +0 -0
  40. data/app/assets/images/kiso_themes/creditcards/jcb.png +0 -0
  41. data/app/assets/images/kiso_themes/creditcards/laser.png +0 -0
  42. data/app/assets/images/kiso_themes/creditcards/maestro.png +0 -0
  43. data/app/assets/images/kiso_themes/creditcards/mastercard.png +0 -0
  44. data/app/assets/images/kiso_themes/creditcards/money.png +0 -0
  45. data/app/assets/images/kiso_themes/creditcards/paypa.png +0 -0
  46. data/app/assets/images/kiso_themes/creditcards/shopify.png +0 -0
  47. data/app/assets/images/kiso_themes/creditcards/solo.png +0 -0
  48. data/app/assets/images/kiso_themes/creditcards/visa.png +0 -0
  49. data/app/assets/images/kiso_themes/header_1.jpg +0 -0
  50. data/app/assets/images/kiso_themes/icons/check.png +0 -0
  51. data/app/assets/images/kiso_themes/landing_bg.jpg +0 -0
  52. data/app/assets/images/kiso_themes/pyrrmid_128.png +0 -0
  53. data/app/assets/images/kiso_themes/pyrrmid_200.png +0 -0
  54. data/app/assets/images/kiso_themes/pyrrmid_32.png +0 -0
  55. data/app/assets/images/kiso_themes/pyrrmid_64.png +0 -0
  56. data/app/assets/images/kiso_themes/stock/1.jpg +0 -0
  57. data/app/assets/images/kiso_themes/stock/2.jpg +0 -0
  58. data/app/assets/images/kiso_themes/stock/3.jpg +0 -0
  59. data/app/assets/images/kiso_themes/stock/4.jpg +0 -0
  60. data/app/assets/images/kiso_themes/stock/acme_1.png +0 -0
  61. data/app/assets/images/kiso_themes/stock/acme_2.png +0 -0
  62. data/app/assets/images/kiso_themes/stock/acme_3.png +0 -0
  63. data/app/assets/images/kiso_themes/stock/acme_4.png +0 -0
  64. data/app/assets/images/kiso_themes/stock/acme_5.png +0 -0
  65. data/app/assets/images/kiso_themes/stock/acme_6.png +0 -0
  66. data/app/assets/images/kiso_themes/stock/acme_7.png +0 -0
  67. data/app/assets/images/kiso_themes/stock/acme_8.png +0 -0
  68. data/app/assets/images/kiso_themes/stock/landscape_1.jpg +0 -0
  69. data/app/assets/images/kiso_themes/stock/landscape_10.jpg +0 -0
  70. data/app/assets/images/kiso_themes/stock/landscape_12.jpg +0 -0
  71. data/app/assets/images/kiso_themes/stock/landscape_13.jpg +0 -0
  72. data/app/assets/images/kiso_themes/stock/landscape_14.jpg +0 -0
  73. data/app/assets/images/kiso_themes/stock/landscape_2.jpg +0 -0
  74. data/app/assets/images/kiso_themes/stock/landscape_3.jpg +0 -0
  75. data/app/assets/images/kiso_themes/stock/landscape_4.jpg +0 -0
  76. data/app/assets/images/kiso_themes/stock/landscape_5.jpg +0 -0
  77. data/app/assets/images/kiso_themes/stock/landscape_6.jpg +0 -0
  78. data/app/assets/images/kiso_themes/stock/landscape_7.jpg +0 -0
  79. data/app/assets/images/kiso_themes/stock/landscape_8.jpg +0 -0
  80. data/app/assets/images/kiso_themes/stock/landscape_9.jpg +0 -0
  81. data/app/assets/images/kiso_themes/stock/us_landscape_1.jpg +0 -0
  82. data/app/assets/images/kiso_themes/stock/us_landscape_2.jpg +0 -0
  83. data/app/assets/images/kiso_themes/ui_placeholder_desktop.png +0 -0
  84. data/app/assets/javascripts/kiso_themes/bootstrap.js +20 -0
  85. data/app/assets/javascripts/kiso_themes/bootstrap_switch.js +23 -0
  86. data/app/assets/javascripts/kiso_themes/chartjs.js +11 -0
  87. data/app/assets/javascripts/kiso_themes/clipboard.js +12 -0
  88. data/app/assets/javascripts/kiso_themes/countTo.js +1 -0
  89. data/app/assets/javascripts/kiso_themes/countdown.js +28 -0
  90. data/app/assets/javascripts/kiso_themes/demo/chartjs.js +102 -0
  91. data/app/assets/javascripts/kiso_themes/demo/dashboard.js +229 -0
  92. data/app/assets/javascripts/kiso_themes/demo/data_generator.js +25 -0
  93. data/app/assets/javascripts/kiso_themes/demo/easypiechart.js +41 -0
  94. data/app/assets/javascripts/kiso_themes/demo/flot.js +258 -0
  95. data/app/assets/javascripts/kiso_themes/demo/gmaps.js +163 -0
  96. data/app/assets/javascripts/kiso_themes/demo/jqvectormap.js +65 -0
  97. data/app/assets/javascripts/kiso_themes/demo/sparklines.js +156 -0
  98. data/app/assets/javascripts/kiso_themes/easypiechart.js +12 -0
  99. data/app/assets/javascripts/kiso_themes/fastclick.js +16 -0
  100. data/app/assets/javascripts/kiso_themes/fitie.js +14 -0
  101. data/app/assets/javascripts/kiso_themes/flot.js +11 -0
  102. data/app/assets/javascripts/kiso_themes/forms.js +13 -0
  103. data/app/assets/javascripts/kiso_themes/gmaps.js +9 -0
  104. data/app/assets/javascripts/kiso_themes/header.js +33 -0
  105. data/app/assets/javascripts/kiso_themes/inspect_mode/inspect_mode.js +581 -0
  106. data/app/assets/javascripts/kiso_themes/jasny.js +13 -0
  107. data/app/assets/javascripts/kiso_themes/jqvectormaps.js +24 -0
  108. data/app/assets/javascripts/kiso_themes/kernel.js +48 -0
  109. data/app/assets/javascripts/kiso_themes/metis_menu.js +16 -0
  110. data/app/assets/javascripts/kiso_themes/parallax.js +14 -0
  111. data/app/assets/javascripts/kiso_themes/popper.js +1 -0
  112. data/app/assets/javascripts/kiso_themes/prettify.js +12 -0
  113. data/app/assets/javascripts/kiso_themes/prism.js +10 -0
  114. data/app/assets/javascripts/kiso_themes/sheets.js +98 -0
  115. data/app/assets/javascripts/kiso_themes/sidenav.js +77 -0
  116. data/app/assets/javascripts/kiso_themes/slimscroll.js +1 -0
  117. data/app/assets/javascripts/kiso_themes/sparklines.js +1 -0
  118. data/app/assets/javascripts/kiso_themes.js +39 -0
  119. data/app/assets/javascripts/vendor/bootstrap/bootstrap/alert.js +198 -0
  120. data/app/assets/javascripts/vendor/bootstrap/bootstrap/button.js +186 -0
  121. data/app/assets/javascripts/vendor/bootstrap/bootstrap/carousel.js +667 -0
  122. data/app/assets/javascripts/vendor/bootstrap/bootstrap/collapse.js +427 -0
  123. data/app/assets/javascripts/vendor/bootstrap/bootstrap/dropdown.js +594 -0
  124. data/app/assets/javascripts/vendor/bootstrap/bootstrap/index.js +22 -0
  125. data/app/assets/javascripts/vendor/bootstrap/bootstrap/modal.js +649 -0
  126. data/app/assets/javascripts/vendor/bootstrap/bootstrap/popover.js +260 -0
  127. data/app/assets/javascripts/vendor/bootstrap/bootstrap/scrollspy.js +374 -0
  128. data/app/assets/javascripts/vendor/bootstrap/bootstrap/tab.js +268 -0
  129. data/app/assets/javascripts/vendor/bootstrap/bootstrap/toast.js +282 -0
  130. data/app/assets/javascripts/vendor/bootstrap/bootstrap/tooltip.js +906 -0
  131. data/app/assets/javascripts/vendor/bootstrap/bootstrap/util.js +171 -0
  132. data/app/assets/javascripts/vendor/bootstrap/bootstrap.js +13 -0
  133. data/app/assets/javascripts/vendor/bootstrap_switch/bootstrap_switch.js +744 -0
  134. data/app/assets/javascripts/vendor/chartjs/Chart.bundle.min.js +10 -0
  135. data/app/assets/javascripts/vendor/chartjs/Chart.min.js +10 -0
  136. data/app/assets/javascripts/vendor/clipboardjs/clipboard.js +7 -0
  137. data/app/assets/javascripts/vendor/countTo/countTo.js +130 -0
  138. data/app/assets/javascripts/vendor/countdown/countdown.js +22 -0
  139. data/app/assets/javascripts/vendor/easypiechart/jquery.easypiechart.js +364 -0
  140. data/app/assets/javascripts/vendor/fastclick/fastclick.js +841 -0
  141. data/app/assets/javascripts/vendor/fitie/fitie.js +1 -0
  142. data/app/assets/javascripts/vendor/flot/flot-chart-resize.js +59 -0
  143. data/app/assets/javascripts/vendor/flot/flot-chart-stack.js +188 -0
  144. data/app/assets/javascripts/vendor/flot/flot-chart-time.js +432 -0
  145. data/app/assets/javascripts/vendor/flot/flot-chart.js +3168 -0
  146. data/app/assets/javascripts/vendor/gmaps/gmaps.js +2418 -0
  147. data/app/assets/javascripts/vendor/jasny/jasny_bootstrap.js +1020 -0
  148. data/app/assets/javascripts/vendor/jqvectormaps/jquery-jvectormap.css +135 -0
  149. data/app/assets/javascripts/vendor/jqvectormaps/jquery-jvectormap.js +3375 -0
  150. data/app/assets/javascripts/vendor/jqvectormaps/maps/More maps.txt +1 -0
  151. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-au-mill-en.js +1 -0
  152. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-ca-mill.js +1 -0
  153. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-cn-mill-en.js +1 -0
  154. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-de-mill-en.js +1 -0
  155. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-europe-mill-en.js +1 -0
  156. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-fr-mill-en.js +1 -0
  157. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-in-mill-en.js +1 -0
  158. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-us-aea-en.js +1 -0
  159. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-world-mill-en.js +1 -0
  160. data/app/assets/javascripts/vendor/jqvectormaps/maps/jquery-jvectormap-za-mill-en.js +1 -0
  161. data/app/assets/javascripts/vendor/metis_menu/metis_menu.js +337 -0
  162. data/app/assets/javascripts/vendor/modernizr/modernizr.2.8.3.min.js +1 -0
  163. data/app/assets/javascripts/vendor/parallax/parallax.js +6 -0
  164. data/app/assets/javascripts/vendor/popper/popper.js +4 -0
  165. data/app/assets/javascripts/vendor/prettify/prettify.js +1655 -0
  166. data/app/assets/javascripts/vendor/prism/prism-normalize-whitespace.js +190 -0
  167. data/app/assets/javascripts/vendor/prism/prism.js +819 -0
  168. data/app/assets/javascripts/vendor/slimscroll/slimscroll.js +288 -0
  169. data/app/assets/javascripts/vendor/sparklines/jquery.sparkline.js +3054 -0
  170. data/app/assets/stylesheets/kiso_themes/auriga/blue.css.erb +31497 -0
  171. data/app/assets/stylesheets/kiso_themes/auriga/green.css.erb +31497 -0
  172. data/app/assets/stylesheets/kiso_themes/auriga/red.css.erb +31497 -0
  173. data/app/assets/stylesheets/kiso_themes/auriga/yellow.css.erb +31497 -0
  174. data/app/assets/stylesheets/kiso_themes/carbon/black.css.erb +0 -0
  175. data/app/assets/stylesheets/kiso_themes/gemini/amber.css.erb +31469 -0
  176. data/app/assets/stylesheets/kiso_themes/gemini/blue.css.erb +31469 -0
  177. data/app/assets/stylesheets/kiso_themes/gemini/granite.css.erb +31469 -0
  178. data/app/assets/stylesheets/kiso_themes/gemini/ocean.css.erb +31469 -0
  179. data/app/assets/stylesheets/kiso_themes/lyra/azure.css.erb +31469 -0
  180. data/app/assets/stylesheets/kiso_themes/lyra/charcoal.css.erb +31469 -0
  181. data/app/assets/stylesheets/kiso_themes/lyra/lime.css.erb +31469 -0
  182. data/app/assets/stylesheets/kiso_themes/lyra/raspberry.css.erb +31469 -0
  183. data/app/assets/stylesheets/kiso_themes/orion/blue.css.erb +31469 -0
  184. data/app/assets/stylesheets/kiso_themes/orion/green.css.erb +31469 -0
  185. data/app/assets/stylesheets/kiso_themes/orion/orange.css.erb +31464 -0
  186. data/app/assets/stylesheets/kiso_themes/orion/purple.css.erb +31469 -0
  187. data/app/helpers/content_block_helper.rb +2 -0
  188. data/app/helpers/devices_helper.rb +67 -0
  189. data/app/helpers/dropdown_helper.rb +50 -0
  190. data/app/helpers/email_template_helper.rb +66 -0
  191. data/app/helpers/form_errors_helper.rb +50 -0
  192. data/app/helpers/form_group_helper.rb +48 -0
  193. data/app/helpers/html_helper.rb +57 -0
  194. data/app/helpers/icons_helper.rb +56 -0
  195. data/app/helpers/metrics_helper.rb +90 -0
  196. data/app/views/content_blocks/app_navs/_1.html.erb +124 -0
  197. data/app/views/content_blocks/app_navs/_1.html.haml +83 -0
  198. data/app/views/content_blocks/app_navs/_1.html.slim +83 -0
  199. data/app/views/content_blocks/app_navs/_2.html.erb +124 -0
  200. data/app/views/content_blocks/app_navs/_2.html.haml +81 -0
  201. data/app/views/content_blocks/app_navs/_2.html.slim +81 -0
  202. data/app/views/content_blocks/app_navs/_3.html.erb +129 -0
  203. data/app/views/content_blocks/app_navs/_3.html.haml +84 -0
  204. data/app/views/content_blocks/app_navs/_3.html.slim +84 -0
  205. data/app/views/content_blocks/app_navs/_4.html.erb +127 -0
  206. data/app/views/content_blocks/app_navs/_4.html.haml +82 -0
  207. data/app/views/content_blocks/app_navs/_4.html.slim +82 -0
  208. data/app/views/content_blocks/app_navs/_5.html.erb +47 -0
  209. data/app/views/content_blocks/app_navs/_5.html.haml +30 -0
  210. data/app/views/content_blocks/app_navs/_5.html.slim +30 -0
  211. data/app/views/content_blocks/basic/_1.html.erb +12 -0
  212. data/app/views/content_blocks/basic/_1.html.haml +8 -0
  213. data/app/views/content_blocks/basic/_1.html.slim +8 -0
  214. data/app/views/content_blocks/basic/_2.html.erb +12 -0
  215. data/app/views/content_blocks/basic/_2.html.haml +8 -0
  216. data/app/views/content_blocks/basic/_2.html.slim +8 -0
  217. data/app/views/content_blocks/basic/_3.html.erb +12 -0
  218. data/app/views/content_blocks/basic/_3.html.haml +8 -0
  219. data/app/views/content_blocks/basic/_3.html.slim +8 -0
  220. data/app/views/content_blocks/basic/_4.html.erb +20 -0
  221. data/app/views/content_blocks/basic/_4.html.haml +14 -0
  222. data/app/views/content_blocks/basic/_4.html.slim +14 -0
  223. data/app/views/content_blocks/basic/_5.html.erb +16 -0
  224. data/app/views/content_blocks/basic/_5.html.haml +11 -0
  225. data/app/views/content_blocks/basic/_5.html.slim +11 -0
  226. data/app/views/content_blocks/basic/_6.html.erb +11 -0
  227. data/app/views/content_blocks/basic/_6.html.haml +7 -0
  228. data/app/views/content_blocks/basic/_6.html.slim +7 -0
  229. data/app/views/content_blocks/basic/_7.html.erb +11 -0
  230. data/app/views/content_blocks/basic/_7.html.haml +7 -0
  231. data/app/views/content_blocks/basic/_7.html.slim +7 -0
  232. data/app/views/content_blocks/basic/_8.html.erb +19 -0
  233. data/app/views/content_blocks/basic/_8.html.haml +14 -0
  234. data/app/views/content_blocks/basic/_8.html.slim +14 -0
  235. data/app/views/content_blocks/general/_1.html.erb +14 -0
  236. data/app/views/content_blocks/general/_1.html.haml +14 -0
  237. data/app/views/content_blocks/general/_1.html.slim +14 -0
  238. data/app/views/content_blocks/general/_10.html.erb +11 -0
  239. data/app/views/content_blocks/general/_10.html.haml +9 -0
  240. data/app/views/content_blocks/general/_10.html.slim +9 -0
  241. data/app/views/content_blocks/general/_11.html.erb +11 -0
  242. data/app/views/content_blocks/general/_11.html.haml +9 -0
  243. data/app/views/content_blocks/general/_11.html.slim +9 -0
  244. data/app/views/content_blocks/general/_12.html.erb +60 -0
  245. data/app/views/content_blocks/general/_12.html.haml +40 -0
  246. data/app/views/content_blocks/general/_12.html.slim +40 -0
  247. data/app/views/content_blocks/general/_13.html.erb +11 -0
  248. data/app/views/content_blocks/general/_13.html.haml +8 -0
  249. data/app/views/content_blocks/general/_13.html.slim +8 -0
  250. data/app/views/content_blocks/general/_14.html.erb +18 -0
  251. data/app/views/content_blocks/general/_14.html.haml +11 -0
  252. data/app/views/content_blocks/general/_14.html.slim +11 -0
  253. data/app/views/content_blocks/general/_15.html.erb +50 -0
  254. data/app/views/content_blocks/general/_15.html.haml +30 -0
  255. data/app/views/content_blocks/general/_15.html.slim +30 -0
  256. data/app/views/content_blocks/general/_16.html.erb +54 -0
  257. data/app/views/content_blocks/general/_16.html.haml +34 -0
  258. data/app/views/content_blocks/general/_16.html.slim +34 -0
  259. data/app/views/content_blocks/general/_17.html.erb +11 -0
  260. data/app/views/content_blocks/general/_17.html.haml +9 -0
  261. data/app/views/content_blocks/general/_17.html.slim +9 -0
  262. data/app/views/content_blocks/general/_18.html.erb +11 -0
  263. data/app/views/content_blocks/general/_18.html.haml +10 -0
  264. data/app/views/content_blocks/general/_18.html.slim +10 -0
  265. data/app/views/content_blocks/general/_19.html.erb +11 -0
  266. data/app/views/content_blocks/general/_19.html.haml +9 -0
  267. data/app/views/content_blocks/general/_19.html.slim +9 -0
  268. data/app/views/content_blocks/general/_2.html.erb +14 -0
  269. data/app/views/content_blocks/general/_2.html.haml +14 -0
  270. data/app/views/content_blocks/general/_2.html.slim +14 -0
  271. data/app/views/content_blocks/general/_20.html.erb +9 -0
  272. data/app/views/content_blocks/general/_20.html.haml +6 -0
  273. data/app/views/content_blocks/general/_20.html.slim +6 -0
  274. data/app/views/content_blocks/general/_21.html.erb +9 -0
  275. data/app/views/content_blocks/general/_21.html.haml +6 -0
  276. data/app/views/content_blocks/general/_21.html.slim +6 -0
  277. data/app/views/content_blocks/general/_22.html.erb +13 -0
  278. data/app/views/content_blocks/general/_22.html.haml +8 -0
  279. data/app/views/content_blocks/general/_22.html.slim +8 -0
  280. data/app/views/content_blocks/general/_23.html.erb +13 -0
  281. data/app/views/content_blocks/general/_23.html.haml +8 -0
  282. data/app/views/content_blocks/general/_23.html.slim +8 -0
  283. data/app/views/content_blocks/general/_24.html.erb +60 -0
  284. data/app/views/content_blocks/general/_24.html.haml +40 -0
  285. data/app/views/content_blocks/general/_24.html.slim +40 -0
  286. data/app/views/content_blocks/general/_25.html.erb +60 -0
  287. data/app/views/content_blocks/general/_25.html.haml +40 -0
  288. data/app/views/content_blocks/general/_25.html.slim +40 -0
  289. data/app/views/content_blocks/general/_26.html.erb +11 -0
  290. data/app/views/content_blocks/general/_26.html.haml +7 -0
  291. data/app/views/content_blocks/general/_26.html.slim +7 -0
  292. data/app/views/content_blocks/general/_27.html.erb +13 -0
  293. data/app/views/content_blocks/general/_27.html.haml +8 -0
  294. data/app/views/content_blocks/general/_27.html.slim +8 -0
  295. data/app/views/content_blocks/general/_28.html.erb +13 -0
  296. data/app/views/content_blocks/general/_28.html.haml +8 -0
  297. data/app/views/content_blocks/general/_28.html.slim +8 -0
  298. data/app/views/content_blocks/general/_29.html.erb +13 -0
  299. data/app/views/content_blocks/general/_29.html.haml +8 -0
  300. data/app/views/content_blocks/general/_29.html.slim +8 -0
  301. data/app/views/content_blocks/general/_3.html.erb +12 -0
  302. data/app/views/content_blocks/general/_3.html.haml +8 -0
  303. data/app/views/content_blocks/general/_3.html.slim +8 -0
  304. data/app/views/content_blocks/general/_30.html.erb +40 -0
  305. data/app/views/content_blocks/general/_30.html.haml +38 -0
  306. data/app/views/content_blocks/general/_30.html.slim +38 -0
  307. data/app/views/content_blocks/general/_31.html.erb +19 -0
  308. data/app/views/content_blocks/general/_31.html.haml +17 -0
  309. data/app/views/content_blocks/general/_31.html.slim +17 -0
  310. data/app/views/content_blocks/general/_32.html.erb +51 -0
  311. data/app/views/content_blocks/general/_32.html.haml +45 -0
  312. data/app/views/content_blocks/general/_32.html.slim +45 -0
  313. data/app/views/content_blocks/general/_33.html.erb +10 -0
  314. data/app/views/content_blocks/general/_33.html.haml +6 -0
  315. data/app/views/content_blocks/general/_33.html.slim +6 -0
  316. data/app/views/content_blocks/general/_34.html.erb +23 -0
  317. data/app/views/content_blocks/general/_34.html.haml +18 -0
  318. data/app/views/content_blocks/general/_34.html.slim +18 -0
  319. data/app/views/content_blocks/general/_35.html.erb +86 -0
  320. data/app/views/content_blocks/general/_35.html.haml +63 -0
  321. data/app/views/content_blocks/general/_35.html.slim +63 -0
  322. data/app/views/content_blocks/general/_36.html.erb +87 -0
  323. data/app/views/content_blocks/general/_36.html.haml +67 -0
  324. data/app/views/content_blocks/general/_36.html.slim +67 -0
  325. data/app/views/content_blocks/general/_37.html.erb +68 -0
  326. data/app/views/content_blocks/general/_37.html.haml +52 -0
  327. data/app/views/content_blocks/general/_37.html.slim +52 -0
  328. data/app/views/content_blocks/general/_38.html.erb +61 -0
  329. data/app/views/content_blocks/general/_38.html.haml +54 -0
  330. data/app/views/content_blocks/general/_38.html.slim +54 -0
  331. data/app/views/content_blocks/general/_39.html.erb +16 -0
  332. data/app/views/content_blocks/general/_39.html.haml +10 -0
  333. data/app/views/content_blocks/general/_39.html.slim +10 -0
  334. data/app/views/content_blocks/general/_4.html.erb +12 -0
  335. data/app/views/content_blocks/general/_4.html.haml +8 -0
  336. data/app/views/content_blocks/general/_4.html.slim +8 -0
  337. data/app/views/content_blocks/general/_40!dark.html.erb +9 -0
  338. data/app/views/content_blocks/general/_40!dark.html.haml +6 -0
  339. data/app/views/content_blocks/general/_40!dark.html.slim +6 -0
  340. data/app/views/content_blocks/general/_5.html.erb +28 -0
  341. data/app/views/content_blocks/general/_5.html.haml +19 -0
  342. data/app/views/content_blocks/general/_5.html.slim +19 -0
  343. data/app/views/content_blocks/general/_6.html.erb +49 -0
  344. data/app/views/content_blocks/general/_6.html.haml +34 -0
  345. data/app/views/content_blocks/general/_6.html.slim +34 -0
  346. data/app/views/content_blocks/general/_7.html.erb +21 -0
  347. data/app/views/content_blocks/general/_7.html.haml +14 -0
  348. data/app/views/content_blocks/general/_7.html.slim +14 -0
  349. data/app/views/content_blocks/general/_8.html.erb +21 -0
  350. data/app/views/content_blocks/general/_8.html.haml +14 -0
  351. data/app/views/content_blocks/general/_8.html.slim +14 -0
  352. data/app/views/content_blocks/general/_9.html.erb +31 -0
  353. data/app/views/content_blocks/general/_9.html.haml +21 -0
  354. data/app/views/content_blocks/general/_9.html.slim +21 -0
  355. data/app/views/content_blocks/headers/_1.html.erb +59 -0
  356. data/app/views/content_blocks/headers/_1.html.haml +42 -0
  357. data/app/views/content_blocks/headers/_1.html.slim +42 -0
  358. data/app/views/content_blocks/headers/_10.html.erb +57 -0
  359. data/app/views/content_blocks/headers/_10.html.haml +41 -0
  360. data/app/views/content_blocks/headers/_10.html.slim +41 -0
  361. data/app/views/content_blocks/headers/_2.html.erb +51 -0
  362. data/app/views/content_blocks/headers/_2.html.haml +37 -0
  363. data/app/views/content_blocks/headers/_2.html.slim +37 -0
  364. data/app/views/content_blocks/headers/_3.html.erb +51 -0
  365. data/app/views/content_blocks/headers/_3.html.haml +37 -0
  366. data/app/views/content_blocks/headers/_3.html.slim +37 -0
  367. data/app/views/content_blocks/headers/_4.html.erb +78 -0
  368. data/app/views/content_blocks/headers/_4.html.haml +55 -0
  369. data/app/views/content_blocks/headers/_4.html.slim +55 -0
  370. data/app/views/content_blocks/headers/_5.html.erb +77 -0
  371. data/app/views/content_blocks/headers/_5.html.haml +55 -0
  372. data/app/views/content_blocks/headers/_5.html.slim +55 -0
  373. data/app/views/content_blocks/headers/_6.html.erb +50 -0
  374. data/app/views/content_blocks/headers/_6.html.haml +37 -0
  375. data/app/views/content_blocks/headers/_6.html.slim +37 -0
  376. data/app/views/content_blocks/headers/_7.html.erb +54 -0
  377. data/app/views/content_blocks/headers/_7.html.haml +39 -0
  378. data/app/views/content_blocks/headers/_7.html.slim +39 -0
  379. data/app/views/content_blocks/headers/_8.html.erb +77 -0
  380. data/app/views/content_blocks/headers/_8.html.haml +56 -0
  381. data/app/views/content_blocks/headers/_8.html.slim +56 -0
  382. data/app/views/content_blocks/headers/_9.html.erb +76 -0
  383. data/app/views/content_blocks/headers/_9.html.haml +53 -0
  384. data/app/views/content_blocks/headers/_9.html.slim +53 -0
  385. data/app/views/content_blocks/landing_navs/_1.html.erb +22 -0
  386. data/app/views/content_blocks/landing_navs/_1.html.haml +16 -0
  387. data/app/views/content_blocks/landing_navs/_1.html.slim +16 -0
  388. data/app/views/content_blocks/landing_navs/_2.html.erb +25 -0
  389. data/app/views/content_blocks/landing_navs/_2.html.haml +18 -0
  390. data/app/views/content_blocks/landing_navs/_2.html.slim +18 -0
  391. data/app/views/content_blocks/landing_navs/_3.html.erb +28 -0
  392. data/app/views/content_blocks/landing_navs/_3.html.haml +20 -0
  393. data/app/views/content_blocks/landing_navs/_3.html.slim +20 -0
  394. data/app/views/content_blocks/landing_navs/_4.html.erb +31 -0
  395. data/app/views/content_blocks/landing_navs/_4.html.haml +24 -0
  396. data/app/views/content_blocks/landing_navs/_4.html.slim +24 -0
  397. data/app/views/content_blocks/landing_navs/_5.html.erb +31 -0
  398. data/app/views/content_blocks/landing_navs/_5.html.haml +24 -0
  399. data/app/views/content_blocks/landing_navs/_5.html.slim +24 -0
  400. data/app/views/devise/erb/confirmations/new.html.erb +36 -0
  401. data/app/views/devise/erb/invitations/edit.html.erb +41 -0
  402. data/app/views/devise/erb/invitations/new.html.erb +37 -0
  403. data/app/views/devise/erb/mailer/confirmation_instructions.html.erb +18 -0
  404. data/app/views/devise/erb/mailer/invitation_instructions.html.erb +20 -0
  405. data/app/views/devise/erb/mailer/reset_password_instructions.html.erb +18 -0
  406. data/app/views/devise/erb/mailer/unlock_instructions.html.erb +19 -0
  407. data/app/views/devise/erb/passwords/edit.html.erb +44 -0
  408. data/app/views/devise/erb/passwords/new.html.erb +37 -0
  409. data/app/views/devise/erb/registrations/edit.html.erb +73 -0
  410. data/app/views/devise/erb/registrations/new.html.erb +48 -0
  411. data/app/views/devise/erb/sessions/new.html.erb +79 -0
  412. data/app/views/devise/erb/unlocks/new.html.erb +36 -0
  413. data/app/views/devise/haml/confirmations/new.html.haml +22 -0
  414. data/app/views/devise/haml/invitations/edit.html.haml +29 -0
  415. data/app/views/devise/haml/invitations/new.html.haml +21 -0
  416. data/app/views/devise/haml/mailer/confirmation_instructions.html.haml +10 -0
  417. data/app/views/devise/haml/mailer/invitation_instructions.html.haml +11 -0
  418. data/app/views/devise/haml/mailer/reset_password_instructions.html.haml +10 -0
  419. data/app/views/devise/haml/mailer/unlock_instructions.html.haml +10 -0
  420. data/app/views/devise/haml/passwords/edit.html.haml +27 -0
  421. data/app/views/devise/haml/passwords/new.html.haml +22 -0
  422. data/app/views/devise/haml/registrations/edit.html.haml +44 -0
  423. data/app/views/devise/haml/registrations/new.html.haml +30 -0
  424. data/app/views/devise/haml/sessions/new.html.haml +44 -0
  425. data/app/views/devise/haml/unlocks/new.html.haml +23 -0
  426. data/app/views/devise/slim/confirmations/new.html.haml +24 -0
  427. data/app/views/devise/slim/invitations/edit.html.haml +24 -0
  428. data/app/views/devise/slim/invitations/new.html.haml +20 -0
  429. data/app/views/devise/slim/mailer/confirmation_instructions.html.haml +26 -0
  430. data/app/views/devise/slim/mailer/invitation_instructions.html.haml +25 -0
  431. data/app/views/devise/slim/mailer/reset_password_instructions.html.haml +27 -0
  432. data/app/views/devise/slim/mailer/unlock_instructions.html.haml +27 -0
  433. data/app/views/devise/slim/passwords/edit.html.haml +26 -0
  434. data/app/views/devise/slim/passwords/new.html.haml +25 -0
  435. data/app/views/devise/slim/registrations/edit.html.haml +40 -0
  436. data/app/views/devise/slim/registrations/new.html.haml +32 -0
  437. data/app/views/devise/slim/sessions/new.html.haml +43 -0
  438. data/app/views/devise/slim/unlocks/new.html.haml +24 -0
  439. data/app/views/kaminari/_first_page.html.erb +15 -0
  440. data/app/views/kaminari/_gap.html.erb +8 -0
  441. data/app/views/kaminari/_gap.html.haml +2 -0
  442. data/app/views/kaminari/_last_page.html.erb +15 -0
  443. data/app/views/kaminari/_next_page.html.erb +15 -0
  444. data/app/views/kaminari/_next_page.html.haml +2 -0
  445. data/app/views/kaminari/_page.html.erb +12 -0
  446. data/app/views/kaminari/_page.html.haml +2 -0
  447. data/app/views/kaminari/_paginator.html.erb +27 -0
  448. data/app/views/kaminari/_paginator.html.haml +10 -0
  449. data/app/views/kaminari/_prev_page.html.erb +15 -0
  450. data/app/views/kaminari/_prev_page.html.haml +2 -0
  451. data/kiso_themes.gemspec +37 -0
  452. data/lib/generators/kiso_themes/analytics_dashboard_pages_generator.rb +16 -0
  453. data/lib/generators/kiso_themes/analytics_detail_pages_generator.rb +16 -0
  454. data/lib/generators/kiso_themes/app_pages_generator.rb +33 -0
  455. data/lib/generators/kiso_themes/blog_archive_pages_generator.rb +16 -0
  456. data/lib/generators/kiso_themes/blog_post_pages_generator.rb +16 -0
  457. data/lib/generators/kiso_themes/content_blocks_generator.rb +30 -0
  458. data/lib/generators/kiso_themes/customize_generator.rb +52 -0
  459. data/lib/generators/kiso_themes/dashboard_pages_generator.rb +37 -0
  460. data/lib/generators/kiso_themes/devise_generator.rb +45 -0
  461. data/lib/generators/kiso_themes/email_layout_generator.rb +41 -0
  462. data/lib/generators/kiso_themes/error_pages_generator.rb +19 -0
  463. data/lib/generators/kiso_themes/faq_pages_generator.rb +17 -0
  464. data/lib/generators/kiso_themes/handler_support.rb +27 -0
  465. data/lib/generators/kiso_themes/install_generator.rb +246 -0
  466. data/lib/generators/kiso_themes/landing_pages_generator.rb +16 -0
  467. data/lib/generators/kiso_themes/legal_pages_generator.rb +25 -0
  468. data/lib/generators/kiso_themes/page_generator.rb +37 -0
  469. data/lib/generators/kiso_themes/pricing_pages_generator.rb +10 -0
  470. data/lib/generators/kiso_themes/templates/README.tt +58 -0
  471. data/lib/generators/kiso_themes/templates/README_CUSTOMIZE +38 -0
  472. data/lib/generators/kiso_themes/templates/customizations/styles/auriga/blue.css.scss +120 -0
  473. data/lib/generators/kiso_themes/templates/customizations/styles/auriga/green.css.scss +120 -0
  474. data/lib/generators/kiso_themes/templates/customizations/styles/auriga/red.css.scss +120 -0
  475. data/lib/generators/kiso_themes/templates/customizations/styles/auriga/yellow.css.scss +120 -0
  476. data/lib/generators/kiso_themes/templates/customizations/styles/gemini/amber.css.scss +118 -0
  477. data/lib/generators/kiso_themes/templates/customizations/styles/gemini/blue.css.scss +118 -0
  478. data/lib/generators/kiso_themes/templates/customizations/styles/gemini/granite.css.scss +118 -0
  479. data/lib/generators/kiso_themes/templates/customizations/styles/gemini/ocean.css.scss +118 -0
  480. data/lib/generators/kiso_themes/templates/customizations/styles/lyra/azure.css.scss +119 -0
  481. data/lib/generators/kiso_themes/templates/customizations/styles/lyra/charcoal.css.scss +119 -0
  482. data/lib/generators/kiso_themes/templates/customizations/styles/lyra/lime.css.scss +119 -0
  483. data/lib/generators/kiso_themes/templates/customizations/styles/lyra/raspberry.css.scss +119 -0
  484. data/lib/generators/kiso_themes/templates/customizations/styles/orion/blue.css.scss +118 -0
  485. data/lib/generators/kiso_themes/templates/customizations/styles/orion/green.css.scss +118 -0
  486. data/lib/generators/kiso_themes/templates/customizations/styles/orion/orange.css.scss +118 -0
  487. data/lib/generators/kiso_themes/templates/customizations/styles/orion/purple.css.scss +118 -0
  488. data/lib/generators/kiso_themes/templates/error_pages/403.html.erb +66 -0
  489. data/lib/generators/kiso_themes/templates/error_pages/404.html.erb +67 -0
  490. data/lib/generators/kiso_themes/templates/error_pages/422.html.erb +66 -0
  491. data/lib/generators/kiso_themes/templates/error_pages/500.html.erb +67 -0
  492. data/lib/generators/kiso_themes/templates/kiso_themes.css +31 -0
  493. data/lib/generators/kiso_themes/templates/layouts/_app_nav.html.erb +124 -0
  494. data/lib/generators/kiso_themes/templates/layouts/_app_nav.html.haml +81 -0
  495. data/lib/generators/kiso_themes/templates/layouts/_app_nav.html.slim +81 -0
  496. data/lib/generators/kiso_themes/templates/layouts/_base.html.erb +34 -0
  497. data/lib/generators/kiso_themes/templates/layouts/_base.html.haml +19 -0
  498. data/lib/generators/kiso_themes/templates/layouts/_base.html.slim +19 -0
  499. data/lib/generators/kiso_themes/templates/layouts/_dashboard_top_nav.html.erb +134 -0
  500. data/lib/generators/kiso_themes/templates/layouts/_dashboard_top_nav.html.haml +87 -0
  501. data/lib/generators/kiso_themes/templates/layouts/_dashboard_top_nav.html.slim +87 -0
  502. data/lib/generators/kiso_themes/templates/layouts/_external_js_libs.html.erb +30 -0
  503. data/lib/generators/kiso_themes/templates/layouts/_external_js_libs.html.haml +17 -0
  504. data/lib/generators/kiso_themes/templates/layouts/_external_js_libs.html.slim +17 -0
  505. data/lib/generators/kiso_themes/templates/layouts/_flashes.html.erb +13 -0
  506. data/lib/generators/kiso_themes/templates/layouts/_flashes.html.haml +10 -0
  507. data/lib/generators/kiso_themes/templates/layouts/_flashes.html.slim +10 -0
  508. data/lib/generators/kiso_themes/templates/layouts/_side_menu.html.erb +66 -0
  509. data/lib/generators/kiso_themes/templates/layouts/_side_menu.html.haml +42 -0
  510. data/lib/generators/kiso_themes/templates/layouts/_side_menu.html.slim +42 -0
  511. data/lib/generators/kiso_themes/templates/layouts/_side_menu_header.html.erb +25 -0
  512. data/lib/generators/kiso_themes/templates/layouts/_side_menu_header.html.haml +16 -0
  513. data/lib/generators/kiso_themes/templates/layouts/_side_menu_header.html.slim +16 -0
  514. data/lib/generators/kiso_themes/templates/layouts/_side_menu_main_content.html.erb +0 -0
  515. data/lib/generators/kiso_themes/templates/layouts/_side_menu_main_content.html.haml +0 -0
  516. data/lib/generators/kiso_themes/templates/layouts/_side_menu_main_content.html.slim +1 -0
  517. data/lib/generators/kiso_themes/templates/layouts/application.html.erb +4 -0
  518. data/lib/generators/kiso_themes/templates/layouts/application.html.haml +3 -0
  519. data/lib/generators/kiso_themes/templates/layouts/application.html.slim +3 -0
  520. data/lib/generators/kiso_themes/templates/layouts/devise.html.erb +3 -0
  521. data/lib/generators/kiso_themes/templates/layouts/devise.html.haml +5 -0
  522. data/lib/generators/kiso_themes/templates/layouts/devise.html.slim +5 -0
  523. data/lib/generators/kiso_themes/templates/layouts/email.html.erb +68 -0
  524. data/lib/generators/kiso_themes/templates/layouts/email.html.haml +40 -0
  525. data/lib/generators/kiso_themes/templates/layouts/email.html.slim +40 -0
  526. data/lib/generators/kiso_themes/templates/layouts/landing.html.erb +3 -0
  527. data/lib/generators/kiso_themes/templates/layouts/landing.html.haml +2 -0
  528. data/lib/generators/kiso_themes/templates/layouts/landing.html.slim +2 -0
  529. data/lib/generators/kiso_themes/templates/layouts/scaffold.html.erb +25 -0
  530. data/lib/generators/kiso_themes/templates/layouts/scaffold.html.haml +15 -0
  531. data/lib/generators/kiso_themes/templates/layouts/scaffold.html.slim +15 -0
  532. data/lib/generators/kiso_themes/templates/layouts/sidenav.html.erb +33 -0
  533. data/lib/generators/kiso_themes/templates/layouts/sidenav.html.haml +19 -0
  534. data/lib/generators/kiso_themes/templates/layouts/sidenav.html.slim +19 -0
  535. data/lib/generators/kiso_themes/templates/rails6/index.js +39 -0
  536. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/bootstrap.js +20 -0
  537. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/bootstrap_switch.js +23 -0
  538. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/chartjs.js +11 -0
  539. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/clipboard.js +12 -0
  540. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/countTo.js +1 -0
  541. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/countdown.js +28 -0
  542. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/demo/chartjs.js +101 -0
  543. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/demo/dashboard.js +229 -0
  544. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/demo/data_generator.js +27 -0
  545. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/demo/easypiechart.js +41 -0
  546. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/demo/flot.js +258 -0
  547. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/demo/gmaps.js +163 -0
  548. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/demo/jqvectormap.js +65 -0
  549. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/demo/sparklines.js +156 -0
  550. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/easypiechart.js +12 -0
  551. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/fastclick.js +16 -0
  552. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/fitie.js +14 -0
  553. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/flot.js +11 -0
  554. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/forms.js +13 -0
  555. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/gmaps.js +9 -0
  556. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/header.js +33 -0
  557. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/inspect_mode/inspect_mode.js +580 -0
  558. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/jasny.js +13 -0
  559. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/jqvectormaps.js +24 -0
  560. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/kernel.js +48 -0
  561. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/metis_menu.js +16 -0
  562. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/parallax.js +14 -0
  563. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/popper.js +1 -0
  564. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/prettify.js +12 -0
  565. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/prism.js +10 -0
  566. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/sheets.js +98 -0
  567. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/sidenav.js +77 -0
  568. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/slimscroll.js +1 -0
  569. data/lib/generators/kiso_themes/templates/rails6/kiso_themes/sparklines.js +1 -0
  570. data/lib/generators/kiso_themes/templates/views/analytics/analytics_dashboard_1.html.erb +55 -0
  571. data/lib/generators/kiso_themes/templates/views/analytics/analytics_dashboard_1.html.haml +36 -0
  572. data/lib/generators/kiso_themes/templates/views/analytics/analytics_dashboard_1.html.slim +36 -0
  573. data/lib/generators/kiso_themes/templates/views/analytics/analytics_detail_1.html.erb +52 -0
  574. data/lib/generators/kiso_themes/templates/views/analytics/analytics_detail_1.html.haml +44 -0
  575. data/lib/generators/kiso_themes/templates/views/analytics/analytics_detail_1.html.slim +44 -0
  576. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_avatar_upload.html.erb +15 -0
  577. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_avatar_upload.html.haml +10 -0
  578. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_avatar_upload.html.slim +10 -0
  579. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_billing.html.erb +48 -0
  580. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_billing.html.haml +34 -0
  581. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_billing.html.slim +34 -0
  582. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_notifications.html.erb +59 -0
  583. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_notifications.html.haml +42 -0
  584. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_notifications.html.slim +42 -0
  585. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_plan.html.erb +70 -0
  586. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_plan.html.haml +47 -0
  587. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_plan.html.slim +47 -0
  588. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_profile.html.erb +65 -0
  589. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_profile.html.haml +51 -0
  590. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_profile.html.slim +51 -0
  591. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_support.html.erb +76 -0
  592. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_support.html.haml +50 -0
  593. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/_user_account/_support.html.slim +50 -0
  594. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/billing.html.erb +76 -0
  595. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/billing.html.haml +41 -0
  596. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/billing.html.slim +41 -0
  597. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/notifications.html.erb +76 -0
  598. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/notifications.html.haml +41 -0
  599. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/notifications.html.slim +41 -0
  600. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/plan.html.erb +76 -0
  601. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/plan.html.haml +41 -0
  602. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/plan.html.slim +41 -0
  603. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/profile.html.erb +75 -0
  604. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/profile.html.haml +41 -0
  605. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/profile.html.slim +41 -0
  606. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/support.html.erb +76 -0
  607. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/support.html.haml +41 -0
  608. data/lib/generators/kiso_themes/templates/views/app_pages/user_account/support.html.slim +41 -0
  609. data/lib/generators/kiso_themes/templates/views/dashboards/_bs_table.html.erb +61 -0
  610. data/lib/generators/kiso_themes/templates/views/dashboards/_bs_table.html.haml +50 -0
  611. data/lib/generators/kiso_themes/templates/views/dashboards/_bs_table.html.slim +50 -0
  612. data/lib/generators/kiso_themes/templates/views/dashboards/_metric_charts.html.erb +38 -0
  613. data/lib/generators/kiso_themes/templates/views/dashboards/_metric_charts.html.haml +25 -0
  614. data/lib/generators/kiso_themes/templates/views/dashboards/_metric_charts.html.slim +25 -0
  615. data/lib/generators/kiso_themes/templates/views/dashboards/_metrics_cards.html.erb +74 -0
  616. data/lib/generators/kiso_themes/templates/views/dashboards/_metrics_cards.html.haml +45 -0
  617. data/lib/generators/kiso_themes/templates/views/dashboards/_metrics_cards.html.slim +45 -0
  618. data/lib/generators/kiso_themes/templates/views/dashboards/_most_active_users.html.erb +137 -0
  619. data/lib/generators/kiso_themes/templates/views/dashboards/_most_active_users.html.haml +135 -0
  620. data/lib/generators/kiso_themes/templates/views/dashboards/_most_active_users.html.slim +135 -0
  621. data/lib/generators/kiso_themes/templates/views/dashboards/_online_users.html.erb +11 -0
  622. data/lib/generators/kiso_themes/templates/views/dashboards/_online_users.html.haml +7 -0
  623. data/lib/generators/kiso_themes/templates/views/dashboards/_online_users.html.slim +7 -0
  624. data/lib/generators/kiso_themes/templates/views/dashboards/_sales_refunds.html.erb +54 -0
  625. data/lib/generators/kiso_themes/templates/views/dashboards/_sales_refunds.html.haml +36 -0
  626. data/lib/generators/kiso_themes/templates/views/dashboards/_sales_refunds.html.slim +36 -0
  627. data/lib/generators/kiso_themes/templates/views/dashboards/_server_activity.html.erb +102 -0
  628. data/lib/generators/kiso_themes/templates/views/dashboards/_server_activity.html.haml +80 -0
  629. data/lib/generators/kiso_themes/templates/views/dashboards/_server_activity.html.slim +80 -0
  630. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_1.html.erb +11 -0
  631. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_1.html.haml +321 -0
  632. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_1.html.slim +321 -0
  633. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_2.html.erb +437 -0
  634. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_2.html.haml +306 -0
  635. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_2.html.slim +306 -0
  636. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_3.html.erb +148 -0
  637. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_3.html.haml +96 -0
  638. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_3.html.slim +96 -0
  639. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_4.html.erb +126 -0
  640. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_4.html.haml +77 -0
  641. data/lib/generators/kiso_themes/templates/views/dashboards/dashboard_4.html.slim +77 -0
  642. data/lib/generators/kiso_themes/templates/views/emails/_email_footer.html.erb +16 -0
  643. data/lib/generators/kiso_themes/templates/views/emails/_email_footer.html.haml +15 -0
  644. data/lib/generators/kiso_themes/templates/views/emails/_email_footer.html.slim +15 -0
  645. data/lib/generators/kiso_themes/templates/views/emails/_email_header.html.erb +20 -0
  646. data/lib/generators/kiso_themes/templates/views/emails/_email_header.html.haml +13 -0
  647. data/lib/generators/kiso_themes/templates/views/emails/_email_header.html.slim +13 -0
  648. data/lib/generators/kiso_themes/templates/views/frontend_pages/blog_pages/blog_archive_1.html.erb +92 -0
  649. data/lib/generators/kiso_themes/templates/views/frontend_pages/blog_pages/blog_archive_1.html.haml +80 -0
  650. data/lib/generators/kiso_themes/templates/views/frontend_pages/blog_pages/blog_archive_1.html.slim +80 -0
  651. data/lib/generators/kiso_themes/templates/views/frontend_pages/blog_pages/blog_post_1.html.erb +227 -0
  652. data/lib/generators/kiso_themes/templates/views/frontend_pages/blog_pages/blog_post_1.html.haml +168 -0
  653. data/lib/generators/kiso_themes/templates/views/frontend_pages/blog_pages/blog_post_1.html.slim +168 -0
  654. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/403.html.erb +17 -0
  655. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/403.html.haml +11 -0
  656. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/403.html.slim +11 -0
  657. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/404.html.erb +18 -0
  658. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/404.html.haml +11 -0
  659. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/404.html.slim +11 -0
  660. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/422.html.erb +18 -0
  661. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/422.html.haml +11 -0
  662. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/422.html.slim +11 -0
  663. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/500.html.erb +16 -0
  664. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/500.html.haml +10 -0
  665. data/lib/generators/kiso_themes/templates/views/frontend_pages/error_pages/500.html.slim +10 -0
  666. data/lib/generators/kiso_themes/templates/views/frontend_pages/faq_pages/faq_page_1.html.erb +103 -0
  667. data/lib/generators/kiso_themes/templates/views/frontend_pages/faq_pages/faq_page_1.html.haml +88 -0
  668. data/lib/generators/kiso_themes/templates/views/frontend_pages/faq_pages/faq_page_1.html.slim +88 -0
  669. data/lib/generators/kiso_themes/templates/views/frontend_pages/faq_pages/faq_page_2.html.erb +89 -0
  670. data/lib/generators/kiso_themes/templates/views/frontend_pages/faq_pages/faq_page_2.html.haml +57 -0
  671. data/lib/generators/kiso_themes/templates/views/frontend_pages/faq_pages/faq_page_2.html.slim +57 -0
  672. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_1.html.erb +41 -0
  673. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_1.html.haml +26 -0
  674. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_1.html.slim +26 -0
  675. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_2.html.erb +38 -0
  676. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_2.html.haml +23 -0
  677. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_2.html.slim +23 -0
  678. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_3.html.erb +185 -0
  679. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_3.html.haml +138 -0
  680. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_3.html.slim +138 -0
  681. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_4.html.erb +96 -0
  682. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_4.html.haml +58 -0
  683. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_4.html.slim +58 -0
  684. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_5.html.erb +26 -0
  685. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_5.html.haml +13 -0
  686. data/lib/generators/kiso_themes/templates/views/frontend_pages/landing_pages/landing_page_5.html.slim +13 -0
  687. data/lib/generators/kiso_themes/templates/views/frontend_pages/legal_pages/privacy_page.html.erb +159 -0
  688. data/lib/generators/kiso_themes/templates/views/frontend_pages/legal_pages/privacy_page.html.haml +100 -0
  689. data/lib/generators/kiso_themes/templates/views/frontend_pages/legal_pages/privacy_page.html.slim +100 -0
  690. data/lib/generators/kiso_themes/templates/views/frontend_pages/legal_pages/terms_of_service_page.html.erb +205 -0
  691. data/lib/generators/kiso_themes/templates/views/frontend_pages/legal_pages/terms_of_service_page.html.haml +206 -0
  692. data/lib/generators/kiso_themes/templates/views/frontend_pages/legal_pages/terms_of_service_page.html.slim +206 -0
  693. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_1.html.erb +64 -0
  694. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_1.html.haml +37 -0
  695. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_1.html.slim +37 -0
  696. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_2.html.erb +63 -0
  697. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_2.html.haml +36 -0
  698. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_2.html.slim +36 -0
  699. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_3.html.erb +63 -0
  700. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_3.html.haml +36 -0
  701. data/lib/generators/kiso_themes/templates/views/frontend_pages/pricing_pages/pricing_page_3.html.slim +36 -0
  702. data/lib/generators/kiso_themes/user_account_pages_generator.rb +47 -0
  703. data/lib/generators/rails/scaffold_controller_generator.rb +37 -0
  704. data/lib/generators/rails/templates/controller.rb +70 -0
  705. data/lib/kiso_themes/compatibility.rb +9 -0
  706. data/lib/kiso_themes/engine.rb +87 -0
  707. data/lib/kiso_themes/extensions/simple_form/errors_component.rb +13 -0
  708. data/lib/kiso_themes/extensions/simple_form/form_builder.rb +17 -0
  709. data/lib/kiso_themes/extensions/simple_form/required_component.rb +21 -0
  710. data/lib/kiso_themes/extensions/simple_form/setup.rb +201 -0
  711. data/lib/kiso_themes/extensions/simple_form.rb +4 -0
  712. data/lib/kiso_themes/extensions/will_paginate.rb +30 -0
  713. data/lib/kiso_themes/kiso_themes.rb +3 -0
  714. data/lib/kiso_themes/railtie.rb +7 -0
  715. data/lib/kiso_themes/version.rb +41 -0
  716. data/lib/kiso_themes.rb +1 -0
  717. data/lib/sass/kiso_themes/_core/_accordion.scss +27 -0
  718. data/lib/sass/kiso_themes/_core/_alerts.scss +150 -0
  719. data/lib/sass/kiso_themes/_core/_backgrounds.scss +108 -0
  720. data/lib/sass/kiso_themes/_core/_badges.scss +45 -0
  721. data/lib/sass/kiso_themes/_core/_blog.scss +17 -0
  722. data/lib/sass/kiso_themes/_core/_borders.scss +34 -0
  723. data/lib/sass/kiso_themes/_core/_breadcrumbs.scss +82 -0
  724. data/lib/sass/kiso_themes/_core/_buttons.scss +202 -0
  725. data/lib/sass/kiso_themes/_core/_cards.scss +166 -0
  726. data/lib/sass/kiso_themes/_core/_carousel.scss +15 -0
  727. data/lib/sass/kiso_themes/_core/_checkboxes-radio.scss +240 -0
  728. data/lib/sass/kiso_themes/_core/_dropdown.scss +225 -0
  729. data/lib/sass/kiso_themes/_core/_font_family.scss +1 -0
  730. data/lib/sass/kiso_themes/_core/_footers.scss +44 -0
  731. data/lib/sass/kiso_themes/_core/_grid.scss +9 -0
  732. data/lib/sass/kiso_themes/_core/_images.scss +7 -0
  733. data/lib/sass/kiso_themes/_core/_input_groups.scss +139 -0
  734. data/lib/sass/kiso_themes/_core/_inputs.scss +280 -0
  735. data/lib/sass/kiso_themes/_core/_landing_headers.scss +15 -0
  736. data/lib/sass/kiso_themes/_core/_listgroups.scss +16 -0
  737. data/lib/sass/kiso_themes/_core/_loaders.scss +690 -0
  738. data/lib/sass/kiso_themes/_core/_misc.scss +239 -0
  739. data/lib/sass/kiso_themes/_core/_mixins.scss +18 -0
  740. data/lib/sass/kiso_themes/_core/_modals.scss +190 -0
  741. data/lib/sass/kiso_themes/_core/_navbar.scss +260 -0
  742. data/lib/sass/kiso_themes/_core/_navs.scss +123 -0
  743. data/lib/sass/kiso_themes/_core/_page_components.scss +275 -0
  744. data/lib/sass/kiso_themes/_core/_pagination.scss +152 -0
  745. data/lib/sass/kiso_themes/_core/_pills.scss +131 -0
  746. data/lib/sass/kiso_themes/_core/_popover.scss +59 -0
  747. data/lib/sass/kiso_themes/_core/_pricing_tables.scss +111 -0
  748. data/lib/sass/kiso_themes/_core/_progress.scss +138 -0
  749. data/lib/sass/kiso_themes/_core/_responsive.scss +237 -0
  750. data/lib/sass/kiso_themes/_core/_scaffold.scss +6 -0
  751. data/lib/sass/kiso_themes/_core/_sidenav.scss +433 -0
  752. data/lib/sass/kiso_themes/_core/_simple_animations.scss +116 -0
  753. data/lib/sass/kiso_themes/_core/_tables.scss +22 -0
  754. data/lib/sass/kiso_themes/_core/_tabs.scss +162 -0
  755. data/lib/sass/kiso_themes/_core/_timelines.scss +54 -0
  756. data/lib/sass/kiso_themes/_core/_tooltips.scss +28 -0
  757. data/lib/sass/kiso_themes/_core/_typography.scss +400 -0
  758. data/lib/sass/kiso_themes/_core/_variables.scss +431 -0
  759. data/lib/sass/kiso_themes/_core/cards/_card_activity_feed.scss +84 -0
  760. data/lib/sass/kiso_themes/_core/cards/_card_chat.scss +93 -0
  761. data/lib/sass/kiso_themes/_core/cards/_card_images.scss +114 -0
  762. data/lib/sass/kiso_themes/_core/cards/_card_items.scss +72 -0
  763. data/lib/sass/kiso_themes/_core/cards/_card_metric.scss +134 -0
  764. data/lib/sass/kiso_themes/_core/cards/_card_sheet.scss +31 -0
  765. data/lib/sass/kiso_themes/_core/cards/_card_table.scss +28 -0
  766. data/lib/sass/kiso_themes/_core/cards/_card_tiles.scss +27 -0
  767. data/lib/sass/kiso_themes/_core/cards/_cards_mini.scss +142 -0
  768. data/lib/sass/kiso_themes/_core/devise/1.scss +40 -0
  769. data/lib/sass/kiso_themes/_core/landing_pages/landing_1.scss +6 -0
  770. data/lib/sass/kiso_themes/_core/landing_pages/landing_2.scss +35 -0
  771. data/lib/sass/kiso_themes/_core/landing_pages/landing_3.scss +11 -0
  772. data/lib/sass/kiso_themes/_core/landing_pages/landing_4.scss +10 -0
  773. data/lib/sass/kiso_themes/_core/landing_pages/landing_5.scss +11 -0
  774. data/lib/sass/kiso_themes/_core/mixins/_badges.scss +4 -0
  775. data/lib/sass/kiso_themes/_core/mixins/_buttons.scss +128 -0
  776. data/lib/sass/kiso_themes/_core/mixins/_colors.scss +17 -0
  777. data/lib/sass/kiso_themes/_core/mixins/_datepicker.scss +121 -0
  778. data/lib/sass/kiso_themes/_core/mixins/_dropdown.scss +30 -0
  779. data/lib/sass/kiso_themes/_core/mixins/_inputs.scss +117 -0
  780. data/lib/sass/kiso_themes/_core/mixins/_modals.scss +12 -0
  781. data/lib/sass/kiso_themes/_core/mixins/_navbar.scss +261 -0
  782. data/lib/sass/kiso_themes/_core/mixins/_pages.scss +7 -0
  783. data/lib/sass/kiso_themes/_core/mixins/_popovers.scss +29 -0
  784. data/lib/sass/kiso_themes/_core/mixins/_theme.scss +239 -0
  785. data/lib/sass/kiso_themes/_core/mixins/_transparency.scss +8 -0
  786. data/lib/sass/kiso_themes/_core/mixins/_vendor-prefixes.scss +317 -0
  787. data/lib/sass/kiso_themes/_core/plugins/_easy_pie_chart.scss +21 -0
  788. data/lib/sass/kiso_themes/_core/plugins/_jasny_bootstrap.scss +7 -0
  789. data/lib/sass/kiso_themes/_core/plugins/_jquery_sparklines.scss +6 -0
  790. data/lib/sass/kiso_themes/_core/plugins/_jqvectormap.scss +135 -0
  791. data/lib/sass/kiso_themes/_core/plugins/_plugin-bootstrap-switch.scss +220 -0
  792. data/lib/sass/kiso_themes/_core/plugins/_plugin-datepicker.scss +554 -0
  793. data/lib/sass/kiso_themes/_core/plugins/_plugin-nouislider.scss +351 -0
  794. data/lib/sass/kiso_themes/auriga/_cards.scss +3 -0
  795. data/lib/sass/kiso_themes/auriga/_font_family.scss +1 -0
  796. data/lib/sass/kiso_themes/auriga/_tables.scss +54 -0
  797. data/lib/sass/kiso_themes/auriga/styles/_blue_variables.scss +102 -0
  798. data/lib/sass/kiso_themes/auriga/styles/_green_variables.scss +82 -0
  799. data/lib/sass/kiso_themes/auriga/styles/_red_variables.scss +82 -0
  800. data/lib/sass/kiso_themes/auriga/styles/_yellow_variables.scss +82 -0
  801. data/lib/sass/kiso_themes/gemini/_font_family.scss +1 -0
  802. data/lib/sass/kiso_themes/gemini/styles/_amber_variables.scss +54 -0
  803. data/lib/sass/kiso_themes/gemini/styles/_blue_variables.scss +52 -0
  804. data/lib/sass/kiso_themes/gemini/styles/_granite_variables.scss +55 -0
  805. data/lib/sass/kiso_themes/gemini/styles/_ocean_variables.scss +54 -0
  806. data/lib/sass/kiso_themes/lyra/_font_family.scss +1 -0
  807. data/lib/sass/kiso_themes/lyra/styles/_azure_variables.scss +56 -0
  808. data/lib/sass/kiso_themes/lyra/styles/_charcoal_variables.scss +56 -0
  809. data/lib/sass/kiso_themes/lyra/styles/_lime_variables.scss +56 -0
  810. data/lib/sass/kiso_themes/lyra/styles/_raspberry_variables.scss +56 -0
  811. data/lib/sass/kiso_themes/orion/_font_family.scss +1 -0
  812. data/lib/sass/kiso_themes/orion/styles/_blue_variables.scss +71 -0
  813. data/lib/sass/kiso_themes/orion/styles/_green_variables.scss +56 -0
  814. data/lib/sass/kiso_themes/orion/styles/_orange_variables.scss +48 -0
  815. data/lib/sass/kiso_themes/orion/styles/_purple_variables.scss +57 -0
  816. data/lib/sass/vendor/bootstrap/_alert.scss +51 -0
  817. data/lib/sass/vendor/bootstrap/_badge.scss +54 -0
  818. data/lib/sass/vendor/bootstrap/_breadcrumb.scss +41 -0
  819. data/lib/sass/vendor/bootstrap/_button-group.scss +163 -0
  820. data/lib/sass/vendor/bootstrap/_buttons.scss +137 -0
  821. data/lib/sass/vendor/bootstrap/_card.scss +289 -0
  822. data/lib/sass/vendor/bootstrap/_carousel.scss +197 -0
  823. data/lib/sass/vendor/bootstrap/_close.scss +41 -0
  824. data/lib/sass/vendor/bootstrap/_code.scss +48 -0
  825. data/lib/sass/vendor/bootstrap/_custom-forms.scss +507 -0
  826. data/lib/sass/vendor/bootstrap/_dropdown.scss +191 -0
  827. data/lib/sass/vendor/bootstrap/_forms.scss +330 -0
  828. data/lib/sass/vendor/bootstrap/_functions.scss +86 -0
  829. data/lib/sass/vendor/bootstrap/_grid.scss +52 -0
  830. data/lib/sass/vendor/bootstrap/_images.scss +42 -0
  831. data/lib/sass/vendor/bootstrap/_input-group.scss +193 -0
  832. data/lib/sass/vendor/bootstrap/_jumbotron.scss +17 -0
  833. data/lib/sass/vendor/bootstrap/_list-group.scss +149 -0
  834. data/lib/sass/vendor/bootstrap/_media.scss +8 -0
  835. data/lib/sass/vendor/bootstrap/_mixins.scss +47 -0
  836. data/lib/sass/vendor/bootstrap/_modal.scss +229 -0
  837. data/lib/sass/vendor/bootstrap/_nav.scss +120 -0
  838. data/lib/sass/vendor/bootstrap/_navbar.scss +294 -0
  839. data/lib/sass/vendor/bootstrap/_pagination.scss +83 -0
  840. data/lib/sass/vendor/bootstrap/_popover.scss +171 -0
  841. data/lib/sass/vendor/bootstrap/_print.scss +141 -0
  842. data/lib/sass/vendor/bootstrap/_progress.scss +43 -0
  843. data/lib/sass/vendor/bootstrap/_reboot.scss +483 -0
  844. data/lib/sass/vendor/bootstrap/_root.scss +19 -0
  845. data/lib/sass/vendor/bootstrap/_spinners.scss +55 -0
  846. data/lib/sass/vendor/bootstrap/_tables.scss +185 -0
  847. data/lib/sass/vendor/bootstrap/_toasts.scss +44 -0
  848. data/lib/sass/vendor/bootstrap/_tooltip.scss +115 -0
  849. data/lib/sass/vendor/bootstrap/_transitions.scss +20 -0
  850. data/lib/sass/vendor/bootstrap/_type.scss +125 -0
  851. data/lib/sass/vendor/bootstrap/_utilities.scss +17 -0
  852. data/lib/sass/vendor/bootstrap/_variables.scss +1123 -0
  853. data/lib/sass/vendor/bootstrap/bootstrap-grid.scss +29 -0
  854. data/lib/sass/vendor/bootstrap/bootstrap-reboot.scss +12 -0
  855. data/lib/sass/vendor/bootstrap/bootstrap.scss +44 -0
  856. data/lib/sass/vendor/bootstrap/mixins/_alert.scss +13 -0
  857. data/lib/sass/vendor/bootstrap/mixins/_background-variant.scss +21 -0
  858. data/lib/sass/vendor/bootstrap/mixins/_badge.scss +17 -0
  859. data/lib/sass/vendor/bootstrap/mixins/_border-radius.scss +63 -0
  860. data/lib/sass/vendor/bootstrap/mixins/_box-shadow.scss +20 -0
  861. data/lib/sass/vendor/bootstrap/mixins/_breakpoints.scss +123 -0
  862. data/lib/sass/vendor/bootstrap/mixins/_buttons.scss +107 -0
  863. data/lib/sass/vendor/bootstrap/mixins/_caret.scss +62 -0
  864. data/lib/sass/vendor/bootstrap/mixins/_clearfix.scss +7 -0
  865. data/lib/sass/vendor/bootstrap/mixins/_deprecate.scss +10 -0
  866. data/lib/sass/vendor/bootstrap/mixins/_float.scss +14 -0
  867. data/lib/sass/vendor/bootstrap/mixins/_forms.scss +192 -0
  868. data/lib/sass/vendor/bootstrap/mixins/_gradients.scss +45 -0
  869. data/lib/sass/vendor/bootstrap/mixins/_grid-framework.scss +66 -0
  870. data/lib/sass/vendor/bootstrap/mixins/_grid.scss +51 -0
  871. data/lib/sass/vendor/bootstrap/mixins/_hover.scss +37 -0
  872. data/lib/sass/vendor/bootstrap/mixins/_image.scss +36 -0
  873. data/lib/sass/vendor/bootstrap/mixins/_list-group.scss +21 -0
  874. data/lib/sass/vendor/bootstrap/mixins/_lists.scss +7 -0
  875. data/lib/sass/vendor/bootstrap/mixins/_nav-divider.scss +10 -0
  876. data/lib/sass/vendor/bootstrap/mixins/_pagination.scss +22 -0
  877. data/lib/sass/vendor/bootstrap/mixins/_reset-text.scss +17 -0
  878. data/lib/sass/vendor/bootstrap/mixins/_resize.scss +6 -0
  879. data/lib/sass/vendor/bootstrap/mixins/_screen-reader.scss +33 -0
  880. data/lib/sass/vendor/bootstrap/mixins/_size.scss +7 -0
  881. data/lib/sass/vendor/bootstrap/mixins/_table-row.scss +39 -0
  882. data/lib/sass/vendor/bootstrap/mixins/_text-emphasis.scss +16 -0
  883. data/lib/sass/vendor/bootstrap/mixins/_text-hide.scss +11 -0
  884. data/lib/sass/vendor/bootstrap/mixins/_text-truncate.scss +8 -0
  885. data/lib/sass/vendor/bootstrap/mixins/_transition.scss +16 -0
  886. data/lib/sass/vendor/bootstrap/mixins/_visibility.scss +8 -0
  887. data/lib/sass/vendor/bootstrap/utilities/_align.scss +8 -0
  888. data/lib/sass/vendor/bootstrap/utilities/_background.scss +19 -0
  889. data/lib/sass/vendor/bootstrap/utilities/_borders.scss +75 -0
  890. data/lib/sass/vendor/bootstrap/utilities/_clearfix.scss +3 -0
  891. data/lib/sass/vendor/bootstrap/utilities/_display.scss +26 -0
  892. data/lib/sass/vendor/bootstrap/utilities/_embed.scss +39 -0
  893. data/lib/sass/vendor/bootstrap/utilities/_flex.scss +51 -0
  894. data/lib/sass/vendor/bootstrap/utilities/_float.scss +11 -0
  895. data/lib/sass/vendor/bootstrap/utilities/_overflow.scss +5 -0
  896. data/lib/sass/vendor/bootstrap/utilities/_position.scss +32 -0
  897. data/lib/sass/vendor/bootstrap/utilities/_screenreaders.scss +11 -0
  898. data/lib/sass/vendor/bootstrap/utilities/_shadows.scss +6 -0
  899. data/lib/sass/vendor/bootstrap/utilities/_sizing.scss +20 -0
  900. data/lib/sass/vendor/bootstrap/utilities/_spacing.scss +73 -0
  901. data/lib/sass/vendor/bootstrap/utilities/_stretched-link.scss +19 -0
  902. data/lib/sass/vendor/bootstrap/utilities/_text.scss +72 -0
  903. data/lib/sass/vendor/bootstrap/utilities/_visibility.scss +13 -0
  904. data/lib/sass/vendor/bootstrap/vendor/_rfs.scss +204 -0
  905. data/lib/sass/vendor/font_awesome/_animated.scss +34 -0
  906. data/lib/sass/vendor/font_awesome/_bordered-pulled.scss +25 -0
  907. data/lib/sass/vendor/font_awesome/_core.scss +12 -0
  908. data/lib/sass/vendor/font_awesome/_fixed-width.scss +6 -0
  909. data/lib/sass/vendor/font_awesome/_icons.scss +789 -0
  910. data/lib/sass/vendor/font_awesome/_larger.scss +13 -0
  911. data/lib/sass/vendor/font_awesome/_list.scss +19 -0
  912. data/lib/sass/vendor/font_awesome/_mixins.scss +60 -0
  913. data/lib/sass/vendor/font_awesome/_path.scss +14 -0
  914. data/lib/sass/vendor/font_awesome/_rotated-flipped.scss +20 -0
  915. data/lib/sass/vendor/font_awesome/_screen-reader.scss +5 -0
  916. data/lib/sass/vendor/font_awesome/_stacked.scss +20 -0
  917. data/lib/sass/vendor/font_awesome/_variables.scss +800 -0
  918. data/lib/sass/vendor/font_awesome/font-awesome.scss +18 -0
  919. data/lib/sass/vendor/ionicons/_ionicons-font.scss +27 -0
  920. data/lib/sass/vendor/ionicons/_ionicons-icons.scss +1473 -0
  921. data/lib/sass/vendor/ionicons/_ionicons-variables.scss +741 -0
  922. data/lib/sass/vendor/ionicons/ionicons.scss +15 -0
  923. data/lib/sass/vendor/mdiicons/_icons-material-design.scss +42 -0
  924. data/lib/sass/vendor/prism/twilight.css +198 -0
  925. data/lib/sass/vendor/themify/themify-icons.css +1082 -0
  926. data/lib/templates/erb/scaffold/_form.html.erb +50 -0
  927. data/lib/templates/erb/scaffold/edit.html.erb +37 -0
  928. data/lib/templates/erb/scaffold/index.html.erb +80 -0
  929. data/lib/templates/erb/scaffold/new.html.erb +37 -0
  930. data/lib/templates/erb/scaffold/show.html.erb +53 -0
  931. data/lib/templates/haml/scaffold/_form.html.haml +29 -0
  932. data/lib/templates/haml/scaffold/edit.html.haml +6 -0
  933. data/lib/templates/haml/scaffold/index.html.haml +41 -0
  934. data/lib/templates/haml/scaffold/new.html.haml +6 -0
  935. data/lib/templates/haml/scaffold/show.html.haml +16 -0
  936. data/lib/templates/slim/scaffold/_form.html.haml +29 -0
  937. data/lib/templates/slim/scaffold/edit.html.haml +6 -0
  938. data/lib/templates/slim/scaffold/index.html.haml +41 -0
  939. data/lib/templates/slim/scaffold/new.html.haml +6 -0
  940. data/lib/templates/slim/scaffold/show.html.haml +16 -0
  941. data/support/content_block_rewriter.rb +25 -0
  942. data/support/css_rewriter.rb +76 -0
  943. data/support/page_rewriter.rb +27 -0
  944. metadata +1091 -0
@@ -0,0 +1,1655 @@
1
+ // Copyright (C) 2006 Google Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+
16
+ /**
17
+ * @fileoverview
18
+ * some functions for browser-side pretty printing of code contained in html.
19
+ *
20
+ * <p>
21
+ * For a fairly comprehensive set of languages see the
22
+ * <a href="http://google-code-prettify.googlecode.com/svn/trunk/README.html#langs">README</a>
23
+ * file that came with this source. At a minimum, the lexer should work on a
24
+ * number of languages including C and friends, Java, Python, Bash, SQL, HTML,
25
+ * XML, CSS, Javascript, and Makefiles. It works passably on Ruby, PHP and Awk
26
+ * and a subset of Perl, but, because of commenting conventions, doesn't work on
27
+ * Smalltalk, Lisp-like, or CAML-like languages without an explicit lang class.
28
+ * <p>
29
+ * Usage: <ol>
30
+ * <li> include this source file in an html page via
31
+ * {@code <script type="text/javascript" src="/path/to/prettify.js"></script>}
32
+ * <li> define style rules. See the example page for examples.
33
+ * <li> mark the {@code <pre>} and {@code <code>} tags in your source with
34
+ * {@code class=prettyprint.}
35
+ * You can also use the (html deprecated) {@code <xmp>} tag, but the pretty
36
+ * printer needs to do more substantial DOM manipulations to support that, so
37
+ * some css styles may not be preserved.
38
+ * </ol>
39
+ * That's it. I wanted to keep the API as simple as possible, so there's no
40
+ * need to specify which language the code is in, but if you wish, you can add
41
+ * another class to the {@code <pre>} or {@code <code>} element to specify the
42
+ * language, as in {@code <pre class="prettyprint lang-java">}. Any class that
43
+ * starts with "lang-" followed by a file extension, specifies the file type.
44
+ * See the "lang-*.js" files in this directory for code that implements
45
+ * per-language file handlers.
46
+ * <p>
47
+ * Change log:<br>
48
+ * cbeust, 2006/08/22
49
+ * <blockquote>
50
+ * Java annotations (start with "@") are now captured as literals ("lit")
51
+ * </blockquote>
52
+ * @requires console
53
+ */
54
+
55
+ // JSLint declarations
56
+ /*global console, document, navigator, setTimeout, window, define */
57
+
58
+ /** @define {boolean} */
59
+ var IN_GLOBAL_SCOPE = true;
60
+
61
+ /**
62
+ * Split {@code prettyPrint} into multiple timeouts so as not to interfere with
63
+ * UI events.
64
+ * If set to {@code false}, {@code prettyPrint()} is synchronous.
65
+ */
66
+ window['PR_SHOULD_USE_CONTINUATION'] = true;
67
+
68
+ /**
69
+ * Pretty print a chunk of code.
70
+ * @param {string} sourceCodeHtml The HTML to pretty print.
71
+ * @param {string} opt_langExtension The language name to use.
72
+ * Typically, a filename extension like 'cpp' or 'java'.
73
+ * @param {number|boolean} opt_numberLines True to number lines,
74
+ * or the 1-indexed number of the first line in sourceCodeHtml.
75
+ * @return {string} code as html, but prettier
76
+ */
77
+ var prettyPrintOne;
78
+ /**
79
+ * Find all the {@code <pre>} and {@code <code>} tags in the DOM with
80
+ * {@code class=prettyprint} and prettify them.
81
+ *
82
+ * @param {Function} opt_whenDone called when prettifying is done.
83
+ * @param {HTMLElement|HTMLDocument} opt_root an element or document
84
+ * containing all the elements to pretty print.
85
+ * Defaults to {@code document.body}.
86
+ */
87
+ var prettyPrint;
88
+
89
+
90
+ (function () {
91
+ var win = window;
92
+ // Keyword lists for various languages.
93
+ // We use things that coerce to strings to make them compact when minified
94
+ // and to defeat aggressive optimizers that fold large string constants.
95
+ var FLOW_CONTROL_KEYWORDS = ["break,continue,do,else,for,if,return,while"];
96
+ var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," +
97
+ "double,enum,extern,float,goto,inline,int,long,register,short,signed," +
98
+ "sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];
99
+ var COMMON_KEYWORDS = [C_KEYWORDS,"catch,class,delete,false,import," +
100
+ "new,operator,private,protected,public,this,throw,true,try,typeof"];
101
+ var CPP_KEYWORDS = [COMMON_KEYWORDS,"alignof,align_union,asm,axiom,bool," +
102
+ "concept,concept_map,const_cast,constexpr,decltype,delegate," +
103
+ "dynamic_cast,explicit,export,friend,generic,late_check," +
104
+ "mutable,namespace,nullptr,property,reinterpret_cast,static_assert," +
105
+ "static_cast,template,typeid,typename,using,virtual,where"];
106
+ var JAVA_KEYWORDS = [COMMON_KEYWORDS,
107
+ "abstract,assert,boolean,byte,extends,final,finally,implements,import," +
108
+ "instanceof,interface,null,native,package,strictfp,super,synchronized," +
109
+ "throws,transient"];
110
+ var CSHARP_KEYWORDS = [COMMON_KEYWORDS,
111
+ "abstract,as,base,bool,by,byte,checked,decimal,delegate,descending," +
112
+ "dynamic,event,finally,fixed,foreach,from,group,implicit,in,interface," +
113
+ "internal,into,is,let,lock,null,object,out,override,orderby,params," +
114
+ "partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong," +
115
+ "unchecked,unsafe,ushort,var,virtual,where"];
116
+ var COFFEE_KEYWORDS = "all,and,by,catch,class,else,extends,false,finally," +
117
+ "for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then," +
118
+ "throw,true,try,unless,until,when,while,yes";
119
+ var JSCRIPT_KEYWORDS = [COMMON_KEYWORDS,
120
+ "debugger,eval,export,function,get,null,set,undefined,var,with," +
121
+ "Infinity,NaN"];
122
+ var PERL_KEYWORDS = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for," +
123
+ "goto,if,import,last,local,my,next,no,our,print,package,redo,require," +
124
+ "sub,undef,unless,until,use,wantarray,while,BEGIN,END";
125
+ var PYTHON_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "and,as,assert,class,def,del," +
126
+ "elif,except,exec,finally,from,global,import,in,is,lambda," +
127
+ "nonlocal,not,or,pass,print,raise,try,with,yield," +
128
+ "False,True,None"];
129
+ var RUBY_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "alias,and,begin,case,class," +
130
+ "def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," +
131
+ "rescue,retry,self,super,then,true,undef,unless,until,when,yield," +
132
+ "BEGIN,END"];
133
+ var RUST_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "as,assert,const,copy,drop," +
134
+ "enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv," +
135
+ "pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"];
136
+ var SH_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "case,done,elif,esac,eval,fi," +
137
+ "function,in,local,set,then,until"];
138
+ var ALL_KEYWORDS = [
139
+ CPP_KEYWORDS, CSHARP_KEYWORDS, JSCRIPT_KEYWORDS, PERL_KEYWORDS,
140
+ PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
141
+ var C_TYPES = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;
142
+
143
+ // token style names. correspond to css classes
144
+ /**
145
+ * token style for a string literal
146
+ * @const
147
+ */
148
+ var PR_STRING = 'str';
149
+ /**
150
+ * token style for a keyword
151
+ * @const
152
+ */
153
+ var PR_KEYWORD = 'kwd';
154
+ /**
155
+ * token style for a comment
156
+ * @const
157
+ */
158
+ var PR_COMMENT = 'com';
159
+ /**
160
+ * token style for a type
161
+ * @const
162
+ */
163
+ var PR_TYPE = 'typ';
164
+ /**
165
+ * token style for a literal value. e.g. 1, null, true.
166
+ * @const
167
+ */
168
+ var PR_LITERAL = 'lit';
169
+ /**
170
+ * token style for a punctuation string.
171
+ * @const
172
+ */
173
+ var PR_PUNCTUATION = 'pun';
174
+ /**
175
+ * token style for plain text.
176
+ * @const
177
+ */
178
+ var PR_PLAIN = 'pln';
179
+
180
+ /**
181
+ * token style for an sgml tag.
182
+ * @const
183
+ */
184
+ var PR_TAG = 'tag';
185
+ /**
186
+ * token style for a markup declaration such as a DOCTYPE.
187
+ * @const
188
+ */
189
+ var PR_DECLARATION = 'dec';
190
+ /**
191
+ * token style for embedded source.
192
+ * @const
193
+ */
194
+ var PR_SOURCE = 'src';
195
+ /**
196
+ * token style for an sgml attribute name.
197
+ * @const
198
+ */
199
+ var PR_ATTRIB_NAME = 'atn';
200
+ /**
201
+ * token style for an sgml attribute value.
202
+ * @const
203
+ */
204
+ var PR_ATTRIB_VALUE = 'atv';
205
+
206
+ /**
207
+ * A class that indicates a section of markup that is not code, e.g. to allow
208
+ * embedding of line numbers within code listings.
209
+ * @const
210
+ */
211
+ var PR_NOCODE = 'nocode';
212
+
213
+
214
+
215
+ /**
216
+ * A set of tokens that can precede a regular expression literal in
217
+ * javascript
218
+ * http://web.archive.org/web/20070717142515/http://www.mozilla.org/js/language/js20/rationale/syntax.html
219
+ * has the full list, but I've removed ones that might be problematic when
220
+ * seen in languages that don't support regular expression literals.
221
+ *
222
+ * <p>Specifically, I've removed any keywords that can't precede a regexp
223
+ * literal in a syntactically legal javascript program, and I've removed the
224
+ * "in" keyword since it's not a keyword in many languages, and might be used
225
+ * as a count of inches.
226
+ *
227
+ * <p>The link above does not accurately describe EcmaScript rules since
228
+ * it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
229
+ * very well in practice.
230
+ *
231
+ * @private
232
+ * @const
233
+ */
234
+ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*';
235
+
236
+ // CAVEAT: this does not properly handle the case where a regular
237
+ // expression immediately follows another since a regular expression may
238
+ // have flags for case-sensitivity and the like. Having regexp tokens
239
+ // adjacent is not valid in any language I'm aware of, so I'm punting.
240
+ // TODO: maybe style special characters inside a regexp as punctuation.
241
+
242
+ /**
243
+ * Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
244
+ * matches the union of the sets of strings matched by the input RegExp.
245
+ * Since it matches globally, if the input strings have a start-of-input
246
+ * anchor (/^.../), it is ignored for the purposes of unioning.
247
+ * @param {Array.<RegExp>} regexs non multiline, non-global regexs.
248
+ * @return {RegExp} a global regex.
249
+ */
250
+ function combinePrefixPatterns(regexs) {
251
+ var capturedGroupIndex = 0;
252
+
253
+ var needToFoldCase = false;
254
+ var ignoreCase = false;
255
+ for (var i = 0, n = regexs.length; i < n; ++i) {
256
+ var regex = regexs[i];
257
+ if (regex.ignoreCase) {
258
+ ignoreCase = true;
259
+ } else if (/[a-z]/i.test(regex.source.replace(
260
+ /\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
261
+ needToFoldCase = true;
262
+ ignoreCase = false;
263
+ break;
264
+ }
265
+ }
266
+
267
+ var escapeCharToCodeUnit = {
268
+ 'b': 8,
269
+ 't': 9,
270
+ 'n': 0xa,
271
+ 'v': 0xb,
272
+ 'f': 0xc,
273
+ 'r': 0xd
274
+ };
275
+
276
+ function decodeEscape(charsetPart) {
277
+ var cc0 = charsetPart.charCodeAt(0);
278
+ if (cc0 !== 92 /* \\ */) {
279
+ return cc0;
280
+ }
281
+ var c1 = charsetPart.charAt(1);
282
+ cc0 = escapeCharToCodeUnit[c1];
283
+ if (cc0) {
284
+ return cc0;
285
+ } else if ('0' <= c1 && c1 <= '7') {
286
+ return parseInt(charsetPart.substring(1), 8);
287
+ } else if (c1 === 'u' || c1 === 'x') {
288
+ return parseInt(charsetPart.substring(2), 16);
289
+ } else {
290
+ return charsetPart.charCodeAt(1);
291
+ }
292
+ }
293
+
294
+ function encodeEscape(charCode) {
295
+ if (charCode < 0x20) {
296
+ return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
297
+ }
298
+ var ch = String.fromCharCode(charCode);
299
+ return (ch === '\\' || ch === '-' || ch === ']' || ch === '^')
300
+ ? "\\" + ch : ch;
301
+ }
302
+
303
+ function caseFoldCharset(charSet) {
304
+ var charsetParts = charSet.substring(1, charSet.length - 1).match(
305
+ new RegExp(
306
+ '\\\\u[0-9A-Fa-f]{4}'
307
+ + '|\\\\x[0-9A-Fa-f]{2}'
308
+ + '|\\\\[0-3][0-7]{0,2}'
309
+ + '|\\\\[0-7]{1,2}'
310
+ + '|\\\\[\\s\\S]'
311
+ + '|-'
312
+ + '|[^-\\\\]',
313
+ 'g'));
314
+ var ranges = [];
315
+ var inverse = charsetParts[0] === '^';
316
+
317
+ var out = ['['];
318
+ if (inverse) { out.push('^'); }
319
+
320
+ for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
321
+ var p = charsetParts[i];
322
+ if (/\\[bdsw]/i.test(p)) { // Don't muck with named groups.
323
+ out.push(p);
324
+ } else {
325
+ var start = decodeEscape(p);
326
+ var end;
327
+ if (i + 2 < n && '-' === charsetParts[i + 1]) {
328
+ end = decodeEscape(charsetParts[i + 2]);
329
+ i += 2;
330
+ } else {
331
+ end = start;
332
+ }
333
+ ranges.push([start, end]);
334
+ // If the range might intersect letters, then expand it.
335
+ // This case handling is too simplistic.
336
+ // It does not deal with non-latin case folding.
337
+ // It works for latin source code identifiers though.
338
+ if (!(end < 65 || start > 122)) {
339
+ if (!(end < 65 || start > 90)) {
340
+ ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
341
+ }
342
+ if (!(end < 97 || start > 122)) {
343
+ ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
344
+ }
345
+ }
346
+ }
347
+ }
348
+
349
+ // [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
350
+ // -> [[1, 12], [14, 14], [16, 17]]
351
+ ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); });
352
+ var consolidatedRanges = [];
353
+ var lastRange = [];
354
+ for (var i = 0; i < ranges.length; ++i) {
355
+ var range = ranges[i];
356
+ if (range[0] <= lastRange[1] + 1) {
357
+ lastRange[1] = Math.max(lastRange[1], range[1]);
358
+ } else {
359
+ consolidatedRanges.push(lastRange = range);
360
+ }
361
+ }
362
+
363
+ for (var i = 0; i < consolidatedRanges.length; ++i) {
364
+ var range = consolidatedRanges[i];
365
+ out.push(encodeEscape(range[0]));
366
+ if (range[1] > range[0]) {
367
+ if (range[1] + 1 > range[0]) { out.push('-'); }
368
+ out.push(encodeEscape(range[1]));
369
+ }
370
+ }
371
+ out.push(']');
372
+ return out.join('');
373
+ }
374
+
375
+ function allowAnywhereFoldCaseAndRenumberGroups(regex) {
376
+ // Split into character sets, escape sequences, punctuation strings
377
+ // like ('(', '(?:', ')', '^'), and runs of characters that do not
378
+ // include any of the above.
379
+ var parts = regex.source.match(
380
+ new RegExp(
381
+ '(?:'
382
+ + '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]' // a character set
383
+ + '|\\\\u[A-Fa-f0-9]{4}' // a unicode escape
384
+ + '|\\\\x[A-Fa-f0-9]{2}' // a hex escape
385
+ + '|\\\\[0-9]+' // a back-reference or octal escape
386
+ + '|\\\\[^ux0-9]' // other escape sequence
387
+ + '|\\(\\?[:!=]' // start of a non-capturing group
388
+ + '|[\\(\\)\\^]' // start/end of a group, or line start
389
+ + '|[^\\x5B\\x5C\\(\\)\\^]+' // run of other characters
390
+ + ')',
391
+ 'g'));
392
+ var n = parts.length;
393
+
394
+ // Maps captured group numbers to the number they will occupy in
395
+ // the output or to -1 if that has not been determined, or to
396
+ // undefined if they need not be capturing in the output.
397
+ var capturedGroups = [];
398
+
399
+ // Walk over and identify back references to build the capturedGroups
400
+ // mapping.
401
+ for (var i = 0, groupIndex = 0; i < n; ++i) {
402
+ var p = parts[i];
403
+ if (p === '(') {
404
+ // groups are 1-indexed, so max group index is count of '('
405
+ ++groupIndex;
406
+ } else if ('\\' === p.charAt(0)) {
407
+ var decimalValue = +p.substring(1);
408
+ if (decimalValue) {
409
+ if (decimalValue <= groupIndex) {
410
+ capturedGroups[decimalValue] = -1;
411
+ } else {
412
+ // Replace with an unambiguous escape sequence so that
413
+ // an octal escape sequence does not turn into a backreference
414
+ // to a capturing group from an earlier regex.
415
+ parts[i] = encodeEscape(decimalValue);
416
+ }
417
+ }
418
+ }
419
+ }
420
+
421
+ // Renumber groups and reduce capturing groups to non-capturing groups
422
+ // where possible.
423
+ for (var i = 1; i < capturedGroups.length; ++i) {
424
+ if (-1 === capturedGroups[i]) {
425
+ capturedGroups[i] = ++capturedGroupIndex;
426
+ }
427
+ }
428
+ for (var i = 0, groupIndex = 0; i < n; ++i) {
429
+ var p = parts[i];
430
+ if (p === '(') {
431
+ ++groupIndex;
432
+ if (!capturedGroups[groupIndex]) {
433
+ parts[i] = '(?:';
434
+ }
435
+ } else if ('\\' === p.charAt(0)) {
436
+ var decimalValue = +p.substring(1);
437
+ if (decimalValue && decimalValue <= groupIndex) {
438
+ parts[i] = '\\' + capturedGroups[decimalValue];
439
+ }
440
+ }
441
+ }
442
+
443
+ // Remove any prefix anchors so that the output will match anywhere.
444
+ // ^^ really does mean an anchored match though.
445
+ for (var i = 0; i < n; ++i) {
446
+ if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
447
+ }
448
+
449
+ // Expand letters to groups to handle mixing of case-sensitive and
450
+ // case-insensitive patterns if necessary.
451
+ if (regex.ignoreCase && needToFoldCase) {
452
+ for (var i = 0; i < n; ++i) {
453
+ var p = parts[i];
454
+ var ch0 = p.charAt(0);
455
+ if (p.length >= 2 && ch0 === '[') {
456
+ parts[i] = caseFoldCharset(p);
457
+ } else if (ch0 !== '\\') {
458
+ // TODO: handle letters in numeric escapes.
459
+ parts[i] = p.replace(
460
+ /[a-zA-Z]/g,
461
+ function (ch) {
462
+ var cc = ch.charCodeAt(0);
463
+ return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
464
+ });
465
+ }
466
+ }
467
+ }
468
+
469
+ return parts.join('');
470
+ }
471
+
472
+ var rewritten = [];
473
+ for (var i = 0, n = regexs.length; i < n; ++i) {
474
+ var regex = regexs[i];
475
+ if (regex.global || regex.multiline) { throw new Error('' + regex); }
476
+ rewritten.push(
477
+ '(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
478
+ }
479
+
480
+ return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
481
+ }
482
+
483
+ /**
484
+ * Split markup into a string of source code and an array mapping ranges in
485
+ * that string to the text nodes in which they appear.
486
+ *
487
+ * <p>
488
+ * The HTML DOM structure:</p>
489
+ * <pre>
490
+ * (Element "p"
491
+ * (Element "b"
492
+ * (Text "print ")) ; #1
493
+ * (Text "'Hello '") ; #2
494
+ * (Element "br") ; #3
495
+ * (Text " + 'World';")) ; #4
496
+ * </pre>
497
+ * <p>
498
+ * corresponds to the HTML
499
+ * {@code <p><b>print </b>'Hello '<br> + 'World';</p>}.</p>
500
+ *
501
+ * <p>
502
+ * It will produce the output:</p>
503
+ * <pre>
504
+ * {
505
+ * sourceCode: "print 'Hello '\n + 'World';",
506
+ * // 1 2
507
+ * // 012345678901234 5678901234567
508
+ * spans: [0, #1, 6, #2, 14, #3, 15, #4]
509
+ * }
510
+ * </pre>
511
+ * <p>
512
+ * where #1 is a reference to the {@code "print "} text node above, and so
513
+ * on for the other text nodes.
514
+ * </p>
515
+ *
516
+ * <p>
517
+ * The {@code} spans array is an array of pairs. Even elements are the start
518
+ * indices of substrings, and odd elements are the text nodes (or BR elements)
519
+ * that contain the text for those substrings.
520
+ * Substrings continue until the next index or the end of the source.
521
+ * </p>
522
+ *
523
+ * @param {Node} node an HTML DOM subtree containing source-code.
524
+ * @param {boolean} isPreformatted true if white-space in text nodes should
525
+ * be considered significant.
526
+ * @return {Object} source code and the text nodes in which they occur.
527
+ */
528
+ function extractSourceSpans(node, isPreformatted) {
529
+ var nocode = /(?:^|\s)nocode(?:\s|$)/;
530
+
531
+ var chunks = [];
532
+ var length = 0;
533
+ var spans = [];
534
+ var k = 0;
535
+
536
+ function walk(node) {
537
+ var type = node.nodeType;
538
+ if (type == 1) { // Element
539
+ if (nocode.test(node.className)) { return; }
540
+ for (var child = node.firstChild; child; child = child.nextSibling) {
541
+ walk(child);
542
+ }
543
+ var nodeName = node.nodeName.toLowerCase();
544
+ if ('br' === nodeName || 'li' === nodeName) {
545
+ chunks[k] = '\n';
546
+ spans[k << 1] = length++;
547
+ spans[(k++ << 1) | 1] = node;
548
+ }
549
+ } else if (type == 3 || type == 4) { // Text
550
+ var text = node.nodeValue;
551
+ if (text.length) {
552
+ if (!isPreformatted) {
553
+ text = text.replace(/[ \t\r\n]+/g, ' ');
554
+ } else {
555
+ text = text.replace(/\r\n?/g, '\n'); // Normalize newlines.
556
+ }
557
+ // TODO: handle tabs here?
558
+ chunks[k] = text;
559
+ spans[k << 1] = length;
560
+ length += text.length;
561
+ spans[(k++ << 1) | 1] = node;
562
+ }
563
+ }
564
+ }
565
+
566
+ walk(node);
567
+
568
+ return {
569
+ sourceCode: chunks.join('').replace(/\n$/, ''),
570
+ spans: spans
571
+ };
572
+ }
573
+
574
+ /**
575
+ * Apply the given language handler to sourceCode and add the resulting
576
+ * decorations to out.
577
+ * @param {number} basePos the index of sourceCode within the chunk of source
578
+ * whose decorations are already present on out.
579
+ */
580
+ function appendDecorations(basePos, sourceCode, langHandler, out) {
581
+ if (!sourceCode) { return; }
582
+ var job = {
583
+ sourceCode: sourceCode,
584
+ basePos: basePos
585
+ };
586
+ langHandler(job);
587
+ out.push.apply(out, job.decorations);
588
+ }
589
+
590
+ var notWs = /\S/;
591
+
592
+ /**
593
+ * Given an element, if it contains only one child element and any text nodes
594
+ * it contains contain only space characters, return the sole child element.
595
+ * Otherwise returns undefined.
596
+ * <p>
597
+ * This is meant to return the CODE element in {@code <pre><code ...>} when
598
+ * there is a single child element that contains all the non-space textual
599
+ * content, but not to return anything where there are multiple child elements
600
+ * as in {@code <pre><code>...</code><code>...</code></pre>} or when there
601
+ * is textual content.
602
+ */
603
+ function childContentWrapper(element) {
604
+ var wrapper = undefined;
605
+ for (var c = element.firstChild; c; c = c.nextSibling) {
606
+ var type = c.nodeType;
607
+ wrapper = (type === 1) // Element Node
608
+ ? (wrapper ? element : c)
609
+ : (type === 3) // Text Node
610
+ ? (notWs.test(c.nodeValue) ? element : wrapper)
611
+ : wrapper;
612
+ }
613
+ return wrapper === element ? undefined : wrapper;
614
+ }
615
+
616
+ /** Given triples of [style, pattern, context] returns a lexing function,
617
+ * The lexing function interprets the patterns to find token boundaries and
618
+ * returns a decoration list of the form
619
+ * [index_0, style_0, index_1, style_1, ..., index_n, style_n]
620
+ * where index_n is an index into the sourceCode, and style_n is a style
621
+ * constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
622
+ * all characters in sourceCode[index_n-1:index_n].
623
+ *
624
+ * The stylePatterns is a list whose elements have the form
625
+ * [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
626
+ *
627
+ * Style is a style constant like PR_PLAIN, or can be a string of the
628
+ * form 'lang-FOO', where FOO is a language extension describing the
629
+ * language of the portion of the token in $1 after pattern executes.
630
+ * E.g., if style is 'lang-lisp', and group 1 contains the text
631
+ * '(hello (world))', then that portion of the token will be passed to the
632
+ * registered lisp handler for formatting.
633
+ * The text before and after group 1 will be restyled using this decorator
634
+ * so decorators should take care that this doesn't result in infinite
635
+ * recursion. For example, the HTML lexer rule for SCRIPT elements looks
636
+ * something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
637
+ * '<script>foo()<\/script>', which would cause the current decorator to
638
+ * be called with '<script>' which would not match the same rule since
639
+ * group 1 must not be empty, so it would be instead styled as PR_TAG by
640
+ * the generic tag rule. The handler registered for the 'js' extension would
641
+ * then be called with 'foo()', and finally, the current decorator would
642
+ * be called with '<\/script>' which would not match the original rule and
643
+ * so the generic tag rule would identify it as a tag.
644
+ *
645
+ * Pattern must only match prefixes, and if it matches a prefix, then that
646
+ * match is considered a token with the same style.
647
+ *
648
+ * Context is applied to the last non-whitespace, non-comment token
649
+ * recognized.
650
+ *
651
+ * Shortcut is an optional string of characters, any of which, if the first
652
+ * character, gurantee that this pattern and only this pattern matches.
653
+ *
654
+ * @param {Array} shortcutStylePatterns patterns that always start with
655
+ * a known character. Must have a shortcut string.
656
+ * @param {Array} fallthroughStylePatterns patterns that will be tried in
657
+ * order if the shortcut ones fail. May have shortcuts.
658
+ *
659
+ * @return {function (Object)} a
660
+ * function that takes source code and returns a list of decorations.
661
+ */
662
+ function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns) {
663
+ var shortcuts = {};
664
+ var tokenizer;
665
+ (function () {
666
+ var allPatterns = shortcutStylePatterns.concat(fallthroughStylePatterns);
667
+ var allRegexs = [];
668
+ var regexKeys = {};
669
+ for (var i = 0, n = allPatterns.length; i < n; ++i) {
670
+ var patternParts = allPatterns[i];
671
+ var shortcutChars = patternParts[3];
672
+ if (shortcutChars) {
673
+ for (var c = shortcutChars.length; --c >= 0;) {
674
+ shortcuts[shortcutChars.charAt(c)] = patternParts;
675
+ }
676
+ }
677
+ var regex = patternParts[1];
678
+ var k = '' + regex;
679
+ if (!regexKeys.hasOwnProperty(k)) {
680
+ allRegexs.push(regex);
681
+ regexKeys[k] = null;
682
+ }
683
+ }
684
+ allRegexs.push(/[\0-\uffff]/);
685
+ tokenizer = combinePrefixPatterns(allRegexs);
686
+ })();
687
+
688
+ var nPatterns = fallthroughStylePatterns.length;
689
+
690
+ /**
691
+ * Lexes job.sourceCode and produces an output array job.decorations of
692
+ * style classes preceded by the position at which they start in
693
+ * job.sourceCode in order.
694
+ *
695
+ * @param {Object} job an object like <pre>{
696
+ * sourceCode: {string} sourceText plain text,
697
+ * basePos: {int} position of job.sourceCode in the larger chunk of
698
+ * sourceCode.
699
+ * }</pre>
700
+ */
701
+ var decorate = function (job) {
702
+ var sourceCode = job.sourceCode, basePos = job.basePos;
703
+ /** Even entries are positions in source in ascending order. Odd enties
704
+ * are style markers (e.g., PR_COMMENT) that run from that position until
705
+ * the end.
706
+ * @type {Array.<number|string>}
707
+ */
708
+ var decorations = [basePos, PR_PLAIN];
709
+ var pos = 0; // index into sourceCode
710
+ var tokens = sourceCode.match(tokenizer) || [];
711
+ var styleCache = {};
712
+
713
+ for (var ti = 0, nTokens = tokens.length; ti < nTokens; ++ti) {
714
+ var token = tokens[ti];
715
+ var style = styleCache[token];
716
+ var match = void 0;
717
+
718
+ var isEmbedded;
719
+ if (typeof style === 'string') {
720
+ isEmbedded = false;
721
+ } else {
722
+ var patternParts = shortcuts[token.charAt(0)];
723
+ if (patternParts) {
724
+ match = token.match(patternParts[1]);
725
+ style = patternParts[0];
726
+ } else {
727
+ for (var i = 0; i < nPatterns; ++i) {
728
+ patternParts = fallthroughStylePatterns[i];
729
+ match = token.match(patternParts[1]);
730
+ if (match) {
731
+ style = patternParts[0];
732
+ break;
733
+ }
734
+ }
735
+
736
+ if (!match) { // make sure that we make progress
737
+ style = PR_PLAIN;
738
+ }
739
+ }
740
+
741
+ isEmbedded = style.length >= 5 && 'lang-' === style.substring(0, 5);
742
+ if (isEmbedded && !(match && typeof match[1] === 'string')) {
743
+ isEmbedded = false;
744
+ style = PR_SOURCE;
745
+ }
746
+
747
+ if (!isEmbedded) { styleCache[token] = style; }
748
+ }
749
+
750
+ var tokenStart = pos;
751
+ pos += token.length;
752
+
753
+ if (!isEmbedded) {
754
+ decorations.push(basePos + tokenStart, style);
755
+ } else { // Treat group 1 as an embedded block of source code.
756
+ var embeddedSource = match[1];
757
+ var embeddedSourceStart = token.indexOf(embeddedSource);
758
+ var embeddedSourceEnd = embeddedSourceStart + embeddedSource.length;
759
+ if (match[2]) {
760
+ // If embeddedSource can be blank, then it would match at the
761
+ // beginning which would cause us to infinitely recurse on the
762
+ // entire token, so we catch the right context in match[2].
763
+ embeddedSourceEnd = token.length - match[2].length;
764
+ embeddedSourceStart = embeddedSourceEnd - embeddedSource.length;
765
+ }
766
+ var lang = style.substring(5);
767
+ // Decorate the left of the embedded source
768
+ appendDecorations(
769
+ basePos + tokenStart,
770
+ token.substring(0, embeddedSourceStart),
771
+ decorate, decorations);
772
+ // Decorate the embedded source
773
+ appendDecorations(
774
+ basePos + tokenStart + embeddedSourceStart,
775
+ embeddedSource,
776
+ langHandlerForExtension(lang, embeddedSource),
777
+ decorations);
778
+ // Decorate the right of the embedded section
779
+ appendDecorations(
780
+ basePos + tokenStart + embeddedSourceEnd,
781
+ token.substring(embeddedSourceEnd),
782
+ decorate, decorations);
783
+ }
784
+ }
785
+ job.decorations = decorations;
786
+ };
787
+ return decorate;
788
+ }
789
+
790
+ /** returns a function that produces a list of decorations from source text.
791
+ *
792
+ * This code treats ", ', and ` as string delimiters, and \ as a string
793
+ * escape. It does not recognize perl's qq() style strings.
794
+ * It has no special handling for double delimiter escapes as in basic, or
795
+ * the tripled delimiters used in python, but should work on those regardless
796
+ * although in those cases a single string literal may be broken up into
797
+ * multiple adjacent string literals.
798
+ *
799
+ * It recognizes C, C++, and shell style comments.
800
+ *
801
+ * @param {Object} options a set of optional parameters.
802
+ * @return {function (Object)} a function that examines the source code
803
+ * in the input job and builds the decoration list.
804
+ */
805
+ function sourceDecorator(options) {
806
+ var shortcutStylePatterns = [], fallthroughStylePatterns = [];
807
+ if (options['tripleQuotedStrings']) {
808
+ // '''multi-line-string''', 'single-line-string', and double-quoted
809
+ shortcutStylePatterns.push(
810
+ [PR_STRING, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
811
+ null, '\'"']);
812
+ } else if (options['multiLineStrings']) {
813
+ // 'multi-line-string', "multi-line-string"
814
+ shortcutStylePatterns.push(
815
+ [PR_STRING, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,
816
+ null, '\'"`']);
817
+ } else {
818
+ // 'single-line-string', "single-line-string"
819
+ shortcutStylePatterns.push(
820
+ [PR_STRING,
821
+ /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,
822
+ null, '"\'']);
823
+ }
824
+ if (options['verbatimStrings']) {
825
+ // verbatim-string-literal production from the C# grammar. See issue 93.
826
+ fallthroughStylePatterns.push(
827
+ [PR_STRING, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null]);
828
+ }
829
+ var hc = options['hashComments'];
830
+ if (hc) {
831
+ if (options['cStyleComments']) {
832
+ if (hc > 1) { // multiline hash comments
833
+ shortcutStylePatterns.push(
834
+ [PR_COMMENT, /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, null, '#']);
835
+ } else {
836
+ // Stop C preprocessor declarations at an unclosed open comment
837
+ shortcutStylePatterns.push(
838
+ [PR_COMMENT, /^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,
839
+ null, '#']);
840
+ }
841
+ // #include <stdio.h>
842
+ fallthroughStylePatterns.push(
843
+ [PR_STRING,
844
+ /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,
845
+ null]);
846
+ } else {
847
+ shortcutStylePatterns.push([PR_COMMENT, /^#[^\r\n]*/, null, '#']);
848
+ }
849
+ }
850
+ if (options['cStyleComments']) {
851
+ fallthroughStylePatterns.push([PR_COMMENT, /^\/\/[^\r\n]*/, null]);
852
+ fallthroughStylePatterns.push(
853
+ [PR_COMMENT, /^\/\*[\s\S]*?(?:\*\/|$)/, null]);
854
+ }
855
+ var regexLiterals = options['regexLiterals'];
856
+ if (regexLiterals) {
857
+ /**
858
+ * @const
859
+ */
860
+ var regexExcls = regexLiterals > 1
861
+ ? '' // Multiline regex literals
862
+ : '\n\r';
863
+ /**
864
+ * @const
865
+ */
866
+ var regexAny = regexExcls ? '.' : '[\\S\\s]';
867
+ /**
868
+ * @const
869
+ */
870
+ var REGEX_LITERAL = (
871
+ // A regular expression literal starts with a slash that is
872
+ // not followed by * or / so that it is not confused with
873
+ // comments.
874
+ '/(?=[^/*' + regexExcls + '])'
875
+ // and then contains any number of raw characters,
876
+ + '(?:[^/\\x5B\\x5C' + regexExcls + ']'
877
+ // escape sequences (\x5C),
878
+ + '|\\x5C' + regexAny
879
+ // or non-nesting character sets (\x5B\x5D);
880
+ + '|\\x5B(?:[^\\x5C\\x5D' + regexExcls + ']'
881
+ + '|\\x5C' + regexAny + ')*(?:\\x5D|$))+'
882
+ // finally closed by a /.
883
+ + '/');
884
+ fallthroughStylePatterns.push(
885
+ ['lang-regex',
886
+ RegExp('^' + REGEXP_PRECEDER_PATTERN + '(' + REGEX_LITERAL + ')')
887
+ ]);
888
+ }
889
+
890
+ var types = options['types'];
891
+ if (types) {
892
+ fallthroughStylePatterns.push([PR_TYPE, types]);
893
+ }
894
+
895
+ var keywords = ("" + options['keywords']).replace(/^ | $/g, '');
896
+ if (keywords.length) {
897
+ fallthroughStylePatterns.push(
898
+ [PR_KEYWORD,
899
+ new RegExp('^(?:' + keywords.replace(/[\s,]+/g, '|') + ')\\b'),
900
+ null]);
901
+ }
902
+
903
+ shortcutStylePatterns.push([PR_PLAIN, /^\s+/, null, ' \r\n\t\xA0']);
904
+
905
+ var punctuation =
906
+ // The Bash man page says
907
+
908
+ // A word is a sequence of characters considered as a single
909
+ // unit by GRUB. Words are separated by metacharacters,
910
+ // which are the following plus space, tab, and newline: { }
911
+ // | & $ ; < >
912
+ // ...
913
+
914
+ // A word beginning with # causes that word and all remaining
915
+ // characters on that line to be ignored.
916
+
917
+ // which means that only a '#' after /(?:^|[{}|&$;<>\s])/ starts a
918
+ // comment but empirically
919
+ // $ echo {#}
920
+ // {#}
921
+ // $ echo \$#
922
+ // $#
923
+ // $ echo }#
924
+ // }#
925
+
926
+ // so /(?:^|[|&;<>\s])/ is more appropriate.
927
+
928
+ // http://gcc.gnu.org/onlinedocs/gcc-2.95.3/cpp_1.html#SEC3
929
+ // suggests that this definition is compatible with a
930
+ // default mode that tries to use a single token definition
931
+ // to recognize both bash/python style comments and C
932
+ // preprocessor directives.
933
+
934
+ // This definition of punctuation does not include # in the list of
935
+ // follow-on exclusions, so # will not be broken before if preceeded
936
+ // by a punctuation character. We could try to exclude # after
937
+ // [|&;<>] but that doesn't seem to cause many major problems.
938
+ // If that does turn out to be a problem, we should change the below
939
+ // when hc is truthy to include # in the run of punctuation characters
940
+ // only when not followint [|&;<>].
941
+ '^.[^\\s\\w.$@\'"`/\\\\]*';
942
+ if (options['regexLiterals']) {
943
+ punctuation += '(?!\s*\/)';
944
+ }
945
+
946
+ fallthroughStylePatterns.push(
947
+ // TODO(mikesamuel): recognize non-latin letters and numerals in idents
948
+ [PR_LITERAL, /^@[a-z_$][a-z_$@0-9]*/i, null],
949
+ [PR_TYPE, /^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/, null],
950
+ [PR_PLAIN, /^[a-z_$][a-z_$@0-9]*/i, null],
951
+ [PR_LITERAL,
952
+ new RegExp(
953
+ '^(?:'
954
+ // A hex number
955
+ + '0x[a-f0-9]+'
956
+ // or an octal or decimal number,
957
+ + '|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)'
958
+ // possibly in scientific notation
959
+ + '(?:e[+\\-]?\\d+)?'
960
+ + ')'
961
+ // with an optional modifier like UL for unsigned long
962
+ + '[a-z]*', 'i'),
963
+ null, '0123456789'],
964
+ // Don't treat escaped quotes in bash as starting strings.
965
+ // See issue 144.
966
+ [PR_PLAIN, /^\\[\s\S]?/, null],
967
+ [PR_PUNCTUATION, new RegExp(punctuation), null]);
968
+
969
+ return createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns);
970
+ }
971
+
972
+ var decorateSource = sourceDecorator({
973
+ 'keywords': ALL_KEYWORDS,
974
+ 'hashComments': true,
975
+ 'cStyleComments': true,
976
+ 'multiLineStrings': true,
977
+ 'regexLiterals': true
978
+ });
979
+
980
+ /**
981
+ * Given a DOM subtree, wraps it in a list, and puts each line into its own
982
+ * list item.
983
+ *
984
+ * @param {Node} node modified in place. Its content is pulled into an
985
+ * HTMLOListElement, and each line is moved into a separate list item.
986
+ * This requires cloning elements, so the input might not have unique
987
+ * IDs after numbering.
988
+ * @param {boolean} isPreformatted true iff white-space in text nodes should
989
+ * be treated as significant.
990
+ */
991
+ function numberLines(node, opt_startLineNum, isPreformatted) {
992
+ var nocode = /(?:^|\s)nocode(?:\s|$)/;
993
+ var lineBreak = /\r\n?|\n/;
994
+
995
+ var document = node.ownerDocument;
996
+
997
+ var li = document.createElement('li');
998
+ while (node.firstChild) {
999
+ li.appendChild(node.firstChild);
1000
+ }
1001
+ // An array of lines. We split below, so this is initialized to one
1002
+ // un-split line.
1003
+ var listItems = [li];
1004
+
1005
+ function walk(node) {
1006
+ var type = node.nodeType;
1007
+ if (type == 1 && !nocode.test(node.className)) { // Element
1008
+ if ('br' === node.nodeName) {
1009
+ breakAfter(node);
1010
+ // Discard the <BR> since it is now flush against a </LI>.
1011
+ if (node.parentNode) {
1012
+ node.parentNode.removeChild(node);
1013
+ }
1014
+ } else {
1015
+ for (var child = node.firstChild; child; child = child.nextSibling) {
1016
+ walk(child);
1017
+ }
1018
+ }
1019
+ } else if ((type == 3 || type == 4) && isPreformatted) { // Text
1020
+ var text = node.nodeValue;
1021
+ var match = text.match(lineBreak);
1022
+ if (match) {
1023
+ var firstLine = text.substring(0, match.index);
1024
+ node.nodeValue = firstLine;
1025
+ var tail = text.substring(match.index + match[0].length);
1026
+ if (tail) {
1027
+ var parent = node.parentNode;
1028
+ parent.insertBefore(
1029
+ document.createTextNode(tail), node.nextSibling);
1030
+ }
1031
+ breakAfter(node);
1032
+ if (!firstLine) {
1033
+ // Don't leave blank text nodes in the DOM.
1034
+ node.parentNode.removeChild(node);
1035
+ }
1036
+ }
1037
+ }
1038
+ }
1039
+
1040
+ // Split a line after the given node.
1041
+ function breakAfter(lineEndNode) {
1042
+ // If there's nothing to the right, then we can skip ending the line
1043
+ // here, and move root-wards since splitting just before an end-tag
1044
+ // would require us to create a bunch of empty copies.
1045
+ while (!lineEndNode.nextSibling) {
1046
+ lineEndNode = lineEndNode.parentNode;
1047
+ if (!lineEndNode) { return; }
1048
+ }
1049
+
1050
+ function breakLeftOf(limit, copy) {
1051
+ // Clone shallowly if this node needs to be on both sides of the break.
1052
+ var rightSide = copy ? limit.cloneNode(false) : limit;
1053
+ var parent = limit.parentNode;
1054
+ if (parent) {
1055
+ // We clone the parent chain.
1056
+ // This helps us resurrect important styling elements that cross lines.
1057
+ // E.g. in <i>Foo<br>Bar</i>
1058
+ // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>.
1059
+ var parentClone = breakLeftOf(parent, 1);
1060
+ // Move the clone and everything to the right of the original
1061
+ // onto the cloned parent.
1062
+ var next = limit.nextSibling;
1063
+ parentClone.appendChild(rightSide);
1064
+ for (var sibling = next; sibling; sibling = next) {
1065
+ next = sibling.nextSibling;
1066
+ parentClone.appendChild(sibling);
1067
+ }
1068
+ }
1069
+ return rightSide;
1070
+ }
1071
+
1072
+ var copiedListItem = breakLeftOf(lineEndNode.nextSibling, 0);
1073
+
1074
+ // Walk the parent chain until we reach an unattached LI.
1075
+ for (var parent;
1076
+ // Check nodeType since IE invents document fragments.
1077
+ (parent = copiedListItem.parentNode) && parent.nodeType === 1;) {
1078
+ copiedListItem = parent;
1079
+ }
1080
+ // Put it on the list of lines for later processing.
1081
+ listItems.push(copiedListItem);
1082
+ }
1083
+
1084
+ // Split lines while there are lines left to split.
1085
+ for (var i = 0; // Number of lines that have been split so far.
1086
+ i < listItems.length; // length updated by breakAfter calls.
1087
+ ++i) {
1088
+ walk(listItems[i]);
1089
+ }
1090
+
1091
+ // Make sure numeric indices show correctly.
1092
+ if (opt_startLineNum === (opt_startLineNum|0)) {
1093
+ listItems[0].setAttribute('value', opt_startLineNum);
1094
+ }
1095
+
1096
+ var ol = document.createElement('ol');
1097
+ ol.className = 'linenums';
1098
+ var offset = Math.max(0, ((opt_startLineNum - 1 /* zero index */)) | 0) || 0;
1099
+ for (var i = 0, n = listItems.length; i < n; ++i) {
1100
+ li = listItems[i];
1101
+ // Stick a class on the LIs so that stylesheets can
1102
+ // color odd/even rows, or any other row pattern that
1103
+ // is co-prime with 10.
1104
+ li.className = 'L' + ((i + offset) % 10);
1105
+ if (!li.firstChild) {
1106
+ li.appendChild(document.createTextNode('\xA0'));
1107
+ }
1108
+ ol.appendChild(li);
1109
+ }
1110
+
1111
+ node.appendChild(ol);
1112
+ }
1113
+ /**
1114
+ * Breaks {@code job.sourceCode} around style boundaries in
1115
+ * {@code job.decorations} and modifies {@code job.sourceNode} in place.
1116
+ * @param {Object} job like <pre>{
1117
+ * sourceCode: {string} source as plain text,
1118
+ * sourceNode: {HTMLElement} the element containing the source,
1119
+ * spans: {Array.<number|Node>} alternating span start indices into source
1120
+ * and the text node or element (e.g. {@code <BR>}) corresponding to that
1121
+ * span.
1122
+ * decorations: {Array.<number|string} an array of style classes preceded
1123
+ * by the position at which they start in job.sourceCode in order
1124
+ * }</pre>
1125
+ * @private
1126
+ */
1127
+ function recombineTagsAndDecorations(job) {
1128
+ var isIE8OrEarlier = /\bMSIE\s(\d+)/.exec(navigator.userAgent);
1129
+ isIE8OrEarlier = isIE8OrEarlier && +isIE8OrEarlier[1] <= 8;
1130
+ var newlineRe = /\n/g;
1131
+
1132
+ var source = job.sourceCode;
1133
+ var sourceLength = source.length;
1134
+ // Index into source after the last code-unit recombined.
1135
+ var sourceIndex = 0;
1136
+
1137
+ var spans = job.spans;
1138
+ var nSpans = spans.length;
1139
+ // Index into spans after the last span which ends at or before sourceIndex.
1140
+ var spanIndex = 0;
1141
+
1142
+ var decorations = job.decorations;
1143
+ var nDecorations = decorations.length;
1144
+ // Index into decorations after the last decoration which ends at or before
1145
+ // sourceIndex.
1146
+ var decorationIndex = 0;
1147
+
1148
+ // Remove all zero-length decorations.
1149
+ decorations[nDecorations] = sourceLength;
1150
+ var decPos, i;
1151
+ for (i = decPos = 0; i < nDecorations;) {
1152
+ if (decorations[i] !== decorations[i + 2]) {
1153
+ decorations[decPos++] = decorations[i++];
1154
+ decorations[decPos++] = decorations[i++];
1155
+ } else {
1156
+ i += 2;
1157
+ }
1158
+ }
1159
+ nDecorations = decPos;
1160
+
1161
+ // Simplify decorations.
1162
+ for (i = decPos = 0; i < nDecorations;) {
1163
+ var startPos = decorations[i];
1164
+ // Conflate all adjacent decorations that use the same style.
1165
+ var startDec = decorations[i + 1];
1166
+ var end = i + 2;
1167
+ while (end + 2 <= nDecorations && decorations[end + 1] === startDec) {
1168
+ end += 2;
1169
+ }
1170
+ decorations[decPos++] = startPos;
1171
+ decorations[decPos++] = startDec;
1172
+ i = end;
1173
+ }
1174
+
1175
+ nDecorations = decorations.length = decPos;
1176
+
1177
+ var sourceNode = job.sourceNode;
1178
+ var oldDisplay;
1179
+ if (sourceNode) {
1180
+ oldDisplay = sourceNode.style.display;
1181
+ sourceNode.style.display = 'none';
1182
+ }
1183
+ try {
1184
+ var decoration = null;
1185
+ while (spanIndex < nSpans) {
1186
+ var spanStart = spans[spanIndex];
1187
+ var spanEnd = spans[spanIndex + 2] || sourceLength;
1188
+
1189
+ var decEnd = decorations[decorationIndex + 2] || sourceLength;
1190
+
1191
+ var end = Math.min(spanEnd, decEnd);
1192
+
1193
+ var textNode = spans[spanIndex + 1];
1194
+ var styledText;
1195
+ if (textNode.nodeType !== 1 // Don't muck with <BR>s or <LI>s
1196
+ // Don't introduce spans around empty text nodes.
1197
+ && (styledText = source.substring(sourceIndex, end))) {
1198
+ // This may seem bizarre, and it is. Emitting LF on IE causes the
1199
+ // code to display with spaces instead of line breaks.
1200
+ // Emitting Windows standard issue linebreaks (CRLF) causes a blank
1201
+ // space to appear at the beginning of every line but the first.
1202
+ // Emitting an old Mac OS 9 line separator makes everything spiffy.
1203
+ if (isIE8OrEarlier) {
1204
+ styledText = styledText.replace(newlineRe, '\r');
1205
+ }
1206
+ textNode.nodeValue = styledText;
1207
+ var document = textNode.ownerDocument;
1208
+ var span = document.createElement('span');
1209
+ span.className = decorations[decorationIndex + 1];
1210
+ var parentNode = textNode.parentNode;
1211
+ parentNode.replaceChild(span, textNode);
1212
+ span.appendChild(textNode);
1213
+ if (sourceIndex < spanEnd) { // Split off a text node.
1214
+ spans[spanIndex + 1] = textNode
1215
+ // TODO: Possibly optimize by using '' if there's no flicker.
1216
+ = document.createTextNode(source.substring(end, spanEnd));
1217
+ parentNode.insertBefore(textNode, span.nextSibling);
1218
+ }
1219
+ }
1220
+
1221
+ sourceIndex = end;
1222
+
1223
+ if (sourceIndex >= spanEnd) {
1224
+ spanIndex += 2;
1225
+ }
1226
+ if (sourceIndex >= decEnd) {
1227
+ decorationIndex += 2;
1228
+ }
1229
+ }
1230
+ } finally {
1231
+ if (sourceNode) {
1232
+ sourceNode.style.display = oldDisplay;
1233
+ }
1234
+ }
1235
+ }
1236
+
1237
+ /** Maps language-specific file extensions to handlers. */
1238
+ var langHandlerRegistry = {};
1239
+ /** Register a language handler for the given file extensions.
1240
+ * @param {function (Object)} handler a function from source code to a list
1241
+ * of decorations. Takes a single argument job which describes the
1242
+ * state of the computation. The single parameter has the form
1243
+ * {@code {
1244
+ * sourceCode: {string} as plain text.
1245
+ * decorations: {Array.<number|string>} an array of style classes
1246
+ * preceded by the position at which they start in
1247
+ * job.sourceCode in order.
1248
+ * The language handler should assigned this field.
1249
+ * basePos: {int} the position of source in the larger source chunk.
1250
+ * All positions in the output decorations array are relative
1251
+ * to the larger source chunk.
1252
+ * } }
1253
+ * @param {Array.<string>} fileExtensions
1254
+ */
1255
+ function registerLangHandler(handler, fileExtensions) {
1256
+ for (var i = fileExtensions.length; --i >= 0;) {
1257
+ var ext = fileExtensions[i];
1258
+ if (!langHandlerRegistry.hasOwnProperty(ext)) {
1259
+ langHandlerRegistry[ext] = handler;
1260
+ } else if (win['console']) {
1261
+ console['warn']('cannot override language handler %s', ext);
1262
+ }
1263
+ }
1264
+ }
1265
+ function langHandlerForExtension(extension, source) {
1266
+ if (!(extension && langHandlerRegistry.hasOwnProperty(extension))) {
1267
+ // Treat it as markup if the first non whitespace character is a < and
1268
+ // the last non-whitespace character is a >.
1269
+ extension = /^\s*</.test(source)
1270
+ ? 'default-markup'
1271
+ : 'default-code';
1272
+ }
1273
+ return langHandlerRegistry[extension];
1274
+ }
1275
+ registerLangHandler(decorateSource, ['default-code']);
1276
+ registerLangHandler(
1277
+ createSimpleLexer(
1278
+ [],
1279
+ [
1280
+ [PR_PLAIN, /^[^<?]+/],
1281
+ [PR_DECLARATION, /^<!\w[^>]*(?:>|$)/],
1282
+ [PR_COMMENT, /^<\!--[\s\S]*?(?:-\->|$)/],
1283
+ // Unescaped content in an unknown language
1284
+ ['lang-', /^<\?([\s\S]+?)(?:\?>|$)/],
1285
+ ['lang-', /^<%([\s\S]+?)(?:%>|$)/],
1286
+ [PR_PUNCTUATION, /^(?:<[%?]|[%?]>)/],
1287
+ ['lang-', /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],
1288
+ // Unescaped content in javascript. (Or possibly vbscript).
1289
+ ['lang-js', /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],
1290
+ // Contains unescaped stylesheet content
1291
+ ['lang-css', /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],
1292
+ ['lang-in.tag', /^(<\/?[a-z][^<>]*>)/i]
1293
+ ]),
1294
+ ['default-markup', 'htm', 'html', 'mxml', 'xhtml', 'xml', 'xsl']);
1295
+ registerLangHandler(
1296
+ createSimpleLexer(
1297
+ [
1298
+ [PR_PLAIN, /^[\s]+/, null, ' \t\r\n'],
1299
+ [PR_ATTRIB_VALUE, /^(?:\"[^\"]*\"?|\'[^\']*\'?)/, null, '\"\'']
1300
+ ],
1301
+ [
1302
+ [PR_TAG, /^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],
1303
+ [PR_ATTRIB_NAME, /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],
1304
+ ['lang-uq.val', /^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],
1305
+ [PR_PUNCTUATION, /^[=<>\/]+/],
1306
+ ['lang-js', /^on\w+\s*=\s*\"([^\"]+)\"/i],
1307
+ ['lang-js', /^on\w+\s*=\s*\'([^\']+)\'/i],
1308
+ ['lang-js', /^on\w+\s*=\s*([^\"\'>\s]+)/i],
1309
+ ['lang-css', /^style\s*=\s*\"([^\"]+)\"/i],
1310
+ ['lang-css', /^style\s*=\s*\'([^\']+)\'/i],
1311
+ ['lang-css', /^style\s*=\s*([^\"\'>\s]+)/i]
1312
+ ]),
1313
+ ['in.tag']);
1314
+ registerLangHandler(
1315
+ createSimpleLexer([], [[PR_ATTRIB_VALUE, /^[\s\S]+/]]), ['uq.val']);
1316
+ registerLangHandler(sourceDecorator({
1317
+ 'keywords': CPP_KEYWORDS,
1318
+ 'hashComments': true,
1319
+ 'cStyleComments': true,
1320
+ 'types': C_TYPES
1321
+ }), ['c', 'cc', 'cpp', 'cxx', 'cyc', 'm']);
1322
+ registerLangHandler(sourceDecorator({
1323
+ 'keywords': 'null,true,false'
1324
+ }), ['json']);
1325
+ registerLangHandler(sourceDecorator({
1326
+ 'keywords': CSHARP_KEYWORDS,
1327
+ 'hashComments': true,
1328
+ 'cStyleComments': true,
1329
+ 'verbatimStrings': true,
1330
+ 'types': C_TYPES
1331
+ }), ['cs']);
1332
+ registerLangHandler(sourceDecorator({
1333
+ 'keywords': JAVA_KEYWORDS,
1334
+ 'cStyleComments': true
1335
+ }), ['java']);
1336
+ registerLangHandler(sourceDecorator({
1337
+ 'keywords': SH_KEYWORDS,
1338
+ 'hashComments': true,
1339
+ 'multiLineStrings': true
1340
+ }), ['bash', 'bsh', 'csh', 'sh']);
1341
+ registerLangHandler(sourceDecorator({
1342
+ 'keywords': PYTHON_KEYWORDS,
1343
+ 'hashComments': true,
1344
+ 'multiLineStrings': true,
1345
+ 'tripleQuotedStrings': true
1346
+ }), ['cv', 'py', 'python']);
1347
+ registerLangHandler(sourceDecorator({
1348
+ 'keywords': PERL_KEYWORDS,
1349
+ 'hashComments': true,
1350
+ 'multiLineStrings': true,
1351
+ 'regexLiterals': 2 // multiline regex literals
1352
+ }), ['perl', 'pl', 'pm']);
1353
+ registerLangHandler(sourceDecorator({
1354
+ 'keywords': RUBY_KEYWORDS,
1355
+ 'hashComments': true,
1356
+ 'multiLineStrings': true,
1357
+ 'regexLiterals': true
1358
+ }), ['rb', 'ruby']);
1359
+ registerLangHandler(sourceDecorator({
1360
+ 'keywords': JSCRIPT_KEYWORDS,
1361
+ 'cStyleComments': true,
1362
+ 'regexLiterals': true
1363
+ }), ['javascript', 'js']);
1364
+ registerLangHandler(sourceDecorator({
1365
+ 'keywords': COFFEE_KEYWORDS,
1366
+ 'hashComments': 3, // ### style block comments
1367
+ 'cStyleComments': true,
1368
+ 'multilineStrings': true,
1369
+ 'tripleQuotedStrings': true,
1370
+ 'regexLiterals': true
1371
+ }), ['coffee']);
1372
+ registerLangHandler(sourceDecorator({
1373
+ 'keywords': RUST_KEYWORDS,
1374
+ 'cStyleComments': true,
1375
+ 'multilineStrings': true
1376
+ }), ['rc', 'rs', 'rust']);
1377
+ registerLangHandler(
1378
+ createSimpleLexer([], [[PR_STRING, /^[\s\S]+/]]), ['regex']);
1379
+
1380
+ function applyDecorator(job) {
1381
+ var opt_langExtension = job.langExtension;
1382
+
1383
+ try {
1384
+ // Extract tags, and convert the source code to plain text.
1385
+ var sourceAndSpans = extractSourceSpans(job.sourceNode, job.pre);
1386
+ /** Plain text. @type {string} */
1387
+ var source = sourceAndSpans.sourceCode;
1388
+ job.sourceCode = source;
1389
+ job.spans = sourceAndSpans.spans;
1390
+ job.basePos = 0;
1391
+
1392
+ // Apply the appropriate language handler
1393
+ langHandlerForExtension(opt_langExtension, source)(job);
1394
+
1395
+ // Integrate the decorations and tags back into the source code,
1396
+ // modifying the sourceNode in place.
1397
+ recombineTagsAndDecorations(job);
1398
+ } catch (e) {
1399
+ if (win['console']) {
1400
+ console['log'](e && e['stack'] || e);
1401
+ }
1402
+ }
1403
+ }
1404
+
1405
+ /**
1406
+ * Pretty print a chunk of code.
1407
+ * @param sourceCodeHtml {string} The HTML to pretty print.
1408
+ * @param opt_langExtension {string} The language name to use.
1409
+ * Typically, a filename extension like 'cpp' or 'java'.
1410
+ * @param opt_numberLines {number|boolean} True to number lines,
1411
+ * or the 1-indexed number of the first line in sourceCodeHtml.
1412
+ */
1413
+ function $prettyPrintOne(sourceCodeHtml, opt_langExtension, opt_numberLines) {
1414
+ var container = document.createElement('div');
1415
+ // This could cause images to load and onload listeners to fire.
1416
+ // E.g. <img onerror="alert(1337)" src="nosuchimage.png">.
1417
+ // We assume that the inner HTML is from a trusted source.
1418
+ // The pre-tag is required for IE8 which strips newlines from innerHTML
1419
+ // when it is injected into a <pre> tag.
1420
+ // http://stackoverflow.com/questions/451486/pre-tag-loses-line-breaks-when-setting-innerhtml-in-ie
1421
+ // http://stackoverflow.com/questions/195363/inserting-a-newline-into-a-pre-tag-ie-javascript
1422
+ container.innerHTML = '<pre>' + sourceCodeHtml + '</pre>';
1423
+ container = container.firstChild;
1424
+ if (opt_numberLines) {
1425
+ numberLines(container, opt_numberLines, true);
1426
+ }
1427
+
1428
+ var job = {
1429
+ langExtension: opt_langExtension,
1430
+ numberLines: opt_numberLines,
1431
+ sourceNode: container,
1432
+ pre: 1
1433
+ };
1434
+ applyDecorator(job);
1435
+ return container.innerHTML;
1436
+ }
1437
+
1438
+ /**
1439
+ * Find all the {@code <pre>} and {@code <code>} tags in the DOM with
1440
+ * {@code class=prettyprint} and prettify them.
1441
+ *
1442
+ * @param {Function} opt_whenDone called when prettifying is done.
1443
+ * @param {HTMLElement|HTMLDocument} opt_root an element or document
1444
+ * containing all the elements to pretty print.
1445
+ * Defaults to {@code document.body}.
1446
+ */
1447
+ function $prettyPrint(opt_whenDone, opt_root) {
1448
+ var root = opt_root || document.body;
1449
+ var doc = root.ownerDocument || document;
1450
+ function byTagName(tn) { return root.getElementsByTagName(tn); }
1451
+ // fetch a list of nodes to rewrite
1452
+ var codeSegments = [byTagName('pre'), byTagName('code'), byTagName('xmp')];
1453
+ var elements = [];
1454
+ for (var i = 0; i < codeSegments.length; ++i) {
1455
+ for (var j = 0, n = codeSegments[i].length; j < n; ++j) {
1456
+ elements.push(codeSegments[i][j]);
1457
+ }
1458
+ }
1459
+ codeSegments = null;
1460
+
1461
+ var clock = Date;
1462
+ if (!clock['now']) {
1463
+ clock = { 'now': function () { return +(new Date); } };
1464
+ }
1465
+
1466
+ // The loop is broken into a series of continuations to make sure that we
1467
+ // don't make the browser unresponsive when rewriting a large page.
1468
+ var k = 0;
1469
+ var prettyPrintingJob;
1470
+
1471
+ var langExtensionRe = /\blang(?:uage)?-([\w.]+)(?!\S)/;
1472
+ var prettyPrintRe = /\bprettyprint\b/;
1473
+ var prettyPrintedRe = /\bprettyprinted\b/;
1474
+ var preformattedTagNameRe = /pre|xmp/i;
1475
+ var codeRe = /^code$/i;
1476
+ var preCodeXmpRe = /^(?:pre|code|xmp)$/i;
1477
+ var EMPTY = {};
1478
+
1479
+ function doWork() {
1480
+ var endTime = (win['PR_SHOULD_USE_CONTINUATION'] ?
1481
+ clock['now']() + 250 /* ms */ :
1482
+ Infinity);
1483
+ for (; k < elements.length && clock['now']() < endTime; k++) {
1484
+ var cs = elements[k];
1485
+
1486
+ // Look for a preceding comment like
1487
+ // <?prettify lang="..." linenums="..."?>
1488
+ var attrs = EMPTY;
1489
+ {
1490
+ for (var preceder = cs; (preceder = preceder.previousSibling);) {
1491
+ var nt = preceder.nodeType;
1492
+ // <?foo?> is parsed by HTML 5 to a comment node (8)
1493
+ // like <!--?foo?-->, but in XML is a processing instruction
1494
+ var value = (nt === 7 || nt === 8) && preceder.nodeValue;
1495
+ if (value
1496
+ ? !/^\??prettify\b/.test(value)
1497
+ : (nt !== 3 || /\S/.test(preceder.nodeValue))) {
1498
+ // Skip over white-space text nodes but not others.
1499
+ break;
1500
+ }
1501
+ if (value) {
1502
+ attrs = {};
1503
+ value.replace(
1504
+ /\b(\w+)=([\w:.%+-]+)/g,
1505
+ function (_, name, value) { attrs[name] = value; });
1506
+ break;
1507
+ }
1508
+ }
1509
+ }
1510
+
1511
+ var className = cs.className;
1512
+ if ((attrs !== EMPTY || prettyPrintRe.test(className))
1513
+ // Don't redo this if we've already done it.
1514
+ // This allows recalling pretty print to just prettyprint elements
1515
+ // that have been added to the page since last call.
1516
+ && !prettyPrintedRe.test(className)) {
1517
+
1518
+ // make sure this is not nested in an already prettified element
1519
+ var nested = false;
1520
+ for (var p = cs.parentNode; p; p = p.parentNode) {
1521
+ var tn = p.tagName;
1522
+ if (preCodeXmpRe.test(tn)
1523
+ && p.className && prettyPrintRe.test(p.className)) {
1524
+ nested = true;
1525
+ break;
1526
+ }
1527
+ }
1528
+ if (!nested) {
1529
+ // Mark done. If we fail to prettyprint for whatever reason,
1530
+ // we shouldn't try again.
1531
+ cs.className += ' prettyprinted';
1532
+
1533
+ // If the classes includes a language extensions, use it.
1534
+ // Language extensions can be specified like
1535
+ // <pre class="prettyprint lang-cpp">
1536
+ // the language extension "cpp" is used to find a language handler
1537
+ // as passed to PR.registerLangHandler.
1538
+ // HTML5 recommends that a language be specified using "language-"
1539
+ // as the prefix instead. Google Code Prettify supports both.
1540
+ // http://dev.w3.org/html5/spec-author-view/the-code-element.html
1541
+ var langExtension = attrs['lang'];
1542
+ if (!langExtension) {
1543
+ langExtension = className.match(langExtensionRe);
1544
+ // Support <pre class="prettyprint"><code class="language-c">
1545
+ var wrapper;
1546
+ if (!langExtension && (wrapper = childContentWrapper(cs))
1547
+ && codeRe.test(wrapper.tagName)) {
1548
+ langExtension = wrapper.className.match(langExtensionRe);
1549
+ }
1550
+
1551
+ if (langExtension) { langExtension = langExtension[1]; }
1552
+ }
1553
+
1554
+ var preformatted;
1555
+ if (preformattedTagNameRe.test(cs.tagName)) {
1556
+ preformatted = 1;
1557
+ } else {
1558
+ var currentStyle = cs['currentStyle'];
1559
+ var defaultView = doc.defaultView;
1560
+ var whitespace = (
1561
+ currentStyle
1562
+ ? currentStyle['whiteSpace']
1563
+ : (defaultView
1564
+ && defaultView.getComputedStyle)
1565
+ ? defaultView.getComputedStyle(cs, null)
1566
+ .getPropertyValue('white-space')
1567
+ : 0);
1568
+ preformatted = whitespace
1569
+ && 'pre' === whitespace.substring(0, 3);
1570
+ }
1571
+
1572
+ // Look for a class like linenums or linenums:<n> where <n> is the
1573
+ // 1-indexed number of the first line.
1574
+ var lineNums = attrs['linenums'];
1575
+ if (!(lineNums = lineNums === 'true' || +lineNums)) {
1576
+ lineNums = className.match(/\blinenums\b(?::(\d+))?/);
1577
+ lineNums =
1578
+ lineNums
1579
+ ? lineNums[1] && lineNums[1].length
1580
+ ? +lineNums[1] : true
1581
+ : false;
1582
+ }
1583
+ if (lineNums) { numberLines(cs, lineNums, preformatted); }
1584
+
1585
+ // do the pretty printing
1586
+ prettyPrintingJob = {
1587
+ langExtension: langExtension,
1588
+ sourceNode: cs,
1589
+ numberLines: lineNums,
1590
+ pre: preformatted
1591
+ };
1592
+ applyDecorator(prettyPrintingJob);
1593
+ }
1594
+ }
1595
+ }
1596
+ if (k < elements.length) {
1597
+ // finish up in a continuation
1598
+ setTimeout(doWork, 250);
1599
+ } else if ('function' === typeof opt_whenDone) {
1600
+ opt_whenDone();
1601
+ }
1602
+ }
1603
+
1604
+ doWork();
1605
+ }
1606
+
1607
+ /**
1608
+ * Contains functions for creating and registering new language handlers.
1609
+ * @type {Object}
1610
+ */
1611
+ var PR = win['PR'] = {
1612
+ 'createSimpleLexer': createSimpleLexer,
1613
+ 'registerLangHandler': registerLangHandler,
1614
+ 'sourceDecorator': sourceDecorator,
1615
+ 'PR_ATTRIB_NAME': PR_ATTRIB_NAME,
1616
+ 'PR_ATTRIB_VALUE': PR_ATTRIB_VALUE,
1617
+ 'PR_COMMENT': PR_COMMENT,
1618
+ 'PR_DECLARATION': PR_DECLARATION,
1619
+ 'PR_KEYWORD': PR_KEYWORD,
1620
+ 'PR_LITERAL': PR_LITERAL,
1621
+ 'PR_NOCODE': PR_NOCODE,
1622
+ 'PR_PLAIN': PR_PLAIN,
1623
+ 'PR_PUNCTUATION': PR_PUNCTUATION,
1624
+ 'PR_SOURCE': PR_SOURCE,
1625
+ 'PR_STRING': PR_STRING,
1626
+ 'PR_TAG': PR_TAG,
1627
+ 'PR_TYPE': PR_TYPE,
1628
+ 'prettyPrintOne':
1629
+ IN_GLOBAL_SCOPE
1630
+ ? (win['prettyPrintOne'] = $prettyPrintOne)
1631
+ : (prettyPrintOne = $prettyPrintOne),
1632
+ 'prettyPrint': prettyPrint =
1633
+ IN_GLOBAL_SCOPE
1634
+ ? (win['prettyPrint'] = $prettyPrint)
1635
+ : (prettyPrint = $prettyPrint)
1636
+ };
1637
+
1638
+ // Make PR available via the Asynchronous Module Definition (AMD) API.
1639
+ // Per https://github.com/amdjs/amdjs-api/wiki/AMD:
1640
+ // The Asynchronous Module Definition (AMD) API specifies a
1641
+ // mechanism for defining modules such that the module and its
1642
+ // dependencies can be asynchronously loaded.
1643
+ // ...
1644
+ // To allow a clear indicator that a global define function (as
1645
+ // needed for script src browser loading) conforms to the AMD API,
1646
+ // any global define function SHOULD have a property called "amd"
1647
+ // whose value is an object. This helps avoid conflict with any
1648
+ // other existing JavaScript code that could have defined a define()
1649
+ // function that does not conform to the AMD API.
1650
+ if (typeof define === "function" && define['amd']) {
1651
+ define("google-code-prettify", [], function () {
1652
+ return PR;
1653
+ });
1654
+ }
1655
+ })();