Placing changes of clef, time signature and key signature at the beginning of a repeated section

According to Elaine Gould, Behind Bars, chapter Repeated Sections, page 234, "When there is a new clef, key signature or time signature at the beginning of a repeated section" the repeat marks should be printed afterwards.

This is currently not the default in LilyPond.

This snippet provides a manual workaround.