Skip to content

SNIPPET

martin-henz edited this page Jun 4, 2020 · 17 revisions

Attributes of SNIPPET include:

  • EVAL: default: "yes", if "no": no link to a runnable program is generated.
  • LATEX: default: "no", if "yes": the body contains LaTeX
  • HIDE: default: "no", if "yes": do not include this snippet in any output

Tags within SNIPPET include:

  • NAME: string by which SNIPPETs can refer to each other, using REQUIRES and EXAMPLE
  • REQUIRES: the name of another SNIPPET, which is recursively included in the runnable program. Limitation: SNIPPETs with REQUIRES tags must have a NAME tag.
  • NAME: a string that identifies the SNIPPET for REQUIRE
  • EXPECTED: If a SNIPPET s has an EXPECTED tag, the content of the EXPECTED tag is appended in comment for the generated file for s in js_programs; the comment has the shape: // expected: <EXPECTED> where <EXPECTED> is the string in the EXPECTED tag.
  • EXAMPLE: the name of another SNIPPET, which is included after all REQUIRES SNIPPETs; note that the REQUIRES SNIPPETs of the EXAMPLE snippet are ignored
  • JAVASCRIPT: the JavaScript source for display; for running, REQUIRE snippets are recursively added
  • JAVASCRIPT_RUN: the JavaScript source for running by clicking on textbook entries. Overrides JAVASCRIPT if present. REQUIRES snippets are recursively added.
  • JAVASCRIPT_TEST: the JavaSCript source for testing programs with yarn test. Overrides JAVASCRIPT and JAVASCRIPT_RUN if present. REQUIRES snippets are recursively added.
  • JAVASCRIPT_OUTPUT: the content is added to the PDF version in italics after the program, similar to the original SICP.
Clone this wiki locally