UNPKG

@rr0/cms

Version:

RR0 Content Management System (CMS)

23 lines (22 loc) 521 B
export class PerFileCounter { constructor() { /** * Source counter in the scope of the current page/context. */ this.number = 1; } get value() { return "" + this.number; } next(context) { const contextFilename = context.file.name; if (contextFilename !== this.fileName) { this.fileName = contextFilename; this.number = 1; } else { this.number++; } return this.value; } }