%D \module
%D   [       file=typo-hid,
%D        version=2021.03.15, % based on old code lying around
%D          title=\CONTEXT\ Typesetting Macros,
%D       subtitle=Hiding,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Typesetting Macros / Hiding}

\registerctxluafile{typo-hid}{autosuffix}

% This could be redone by using stacking zero or some special code.

\definesystemattribute[hidecontent][public]

\unprotect

\newinteger\c_typo_hidden_level

\permanent\protected\def\starthiddencontent
  {\ifcase\c_typo_hidden_level
     \clf_enablehidecontent
     \let\clf_enablehidecontent\relax
     \attribute\hidecontentattribute\plusone
   \fi
   \advanceby\c_typo_hidden_level\plusone}

\permanent\protected\def\stophiddencontent
  {\advanceby\c_typo_hidden_level\minusone
   \ifcase\c_typo_hidden_level
     \attribute\hidecontentattribute\attributeunsetvalue
   \fi}

\protect \endinput
