Function Updated 17 Oct 2026
Chpop(name)
Removes the last level of the counter: "2.1" becomes "2". Removing the only level leaves an empty value.
The counter is a text value of numbers separated by dots, such as "2.1", and is written out with #name#. The function itself returns an empty string, so #chstep("c")# writes nothing. The function names are lower case: chinit, chstep, chdestep, chpush, chpop.
Parameters
namestringrequiredName of variable to store chapter counter in.
Returns
Nothing, just removes a level from the counter.
Example
Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
chinit("counter1");
chstep("counter1");
chstep("counter1");
chpush("counter1");
chstep("counter1");
chstep("counter1");
}#
Counter value is: #counter1#
#{
chpop("counter1");
}#
Counter value is: #counter1#The template above produces this output:
Counter value is: 2.2
Counter value is: 2