I have found this, that works, buy I don't know if there's a possibility of
using less code:

% !TEX encoding = UTF-8 Unicode

% !TEX TS-program = ConTeXt-MkIV


% questo codice centra il blocco dei versi sulla pagina

\defineframedtext

  [poemframed]

  [width=\textwidth,

   autowidth=force,

   align=flushleft,

   before=,

   after=,

   frame=off]


\definenarrower[poemnarrower]


\definelines

  [poemlines]

  [before={\startpoemnarrower[left]},

   after=\stoppoemnarrower]


\definebuffer[poem]


\def\stoppoem{\setups{poems:buffer}}


\startsetups poems:buffer

  \setupnarrower[poemnarrower][left=0pt]

  \setbox\scratchbox\vbox

    {\poemframed

    {\startpoemlines

       \getpoem

      \stoppoemlines}}

  \edef\poemhsize{\the\dimexpr(\hsize-\wd\scratchbox)/2\relax}

  \setupnarrower[poemnarrower][left=\poemhsize]

  \startpoemlines

    \getpoem

  \stoppoemlines

\stopsetups


% questo codice rientra ogni secondo e terzo verso

\unprotect

\installindentingmethod {three} {\c_spac_indentation_toggle_state\plusthree}


\unexpanded\def\spac_indentation_tri_toggle_indeed

  {\glet\checkindentation\spac_indentation_tri_toggle}


\unexpanded\def\spac_indentation_tri_toggle

  {\gdef\checkindentation

      {\spac_indentation_remove

       \gdef\checkindentation{\spac_indentation_tri_toggle_indeed}}}


% this next macro is redefinition of a core macro!

\def\spac_indentation_check_toggle

 {\ifcase\c_spac_indentation_toggle_state

    % nothing

  \or

    \spac_indentation_no_toggle

  \or

    \spac_indentation_do_toggle

  \or

    \spac_indentation_tri_toggle

  \fi}

\protect


% questo codice attiva il rientro

\setupindenting[yes,1em]

\setuplines[indenting=three]


\starttext


\startpoem

Per correr miglior acque alza le vele

omai la navicella del mio ingegno,

che lascia dietro a sé mar sì crudele;

e canterò di quel secondo regno

dove l'umano spirito si purga

e di salire al ciel diventa degno.

Ma qui la morta poesì resurga,

o sante Muse, poi che vostro sono;

e qui Calïopè alquanto surga,

seguitando il mio canto con quel suono

di cui le Piche misere sentiro

lo colpo tal, che disperar perdono.
\stoppoem

\stoptext

Il giorno gio 2 lug 2020 alle ore 17:14 Tommaso Gordini <
illinguista1...@gmail.com> ha scritto:

> Thanks, Wolfgang. Your example works, but the verse indentation (
> \setuplines[indenting=three]) is lost.
> There's a way to preserve it?
>
> Tommy
>
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to