/ /cmd /cmd.plated /cmd.plated.build /cmd.plated.watch/html /html.plated /html.plated.chunks /html.plated.files /html.plated.macros /html.plated.operators/html.plated_plugin /html.plated_plugin.blog /html.plated_plugin.copy /html.plated_plugin.docs /html.plated_plugin.import /html.plated_plugin.redirect/js /js.plated /js.plated.blog /js.plated.build /js.plated.micro /js.plated.plugin /js.plated.setup /js.plated.watch/js.plated_chunks /js.plated_chunks.deepmerge /js.plated_chunks.delimiter_close_str /js.plated_chunks.delimiter_open_str /js.plated_chunks.delimiter_wrap_str /js.plated_chunks.expand_tag /js.plated_chunks.fill_chunks /js.plated_chunks.format_chunks /js.plated_chunks.lookup /js.plated_chunks.lookup_in_namespace /js.plated_chunks.markdown /js.plated_chunks.merge_namespace /js.plated_chunks.pop_namespace /js.plated_chunks.prepare /js.plated_chunks.push_namespace /js.plated_chunks.remove_underscorechunks /js.plated_chunks.replace /js.plated_chunks.replace_once /js.plated_chunks.reset_namespace /js.plated_chunks.set_namespace/js.plated_files /js.plated_files.base_files_to_chunks /js.plated_files.build /js.plated_files.build_file /js.plated_files.empty_cache /js.plated_files.empty_folder /js.plated_files.exists /js.plated_files.file_to_chunks /js.plated_files.filename_fixup /js.plated_files.filename_is_basechunk /js.plated_files.filename_is_plated /js.plated_files.filename_to_dirname /js.plated_files.filename_to_output /js.plated_files.find_dirs /js.plated_files.find_files /js.plated_files.joinpath /js.plated_files.lstat /js.plated_files.mkdir /js.plated_files.prepare_namespace /js.plated_files.readdir /js.plated_files.set_source /js.plated_files.source_to_output /js.plated_files.stat /js.plated_files.trimpath /js.plated_files.watch /js.plated_files.write/js.plated_output /js.plated_output.remember /js.plated_output.remember_and_write /js.plated_output.write /js.plated_output.write_all /js.plated_output.write_map/js.plated_plugin /js.plated_plugin.blog /js.plated_plugin.blog.process_dirs /js.plated_plugin.blog.process_file/js.plated_plugin.copy /js.plated_plugin.copy.process_dirs /js.plated_plugin.copy.process_file /js.plated_plugin.copy.process_output/js.plated_plugin.docs /js.plated_plugin.docs.process_dirs /js.plated_plugin.docs.process_file/js.plated_plugin.import /js.plated_plugin.import.process_file/js.plated_plugin.redirect /js.plated_plugin.redirect.process_dirs /js.plated_plugin.redirect.process_file

html.plated.operators

As well as chunknames we can also combine some logic operators to control how macros expand. This is mostly of use with json chunks where you wish to make a choice between a number of possibilities. For instance

{obj.count==1&&obj:showit||obj:hideit}

The above is an example of a value?one:two style logic test. First obj.count is compared to the value 1 this will work if it is a string or a number due to the loose typing used. If true then obj will be rendered with the template chunk showit if false then instead obj will be rendered with the template chunk hideit. You can guess what these two templates are intended to do.

The operators are evaluated left to right with no precedence and are C like, hence == rather than just a single = sign. Here are all the possible operators that can be used.

{a<b}
    returns true if a is less than b
{a<=b}
    returns true if a is less than or equal to b
{a>b}
    returns true if a is more than b
{a>=b}
    returns true if a is more than or equal to b
{a==b}
    returns true if a is equal to b
{a&&b}
    a and b returns b if a is true else returns a
{a||b}
    a or b returns b if a is false else returns a
{a||}
    returns a if it exists else return an empty string

The last one is useful for making macros invisible if they refer to empty data. Normally macros remain in the output if they are invalid. So {a} on its own would either expand to something else or remain as {a} in the output. {a||} is just using the || operator to make it go away if empty.