JEMPLATE(1)

πŸ“¦
version 0.300 Β· 2 versions
, in fedora 43

🌸 JEMPLATE(1) β€” user contributed perl documentation 🌸

okay bestie, gather round πŸ’– this is the manual page for jemplate, living its best life over in the User Contributed Perl Documentation section of your man pages. It compiles your Template Toolkit templates into JavaScript, and honestly? it ate. let's go. πŸ¦‹


✨ USAGE ✨

here's every way you can run this thing, in order, no notes:

jemplate --runtime [runtime-opt]

jemplate --compile [compile-opt] template-list

jemplate --runtime [runtime-opt] --compile [compile-opt] template-list

jemplate --list template-list

Where --runtime and runtime-opt can include:

  • --runtime β€” Equivalent to --ajax=ilinsky --json=json2
  • --runtime=standard β€” that's it, that's the option πŸ’…
  • --runtime=lite β€” Same as --ajax=none --json=none
  • --runtime=jquery β€” Same as --ajax=jquery --json=none
  • --runtime=yui β€” Same as --ajax=yui --json=yui
  • --runtime=legacy β€” Same as --ajax=gregory --json=json2
  • --json β€” By itself, equivalent to --json=json2
  • --json=json2 β€” Include http://www.json.org/json2.js for parsing/stringifying
  • --json=yui β€” Use YUI: YAHOO.lang.JSON (requires external YUI)
  • --json=none β€” Doesn't provide any JSON functionality except a warning
  • --ajax β€” By itself, equivalent to --ajax=xhr
  • --ajax=jquery β€” Use jQuery for Ajax get and post (requires external jQuery)
  • --ajax=yui β€” Use YUI: yui/connection/connection.js (requires external YUI)
  • --ajax=xhr β€” Use XMLHttpRequest (will automatically use --xhr=ilinsky if --xhr is not set)
  • --ajax=none β€” Doesn't provide any Ajax functionality except a warning
  • --xhr β€” By itself, equivalent to --xhr=ilinsky
  • --xhr=ilinsky β€” Include http://code.google.com/p/xmlhttprequest/
  • --xhr=gregory β€” Include http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/
  • --xxx β€” Include XXX and JJJ helper functions
  • --compact β€” Use the YUICompressor compacted version of the runtime

Where compile-opt can include:

  • --start-tag
  • --end-tag
  • --pre-chomp
  • --post-chomp
  • --trim
  • --any-case
  • --eval
  • --noeval
  • -s, --source
  • --exclude

See below for more information πŸ‘‡ (and yes, we do get to all of them, don't worry)

πŸŽ€ Example

say you wanna write the Jemplate runtime code into Jemplate.js, and then compile every single template file chillin' in the templates/ directory and drop the output into my-jemplate.js. say less:

jemplate --runtime > Jemplate.js
jemplate --compile templates/* > my-jemplate.js

now do the exact same thing, but squish the output into one single file:

jemplate --runtime > my-jemplate.js
jemplate --compile templates/* >> my-jemplate.js

🧚 template-list

The template-list is the list of template files that will be compiled. If something in the list is a file, then the template name will be just the file name. If it's a directory, then all the files under that directory will be found, and the relative paths to those files will be the template name.

so 'template/foo/bar.tt2' will be named 'bar.tt2', but 'template/' will find a template named 'foo/bar.tt2'.

πŸ’‘ it is important to know what Jemplate thinks the template name will be when you're writing templates or code that refers to other templates. Use the --list option to check this. fr fr, do not skip this step.

πŸ’œ COMMANDS πŸ’œ

  • -r, --runtime β€” This flag tells Jemplate to print the Jemplate JavaScript runtime code to STDOUT. You should redirect this output into a .js file.
  • -c, --compile β€” The --compile flag tells Jemplate to actually compile templates. The output is written to STDOUT.
  • -l, --list β€” Just print (STDOUT) the template names that Jemplate would use from the template-list.

πŸ’– TEMPLATE TOOLKIT COMPILE OPTIONS πŸ’–

Jemplate lets you specify the following Template Toolkit compile time options. Full descriptions of these options are available at http://www.template-toolkit.org/docs/plain/Manual/Config.html.

These options may either be set as JEMPLATE_* environment variables or as command line switches.

  • --start-tag (JEMPLATE_START_TAG) β€” Specify the starting template delimiter to use. Default is '[%'.
  • --end-tag (JEMPLATE_END_TAG) β€” Specify the ending template delimiter to use. Default is '%]'.
  • --pre-chomp (JEMPLATE_PRE_CHOMP) β€” Chomp leading whitespace automatically. Default is off.
  • --post-chomp (JEMPLATE_POST_CHOMP) β€” Chomp trailing whitespace automatically. Default is off.
  • --trim (JEMPLATE_TRIM) β€” Trim leading and trailing whitespace. Default is off.
  • --any-case (JEMPLATE_ANYCASE) β€” Allow lower or mixed case for template directives. Default is off.
  • --eval (--noeval) (JEMPLATE_EVAL_JAVASCRIPT) β€” Allow the execution of raw JavaScript. Default is on. Use --noeval to disallow it.

πŸ”₯ JEMPLATE OPTIONS πŸ”₯

These compile time options are specific to Jemplate, no cap.

  • -s, --source β€” Include the original template source code as a JavaScript comment next to each compiled template.
  • --exclude β€” Exclude any file matching the given regular expression.

and that's the whole page, bestie 🌈 you're officially a Jemplate girlie now πŸ‘‘

this has been perl v5.42.0, dated 2025-07-25, brought to you by JEMPLATE(1) β€” go forth and compile, and remember: if anyone asks, you were always this good at Unix πŸ’…

πŸ“¦ where this page comes from