Code Monkey home page Code Monkey logo

chtml's Introduction

chtml

A function that helps users create html files. Allows for easy insertion of repetative blocks of code across html files

How to use:

For each .html file, create a corresponding .chtml file for it. chtml parses each .chtml file in the current directory to produce a corresponding .html file. There are two types of insertions that we can do: static insertions and dynamic insertions.

Static Insertions

At any line in our .chtml file we can include a line {file_name} that will insert the contents of file_name at that line verbatim. The {file_name} must be its own line; only whitespace may be before the "{" and no text at all may be after the "}". file_name may be of any file type other than .html or .chtml

For example, say we have multiple .html files with the same CSS formatting, we can copy the code in <style> into its own file, call it mycss.css and then add {mycss.css} in its place for all corresponding .chtml files.

Dynamic Insertions

Dynamic insertions allow us to pass parameters into the files that are being include. Similar to static insertions they have the following formatting: {file_name 1:text1 2:text2 ...} and in our file, file_name, we include ~1 in the place that we want "text1" to be inserted into. The replacement text, e.g. text1, must not contain spaces and the identifier, e.g. 1, must be a whole number greater than or equal to 0.

An example is in the "example" folder

chtml's People

Contributors

nsnave avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.