Debian Codegraph @

texmf-dist/tex/lualatex/countwords/countwords.sty

raw
1 %%
2 %% This is file `countwords.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% countwords.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 2026 by Hugo Heagren [email protected]
12 %%
13 %% This file may be distributed and/or modified under the conditions of
14 %% the LaTeX Project Public License, either version 1.3c of this license
15 %% or (at your option) any later version. The latest version of this
16 %% license is in:
17 %%
18 %% http://www.latex-project.org/lppl.txt
19 %%
20 %% and version 1.3c or later is part of all distributions of LaTeX
21 %% version 2008-05-04 or later.
22 %%
23 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
24 \ProvidesPackage{countwords}
25 [2026/04/14 1.0.1 Exact word counts]
26
27
28 \RequirePackage{luatexbase}
29 \RequirePackage{luapackageloader}
30 \directlua{countwords = require("countwords")}
31 \DeclareKeys
32 {
33 threshold.code = \directlua{ countwords.set_threshold(\number#1) },
34 }
35 \SetKeys{threshold=1}
36 \DeclareUnknownKeyHandler{\PackageWarning{countwords}{Unknown option `#1'}}
37 \ProcessKeyOptions
38 \directlua{
39 luatexbase.add_to_callback(
40 "pre_linebreak_filter",
41 countwords.callback,
42 "wordcount"
43 )
44 }%
45 \def\countwordsstart#1{%
46 \directlua{ countwords.enable_counter("#1") }
47 }
48 \def\countwordsstop#1{%
49 \directlua{ countwords.disable_counter("#1") }
50 }
51
52 \endinput
53 %%
54 %% End of file `countwords.sty'.