MCPcopy Index your code
hub / github.com/totaljs/framework / markup

Function markup

internal.js:3388–3446  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

3386}
3387
3388function markup(body) {
3389 body = body.ROOT();
3390 var command = view_find_command(body, 0, true);
3391 if (!command)
3392 return body;
3393
3394 var G = F.global;
3395 var config = CONF;
3396 var resource = F.resource;
3397 var M = EMPTYOBJECT;
3398 var R = EMPTYOBJECT;
3399 var model = EMPTYOBJECT;
3400 var repository = EMPTYOBJECT;
3401 var r = [];
3402
3403 while (command) {
3404
3405 var cmd = command.command;
3406 var name = cmd;
3407
3408 if (name.substring(0, 2) === '\'%') {
3409 name = 'config';
3410 cmd = 'config[\'' + cmd.substring(2) + ']';
3411 } else {
3412 var index = name.indexOf('.');
3413 if (index !== -1)
3414 name = name.substring(0, index);
3415 else {
3416 index = name.indexOf('(');
3417 if (index !== -1)
3418 name = name.substring(0, index);
3419 }
3420 }
3421
3422 if (ALLOWEDMARKUP[name]) {
3423 switch (cmd) {
3424 case 'author':
3425 cmd = 'CONF.author';
3426 break;
3427 case 'root':
3428 cmd = 'CONF.default_root';
3429 break;
3430 }
3431
3432 try {
3433 r.push({ cmd: command.phrase, value: eval('(' + cmd + ')') });
3434 } catch (e) {
3435 console.log('A markup compilation error -->', cmd, e);
3436 }
3437 }
3438
3439 command = view_find_command(body, command.end, true);
3440 }
3441
3442 for (var i = 0; i < r.length; i++)
3443 body = body.replace(r[i].cmd, r[i].value);
3444
3445 return body;

Callers 1

internal.jsFile · 0.85

Calls 1

view_find_commandFunction · 0.85

Tested by

no test coverage detected