MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / magicMarkups

Function magicMarkups

static/scripts/markitup/jquery.markitup.js:192–222  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

190
191 // markItUp! markups
192 function magicMarkups(string) {
193 if (string) {
194 string = string.toString();
195 string = string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,
196 function(x, a) {
197 var b = a.split('|!|');
198 if (altKey === true) {
199 return (b[1] !== undefined) ? b[1] : b[0];
200 } else {
201 return (b[1] === undefined) ? "" : b[0];
202 }
203 }
204 );
205 // [![prompt]!], [![prompt:!:value]!]
206 string = string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,
207 function(x, a) {
208 var b = a.split(':!:');
209 if (abort === true) {
210 return false;
211 }
212 value = prompt(b[0], (b[1]) ? b[1] : '');
213 if (value === null) {
214 abort = true;
215 }
216 return value;
217 }
218 );
219 return string;
220 }
221 return "";
222 }
223
224 // prepare action
225 function prepare(action) {

Callers 1

prepareFunction · 0.85

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected