Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

if.jst 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.setupKeyword }}
  4. {{# def.setupNextLevel }}
  5. {{## def.validateIfClause:_clause:
  6. {{
  7. $it.schema = it.schema['_clause'];
  8. $it.schemaPath = it.schemaPath + '._clause';
  9. $it.errSchemaPath = it.errSchemaPath + '/_clause';
  10. }}
  11. {{# def.insertSubschemaCode }}
  12. {{=$valid}} = {{=$nextValid}};
  13. {{? $thenPresent && $elsePresent }}
  14. {{ $ifClause = 'ifClause' + $lvl; }}
  15. var {{=$ifClause}} = '_clause';
  16. {{??}}
  17. {{ $ifClause = '\'_clause\''; }}
  18. {{?}}
  19. #}}
  20. {{
  21. var $thenSch = it.schema['then']
  22. , $elseSch = it.schema['else']
  23. , $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }}
  24. , $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }}
  25. , $currentBaseId = $it.baseId;
  26. }}
  27. {{? $thenPresent || $elsePresent }}
  28. {{
  29. var $ifClause;
  30. $it.createErrors = false;
  31. $it.schema = $schema;
  32. $it.schemaPath = $schemaPath;
  33. $it.errSchemaPath = $errSchemaPath;
  34. }}
  35. var {{=$errs}} = errors;
  36. var {{=$valid}} = true;
  37. {{# def.setCompositeRule }}
  38. {{# def.insertSubschemaCode }}
  39. {{ $it.createErrors = true; }}
  40. {{# def.resetErrors }}
  41. {{# def.resetCompositeRule }}
  42. {{? $thenPresent }}
  43. if ({{=$nextValid}}) {
  44. {{# def.validateIfClause:then }}
  45. }
  46. {{? $elsePresent }}
  47. else {
  48. {{?}}
  49. {{??}}
  50. if (!{{=$nextValid}}) {
  51. {{?}}
  52. {{? $elsePresent }}
  53. {{# def.validateIfClause:else }}
  54. }
  55. {{?}}
  56. if (!{{=$valid}}) {
  57. {{# def.extraError:'if' }}
  58. }
  59. {{? $breakOnError }} else { {{?}}
  60. {{??}}
  61. {{? $breakOnError }}
  62. if (true) {
  63. {{?}}
  64. {{?}}