
% \def\doifelsesamelinereference#1#2#3%
%  {\doifreferencefoundelse{lr:b:#1}
%     {\edef\fline{\currentreferencedefault}% was \currentreferencetext
%      \doifreferencefoundelse{lr:e:#1}
%        {\edef\tline{\currentreferencedefault}% was \currentreferencetext
%         \ifx\fline\tline#2\else#3\fi}
%        {\unknownreference{#1}#2}}
%     {\unknownreference{#1}#2}}

% \def\startMyCite[#1]%
%  {\def\stopMyCite
%     {\setuplines[before=,after=]%
%      \startlines\startline[#1]\getbuffer[#1]\stopline[#1]\stoplines
%      \savebuffer[#1]}%
%   \dostartbuffer[#1][startMyCite][stopMyCite]}

% \def\getMyCite[#1]%
%  {\doifreferencefoundelse{lr:b:#1}
%     {\startlinenumbering[\currentreferencedefault]}
%      \startlinenumbering
%   \startlines\readfile{\jobname-#1.tmp}{}{}\stoplines
%   \stoplinenumbering}

% \setuplayout[width=middle,backspace=5cm]

\def\startMyCite[#1]%
 {\def\stopMyCite
   {\startline[#1]\getbuffer[#1]\stopline[#1]\savebuffer[#1]}%
   \dostartbuffer[#1][startMyCite][stopMyCite]}


\def\getMyCite[#1]{%
  \doifreferencefoundelse{lr:b:#1} 
    {\startlinenumbering[\currentreferencedefault]}
    \startlinenumbering
      \readfile{\jobname-#1.tmp}{}{}
    \stoplinenumbering}


\setupwhitespace[big]
% \setupalign[right,nothyphenated]

\starttext

\startbodymatter
 test text test text test text test text test text test text test
 text test text test text test text test text test text test text

 she told:\crlf
 \getMyCite[test-1] % lines 3--6 but 3--7 in the appendix

 test text test text test text test text test text test text test
 text test text test text test text test text test text test text

 and he answered:\crlf
 \getMyCite[test-2]

 test text test text test text test text test text test text test
 text test text test text test text test text test text test text

 she replied:\crlf
 \getMyCite[test-3]
\stopbodymatter


\startappendices
 \startlinenumbering
   We thrive in information--thick worlds because of our marvelous and
   everyday ca- pacity to select, edit, single out, structure,
   highlight, group, pair, merge, harmo- nize, synthesize, focus,
   organize, condense, reduce, boil down, choose,
   \startMyCite[test-1]
     {\red categorize}, catalog, classify, list, abstract, scan, look
     into, idealize, isolate, discriminate, dis- tinguish, screen,
     pigeonhole, pick over, sort, integrate, blend, inspect, filter,
     lump, skip, smooth, chunk, average, approximate, cluster,
     aggregate, outline, summarize, {\red itemize,}
   \stopMyCite
   review, dip into, flip through, browse, glance into, leaf through,
   skim, re- fine, enumerate, glean, synopsize, winnow the wheat from
   the chaff and separate the sheep from the goats.

   We thrive in information--thick worlds because of our marvelous and
   everyday ca- pacity to select, edit, single out, structure,
   highlight, group, pair, merge, harmo- nize, synthesize, focus,
   organize, condense, reduce, boil down, choose,
   \startMyCite[test-2]
     {\red categorize}, catalog, classify, list, abstract, scan, look
     into, idealize, isolate, discriminate, dis- tinguish, screen,
     pigeonhole, pick over, sort, integrate, blend, inspect, filter,
     lump, skip, smooth, chunk, average, approximate, cluster,
     aggregate, outline, summarize, {\red itemize,}
   \stopMyCite
   review, dip into, flip through, browse, glance into, leaf through,
   skim, re- fine, enumerate, glean, synopsize, winnow the wheat from
   the chaff and separate the sheep from the goats.

   \startMyCite[test-3]
     We thrive in information--thick worlds because of our marvelous
     and everyday ca- pacity to select, edit, single out, structure,
     highlight, group, pair, merge, harmo- nize, synthesize, focus,
     organize, condense, reduce, boil down, choose, categorize,
     catalog, classify, list, abstract, scan, look into, idealize,
     isolate, discriminate, dis- tinguish, screen, pigeonhole, pick
     over, sort, integrate, blend, inspect, filter, lump, skip,
     smooth, chunk, average, approximate, cluster, aggregate, outline,
     summarize, itemize, review, dip into, flip through, browse,
     glance into, leaf through, skim, re- fine, enumerate, glean,
     synopsize, winnow the wheat from the chaff and separate the sheep
     from the goats.
   \stopMyCite
 \stoplinenumbering
\stopappendices

\stoptext

%%% Local Variables: 
%%% mode: context
%%% TeX-master: t
%%% End: 
