%D \module
%D   [       file=space-run,
%D        version=2025.10.31,
%D          title=\CONTEXT\ Page Macros,
%D       subtitle=Runtime Macros,
%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.

% We moved some code here.

\writestatus{loading}{ConTeXt Spacing Macros / Runtime Macros}

\unprotect

%D Musical timestamp: release day 2025-10-31: Anna Von Hauswolff, Iconoclasts;
%D Gazpacho, Magic 8 Ball; Lunatic Sould, The World Under Unsun. So plenty to
%D listen to between coding: adding \type {\thespecification} and some used
%D primitives.

\newinteger\c_space_show_par

\gdef\spac_show_par_data#1#2%
  {\ifrelax#1\else
     \spac_show_par_data_indeed{#2}{\expand#1#2}%
     \expandafter\spac_show_par_data
   \fi}

\protected\gdef\spac_show_par_data_indeed_text#1#2%
  {\hpack{\string#1:\quad #2}%
   \endgraf}

\protected\gdef\spac_show_par_data_indeed_file#1#2%
  {\writestatus{paragraph \the\c_space_show_par}{\string#1: #2}}

\lettonothing\spac_show_par_data_indeed

\def\spac_show_par_data_list
   {\spac_show_par_data
      \the\interwordspace
      \the\interwordstretch
      \the\interwordshrink
      \the\emwidth
      \the\exheight
      \the\extraspace
      \the\hsize
      \the\vsize
      \the\leftskip
      \the\rightskip
      \the\spaceskip
      \the\xspaceskip
      \the\parindent
      \the\parfillleftskip
      \the\parinitrightskip
      \the\parinitleftskip
      \the\parfillrightskip
      \the\hyphenpenalty
      \the\exhyphenpenalty
      \the\automatichyphenpenalty
      \the\explicithyphenpenalty
    % \thespecification\displaywidowpenalties
      \thespecification\widowpenalties
      \thespecification\clubpenalties
      \thespecification\brokenpenalties
      \the\doublehyphendemerits
      \the\finalhyphendemerits
      \thespecification\adjacentdemerits
      \thespecification\orphanpenalties
      \thespecification\toddlerpenalties
      \the\lefttwindemerits
      \the\righttwindemerits
    % \the\linebreakstretchcriterion
    % \the\linebreakshrinkcriterion
      \the\emergencystretch
      \the\tolerance
      \the\pretolerance
    \relax\relax}

\permanent\tolerant\protected\gdef\showpardata[#1]%
  {\global\advance\c_space_show_par\plusone
   \ifcstok{#1}\v!file
     \let\spac_show_par_data_indeed\spac_show_par_data_indeed_file
     \writestatus{paragraph \the\c_space_show_par}{}%
     \spac_show_par_data_list
     \writestatus{paragraph \the\c_space_show_par}{}%
   \else
     \let\spac_show_par_data_indeed\spac_show_par_data_indeed_text
     \dontleavehmode
     \ifcstok{#1}\v!right
        \expandafter\inrightmargin
     \else
        \expandafter\inleftmargin
     \fi
       {\ifcstok{#1}\v!right\llap\else\rlap\fi
        \bgroup
          \vcenter\bgroup
            \expanded{\framed
              [\c!align=\v!right,%
               \c!foregroundstyle=\smallinfofont\setupinterlinespace,%
               \c!frame=\v!off,%
               \c!foregroundcolor=darkblue,%
               \c!background=\v!color,%
               \c!backgroundcolor=gray]%
            \bgroup
              \hpack\bgroup
                \darkred \strut font:\quad \fontname\font
              \egroup
              \vkern \exheight
              \spac_show_par_data_list
            \egroup}%
          \egroup
        \egroup
        \vrule
            \s!width .5\emwidth
            \s!pair  \exheight \zeropoint
        \relax}%
   \fi}

\protect

\continueifinputfile{s-spacing-show.mkxl}

\starttext

    \showpardata        \samplefile{tufte} \blank
    \showpardata[right] \samplefile{ward}  \blank
    \showpardata[file]  \samplefile{davis} \blank

\stoptext
