I implemented a calt feature where all caps are replaced by smallcaps as soon as at least two caps follow each other (needs to be done for a special application, I'll spare you the details).
So, /A/B/C is transformed into /A.sc/B.sc/C.sc -- this works.
But now I need to add this functionality with figures. Any figures before and after caps must be transformed:
1. /one/A --> /one.sc/A.sc
2. /one/two/three/A --> /one.sc/two.sc/three.sc/A.sc
3. /A/one/two --> /A.sc/one.sc/two.sc
4. /one/two --> /one/two (must stay the same)
This is what I've got so far:
lookup CAFT {
# Replace any cap following another cap or smallcap with smallcap:
sub [@SMALLCAPS @CAPS @FIGURES] @CAPS' by @SMALLCAPS;
sub [@SMALLCAPS @CAPS @FIGURES_SMALLCAPS] @FIGURES' by @FIGURES_SMALLCAPS;
} CAFT;
lookup CBFR {
# Replace any cap before a smallcap (or figure) with smallcap:
sub @CAPS' [@SMALLCAPS @FIGURES] by @SMALLCAPS;
sub @FIGURES' [@SMALLCAPS @FIGURES_SMALLCAPS] by @FIGURES_SMALLCAPS;
} CBFR;
Result: (1.) and (3.) work, but (2.) doesn't.
How can I make (2.) work as well? It should work for an arbitrary number of figures.
Note: Because of (4.), I cannot simply add the figures to the @CAPS and @SMALLCAPS classes.
Anyone?
TIA, Eric.