(Message in three parts, because LaTeX-L rejects long

Below there are two enclosed files corresponding to titletoc with
templates added, and a trial file. The main goal is to show a
different approach to TOC attributes and how entries could be
grouped in a single paragraph. I'm currently working in some
improvements and many bugs remain to be fixed, but it
provides a mock-up of the main ideas. I have not finished yet
partial tocs and hence I removed the code from the sent files;
the processcontents is just a copy of the code by James Kilfiger.

The attributes of standard toc entries (JB1) are:

pre-action:  Code to be executed before the entry,
post-action: Code to be executed after the entry,
decls: declarations (usually paragraph format ones),
left-margin: the left margin related to the entry text (*not*
  the label),
right-margin: the right margin related to the entry text,
right-adjust: a correction for leaders (the leader chars
   are not centered in the enclosing box, but aligned to
   right), this parametes adjusts the entry text so that
   its right margin and the leaders are algned,
label-format: It should include code for making the label hangs,
title-format: self-explanatories
title-format-nolabel: if present, overrides the title format
  in unlabeled entries,
page-format: It should include code for making the page hangs,
leaders-width: self-explanatories

The attributes of "paragraphed" toc entries (JB2) are:

pre-action: Only that of the very first grouped entry is executed,
page-format: As before, except that neither the label nor the page
punct-sep: Default separator,
punct-end: Ending puntuation, only that of the very last grouped entry
  is executed.        =f0 [.]        \COpunct@end,
punct-sup: Separator when the following entry is one level above
  (eg, subsection section)
punct-sup-sup: Id. two levels above (eg subsubsection section)
punct-sub: Id. one level below (eg, section subsection)

Since the right-margin is usually set for all of entries, the
command \contentsmargin[correction]{right} is provided. The
default values for the corresponding attributes are taken
from a couple of internal macros set by it.

\bye \bye

ps. As I'm gettting more and more involved in an Omega project,
I'm not sure if I can continue with this discussion. I will try it,

===========================   xtitlesec.sty begins

% The following tags are used:
% ttl@  : the generic one, shared with titlesec
% ttle@ : ending puntuation for block format
% ttll@ : section level
% ttlx@ : file extension



  \hrule \@height \z@
  \hrule height \z@

% Fillers:




  {\leaders\hrule height #1\hfill\kern\z@}}

  \advance\rightskip\z@ \@plus 1fil\relax}
  \advance\leftskip\z@ \@plus 1fil
  \filleft\advance\rightskip\z@ \@plus -1fil
  \parfillskip\z@ \@plus 2fil\relax}

% User interface
% ~~~~~~~~~~~~~~
% Tools:

\DeclareOption{dotinlabels}{\def\[log in to unmask]