tjadmin 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tjadmin/version.rb +1 -1
- data/vendor/assets/font/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff +0 -0
- data/vendor/assets/font/FontAwesome.otf +0 -0
- data/vendor/assets/font/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff +0 -0
- data/vendor/assets/font/fontawesome-webfont.eot +0 -0
- data/vendor/assets/font/fontawesome-webfont.svg +399 -0
- data/vendor/assets/font/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/font/fontawesome-webfont.woff +0 -0
- data/vendor/assets/javascripts/tjadmin/ace-elements.js +866 -0
- data/vendor/assets/javascripts/tjadmin/ace-extra.js +374 -0
- data/vendor/assets/javascripts/tjadmin/ace.js +310 -0
- data/vendor/assets/javascripts/tjadmin/additional-methods.js +617 -0
- data/vendor/assets/javascripts/tjadmin/bootbox.js +660 -0
- data/vendor/assets/javascripts/tjadmin/bootstrap-colorpicker.js +540 -0
- data/vendor/assets/javascripts/tjadmin/bootstrap-tag.js +206 -0
- data/vendor/assets/javascripts/tjadmin/bootstrap-wysiwyg.js +206 -0
- data/vendor/assets/javascripts/tjadmin/bootstrap.js +2280 -0
- data/vendor/assets/javascripts/tjadmin/chosen.jquery.js +1166 -0
- data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-datepicker.js +1016 -0
- data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-timepicker.js +888 -0
- data/vendor/assets/javascripts/tjadmin/date-time/daterangepicker.js +854 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.bg.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ca.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.cs.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.da.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.de.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.el.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.es.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fi.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fr.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.he.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hr.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hu.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.id.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.is.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.it.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ja.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.kr.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lt.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lv.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ms.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nb.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nl.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pl.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt-BR.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ro.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs-latin.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ru.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sk.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sl.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sv.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sw.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.th.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.tr.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.uk.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-CN.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-TW.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/moment.js +1400 -0
- data/vendor/assets/javascripts/tjadmin/excanvas.js +1428 -0
- data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.js +3061 -0
- data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.pie.js +817 -0
- data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.resize.js +60 -0
- data/vendor/assets/javascripts/tjadmin/fuelux/data/fuelux.tree-sampledata.js +174 -0
- data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.spinner.js +201 -0
- data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.tree.js +173 -0
- data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.wizard.js +172 -0
- data/vendor/assets/javascripts/tjadmin/fullcalendar.js +5973 -0
- data/vendor/assets/javascripts/tjadmin/jquery-1.10.2.js +9789 -0
- data/vendor/assets/javascripts/tjadmin/jquery-2.0.3.js +8829 -0
- data/vendor/assets/javascripts/tjadmin/jquery-ui-1.10.3.custom.js +5423 -0
- data/vendor/assets/javascripts/tjadmin/jquery.autosize.js +242 -0
- data/vendor/assets/javascripts/tjadmin/jquery.colorbox.js +1063 -0
- data/vendor/assets/javascripts/tjadmin/jquery.dataTables.js +12099 -0
- data/vendor/assets/javascripts/tjadmin/jquery.easy-pie-chart.js +200 -0
- data/vendor/assets/javascripts/tjadmin/jquery.gritter.js +418 -0
- data/vendor/assets/javascripts/tjadmin/jquery.hotkeys.js +113 -0
- data/vendor/assets/javascripts/tjadmin/jquery.inputlimiter.1.3.1.js +172 -0
- data/vendor/assets/javascripts/tjadmin/jquery.knob.js +656 -0
- data/vendor/assets/javascripts/tjadmin/jquery.maskedinput.js +338 -0
- data/vendor/assets/javascripts/tjadmin/jquery.mobile.custom.js +1081 -0
- data/vendor/assets/javascripts/tjadmin/jquery.slimscroll.js +448 -0
- data/vendor/assets/javascripts/tjadmin/jquery.sparkline.js +3054 -0
- data/vendor/assets/javascripts/tjadmin/jquery.ui.touch-punch.js +160 -0
- data/vendor/assets/javascripts/tjadmin/jquery.validate.js +1231 -0
- data/vendor/assets/javascripts/tjadmin/markdown/bootstrap-markdown.js +993 -0
- data/vendor/assets/javascripts/tjadmin/markdown/markdown.js +1616 -0
- data/vendor/assets/javascripts/tjadmin/markdown/to-markdown.js +184 -0
- data/vendor/assets/javascripts/tjadmin/select2.js +3168 -0
- data/vendor/assets/javascripts/tjadmin/spin.js +349 -0
- data/vendor/assets/javascripts/tjadmin/x-editable/ace-editable.js +368 -0
- data/vendor/assets/javascripts/tjadmin/x-editable/bootstrap-editable.js +6827 -0
- data/vendor/assets/javascripts/tjadmin.js +5 -0
- data/vendor/assets/stylesheets/tjadmin/ace-fonts.css.scss +13 -0
- data/vendor/assets/stylesheets/tjadmin/ace-ie.css +293 -0
- data/vendor/assets/stylesheets/tjadmin/ace-responsive.css +1113 -0
- data/vendor/assets/stylesheets/tjadmin/ace-skins.css +1301 -0
- data/vendor/assets/stylesheets/tjadmin/ace.css +14701 -0
- data/vendor/assets/stylesheets/tjadmin/bootstrap-responsive.css +1109 -0
- data/vendor/assets/stylesheets/tjadmin/bootstrap.css +6167 -0
- data/vendor/assets/stylesheets/tjadmin/chosen.css +430 -0
- data/vendor/assets/stylesheets/tjadmin/font-awesome-ie7.css +1203 -0
- data/vendor/assets/stylesheets/tjadmin/font-awesome.css +1479 -0
- data/vendor/assets/stylesheets/tjadmin/jquery-ui-1.10.3.custom.css +223 -0
- data/vendor/assets/stylesheets/tjadmin.css +9 -0
- metadata +106 -1
@@ -0,0 +1,184 @@
|
|
1
|
+
/*
|
2
|
+
* to-markdown - an HTML to Markdown converter
|
3
|
+
*
|
4
|
+
* Copyright 2011, Dom Christie
|
5
|
+
* Licenced under the MIT licence
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
|
9
|
+
var toMarkdown = function(string) {
|
10
|
+
|
11
|
+
var ELEMENTS = [
|
12
|
+
{
|
13
|
+
patterns: 'p',
|
14
|
+
replacement: function(str, attrs, innerHTML) {
|
15
|
+
return innerHTML ? '\n\n' + innerHTML + '\n' : '';
|
16
|
+
}
|
17
|
+
},
|
18
|
+
{
|
19
|
+
patterns: 'br',
|
20
|
+
type: 'void',
|
21
|
+
replacement: '\n'
|
22
|
+
},
|
23
|
+
{
|
24
|
+
patterns: 'h([1-6])',
|
25
|
+
replacement: function(str, hLevel, attrs, innerHTML) {
|
26
|
+
var hPrefix = '';
|
27
|
+
for(var i = 0; i < hLevel; i++) {
|
28
|
+
hPrefix += '#';
|
29
|
+
}
|
30
|
+
return '\n\n' + hPrefix + ' ' + innerHTML + '\n';
|
31
|
+
}
|
32
|
+
},
|
33
|
+
{
|
34
|
+
patterns: 'hr',
|
35
|
+
type: 'void',
|
36
|
+
replacement: '\n\n* * *\n'
|
37
|
+
},
|
38
|
+
{
|
39
|
+
patterns: 'a',
|
40
|
+
replacement: function(str, attrs, innerHTML) {
|
41
|
+
var href = attrs.match(attrRegExp('href')),
|
42
|
+
title = attrs.match(attrRegExp('title'));
|
43
|
+
return href ? '[' + innerHTML + ']' + '(' + href[1] + (title && title[1] ? ' "' + title[1] + '"' : '') + ')' : str;
|
44
|
+
}
|
45
|
+
},
|
46
|
+
{
|
47
|
+
patterns: ['b', 'strong'],
|
48
|
+
replacement: function(str, attrs, innerHTML) {
|
49
|
+
return innerHTML ? '**' + innerHTML + '**' : '';
|
50
|
+
}
|
51
|
+
},
|
52
|
+
{
|
53
|
+
patterns: ['i', 'em'],
|
54
|
+
replacement: function(str, attrs, innerHTML) {
|
55
|
+
return innerHTML ? '_' + innerHTML + '_' : '';
|
56
|
+
}
|
57
|
+
},
|
58
|
+
{
|
59
|
+
patterns: 'code',
|
60
|
+
replacement: function(str, attrs, innerHTML) {
|
61
|
+
return innerHTML ? '`' + innerHTML + '`' : '';
|
62
|
+
}
|
63
|
+
},
|
64
|
+
{
|
65
|
+
patterns: 'img',
|
66
|
+
type: 'void',
|
67
|
+
replacement: function(str, attrs, innerHTML) {
|
68
|
+
var src = attrs.match(attrRegExp('src')),
|
69
|
+
alt = attrs.match(attrRegExp('alt')),
|
70
|
+
title = attrs.match(attrRegExp('title'));
|
71
|
+
return '![' + (alt && alt[1] ? alt[1] : '') + ']' + '(' + src[1] + (title && title[1] ? ' "' + title[1] + '"' : '') + ')';
|
72
|
+
}
|
73
|
+
}
|
74
|
+
];
|
75
|
+
|
76
|
+
for(var i = 0, len = ELEMENTS.length; i < len; i++) {
|
77
|
+
if(typeof ELEMENTS[i].patterns === 'string') {
|
78
|
+
string = replaceEls(string, { tag: ELEMENTS[i].patterns, replacement: ELEMENTS[i].replacement, type: ELEMENTS[i].type });
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
for(var j = 0, pLen = ELEMENTS[i].patterns.length; j < pLen; j++) {
|
82
|
+
string = replaceEls(string, { tag: ELEMENTS[i].patterns[j], replacement: ELEMENTS[i].replacement, type: ELEMENTS[i].type });
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
function replaceEls(html, elProperties) {
|
88
|
+
var pattern = elProperties.type === 'void' ? '<' + elProperties.tag + '\\b([^>]*)\\/?>' : '<' + elProperties.tag + '\\b([^>]*)>([\\s\\S]*?)<\\/' + elProperties.tag + '>',
|
89
|
+
regex = new RegExp(pattern, 'gi'),
|
90
|
+
markdown = '';
|
91
|
+
if(typeof elProperties.replacement === 'string') {
|
92
|
+
markdown = html.replace(regex, elProperties.replacement);
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
markdown = html.replace(regex, function(str, p1, p2, p3) {
|
96
|
+
return elProperties.replacement.call(this, str, p1, p2, p3);
|
97
|
+
});
|
98
|
+
}
|
99
|
+
return markdown;
|
100
|
+
}
|
101
|
+
|
102
|
+
function attrRegExp(attr) {
|
103
|
+
return new RegExp(attr + '\\s*=\\s*["\']?([^"\']*)["\']?', 'i');
|
104
|
+
}
|
105
|
+
|
106
|
+
// Pre code blocks
|
107
|
+
|
108
|
+
string = string.replace(/<pre\b[^>]*>`([\s\S]*)`<\/pre>/gi, function(str, innerHTML) {
|
109
|
+
innerHTML = innerHTML.replace(/^\t+/g, ' '); // convert tabs to spaces (you know it makes sense)
|
110
|
+
innerHTML = innerHTML.replace(/\n/g, '\n ');
|
111
|
+
return '\n\n ' + innerHTML + '\n';
|
112
|
+
});
|
113
|
+
|
114
|
+
// Lists
|
115
|
+
|
116
|
+
// Escape numbers that could trigger an ol
|
117
|
+
// If there are more than three spaces before the code, it would be in a pre tag
|
118
|
+
// Make sure we are escaping the period not matching any character
|
119
|
+
string = string.replace(/^(\s{0,3}\d+)\. /g, '$1\\. ');
|
120
|
+
|
121
|
+
// Converts lists that have no child lists (of same type) first, then works it's way up
|
122
|
+
var noChildrenRegex = /<(ul|ol)\b[^>]*>(?:(?!<ul|<ol)[\s\S])*?<\/\1>/gi;
|
123
|
+
while(string.match(noChildrenRegex)) {
|
124
|
+
string = string.replace(noChildrenRegex, function(str) {
|
125
|
+
return replaceLists(str);
|
126
|
+
});
|
127
|
+
}
|
128
|
+
|
129
|
+
function replaceLists(html) {
|
130
|
+
|
131
|
+
html = html.replace(/<(ul|ol)\b[^>]*>([\s\S]*?)<\/\1>/gi, function(str, listType, innerHTML) {
|
132
|
+
var lis = innerHTML.split('</li>');
|
133
|
+
lis.splice(lis.length - 1, 1);
|
134
|
+
|
135
|
+
for(i = 0, len = lis.length; i < len; i++) {
|
136
|
+
if(lis[i]) {
|
137
|
+
var prefix = (listType === 'ol') ? (i + 1) + ". " : "* ";
|
138
|
+
lis[i] = lis[i].replace(/\s*<li[^>]*>([\s\S]*)/i, function(str, innerHTML) {
|
139
|
+
|
140
|
+
innerHTML = innerHTML.replace(/^\s+/, '');
|
141
|
+
innerHTML = innerHTML.replace(/\n\n/g, '\n\n ');
|
142
|
+
// indent nested lists
|
143
|
+
innerHTML = innerHTML.replace(/\n([ ]*)+(\*|\d+\.) /g, '\n$1 $2 ');
|
144
|
+
return prefix + innerHTML;
|
145
|
+
});
|
146
|
+
}
|
147
|
+
}
|
148
|
+
return lis.join('\n');
|
149
|
+
});
|
150
|
+
return '\n\n' + html.replace(/[ \t]+\n|\s+$/g, '');
|
151
|
+
}
|
152
|
+
|
153
|
+
// Blockquotes
|
154
|
+
var deepest = /<blockquote\b[^>]*>((?:(?!<blockquote)[\s\S])*?)<\/blockquote>/gi;
|
155
|
+
while(string.match(deepest)) {
|
156
|
+
string = string.replace(deepest, function(str) {
|
157
|
+
return replaceBlockquotes(str);
|
158
|
+
});
|
159
|
+
}
|
160
|
+
|
161
|
+
function replaceBlockquotes(html) {
|
162
|
+
html = html.replace(/<blockquote\b[^>]*>([\s\S]*?)<\/blockquote>/gi, function(str, inner) {
|
163
|
+
inner = inner.replace(/^\s+|\s+$/g, '');
|
164
|
+
inner = cleanUp(inner);
|
165
|
+
inner = inner.replace(/^/gm, '> ');
|
166
|
+
inner = inner.replace(/^(>([ \t]{2,}>)+)/gm, '> >');
|
167
|
+
return inner;
|
168
|
+
});
|
169
|
+
return html;
|
170
|
+
}
|
171
|
+
|
172
|
+
function cleanUp(string) {
|
173
|
+
string = string.replace(/^[\t\r\n]+|[\t\r\n]+$/g, ''); // trim leading/trailing whitespace
|
174
|
+
string = string.replace(/\n\s+\n/g, '\n\n');
|
175
|
+
string = string.replace(/\n{3,}/g, '\n\n'); // limit consecutive linebreaks to 2
|
176
|
+
return string;
|
177
|
+
}
|
178
|
+
|
179
|
+
return cleanUp(string);
|
180
|
+
};
|
181
|
+
|
182
|
+
if (typeof exports === 'object') {
|
183
|
+
exports.toMarkdown = toMarkdown;
|
184
|
+
}
|