%% parstat.opm
%% Copyright 2025 Petr Krajník
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008 or later.
%%
%% This work has the LPPL maintenance status 'author-maintained'.
%%
%% The Current Maintainer of this work is Petr Krajník.
%%
%% This work consists of the files parstat.opm and parstat.lua.
%%

\_codedecl \parstat {Paragraph statistic macro <v1.0>}

\_namespace{parstat}

\_newcount\.enabled
\.enabled=0 %% Parstat is disabled at default

\_directlua{%
   require("parstat")
   callback.add_to_callback("post_linebreak_filter", parstat.run, "parstat")
}

\_def\.parstatenable{\.enabled=1\_relax}

\_def\.parstatdisable{\.enabled=0\_relax}

\_def\.parstat{\_directlua{parstat.print_summary()}}

\_def\.parstatreset{\_directlua{parstat.reset()}}

\_nspublic \parstatenable \parstatdisable \parstat \parstatreset ;

\_newcount\.fskip
\.fskip=1 %% Skipped lines at par front

\_newcount\.bskip
\.bskip=1 %% Skipped lines at par back

\_endcode

For more infornation, see the project repository:
https://github.com/petrk23/parstat
