splitted_docs_re = re.compile ('(input/lsr/out-www/lilypond-snippets|Documentation/user/out-www/(lilypond|music-glossary|lilypond-program|lilypond-learning))/')
snippets_ref_re = re.compile (r'href="(\.\./)?lilypond-snippets')
+user_ref_re = re.compile (r'href="(?:\.\./)?lilypond(|-internals|-learning|-program)')
## Windows does not support symlinks.
# This function avoids creating symlinks for splitted HTML manuals
if splitted_docs_re.match (prefix):
s = re.sub ('(href|src)="(../lily-.*?|.*?[.]png)"', '\\1="../\\2"', s)
- # fix Snippets xrefs ad hoc
- s = snippets_ref_re.sub ('href="source/input/lsr/lilypond-snippets', s)
+ # fix xrefs between documents in different directories ad hoc
+ if 'user/out-www/lilypond' in prefix:
+ s = snippets_ref_re.sub ('href="source/input/lsr/lilypond-snippets', s)
+ elif 'input/lsr' in prefix:
+ s = user_ref_re.sub ('href="source/Documentation/user/lilypond\\1', s)
source_path = os.path.join (os.path.dirname (prefix), 'source')
if not os.path.islink (source_path):
@node Ancient notation
-@unnumbered Ancient notation
+@chapter Ancient notation
+
+@ruser{Ancient notation}
@lysnippets
@node Chords
-@unnumbered Chords
+@chapter Chords
+
+@ruser{Chord notation}
@lysnippets
@node Contexts and engravers
-@unnumbered Contexts and engravers
+@chapter Contexts and engravers
+
+@c FIXME make xref more precise when the chapter has been
+@c revised in GDP
+@ruser{Changing defaults}
+
+@rlearning{Contexts and engravers}
@lysnippets
@node Editorial annotations
-@unnumbered Editorial annotations
+@chapter Editorial annotations
+
+@ruser{Editorial annotations}
@lysnippets
@node Expressive marks
-@unnumbered Expressive marks
+@chapter Expressive marks
+
+@ruser{Expressive marks}
@lysnippets
@node Fretted strings
-@unnumbered Fretted strings
+@chapter Fretted strings
+
+@ruser{Fretted string instruments}
@lysnippets
@node Keyboards
-@unnumbered Keyboards
+@chapter Keyboards
+
+@ruser{Keyboard instruments}
@lysnippets
@section \TEXT\
@end macro
+@ifnottex
+@macro ruser{NAME}
+These snippets illustrate the User Manual,
+section @ref{\NAME\,,,lilypond,Notation Reference}.
+@end macro
+
+@macro rlearning{NAME}
+See also Learning Manual, section
+@ref{\NAME\,,,lilypond-learning,Learning Manual}.
+@end macro
+@end ifnottex
+
+@iftex
+@macro ruser{NAME}
+These snippets illustrate @ref{\NAME\,,,lilypond,Notation Reference}.
+@end macro
+
+@macro rlearning{NAME}
+See also @ref{\NAME\,,,lilypond-learning,Learning Manual}.
+@end macro
+@end iftex
+
@dircategory GNU LilyPond --- the music typesetter
@direntry
* LilyPond Snippets: (lilypond-snippets). Short tricks, tips, and examples.
@node MIDI
-@unnumbered MIDI
+@chapter MIDI
+
+@ruser{MIDI output}
@lysnippets
@node Paper and layout
-@unnumbered Paper and layout
+@chapter Paper and layout
+
+@c FIXME not precise enough reference?
+@ruser{Spacing issues}
@lysnippets
@node Percussion
-@unnumbered Percussion
+@chapter Percussion
+
+@ruser{Percussion}
@lysnippets
@node Pitches
-@unnumbered Pitches
+@chapter Pitches
+
+@ruser{Pitches}
@lysnippets
@node Repeats
-@unnumbered Repeats
+@chapter Repeats
+
+@ruser{Repeats}
@lysnippets
@node Rhythms
-@unnumbered Rhythms
+@chapter Rhythms
+
+@ruser{Rhythms}
@lysnippets
@node Simultaneous notes
-@unnumbered Simultaneous notes
+@chapter Simultaneous notes
+
+@ruser{Simultaneous notes}
@lysnippets
@node Spacing
-@unnumbered Spacing
+@chapter Spacing
+
+@ruser{Spacing issues}
@lysnippets
@node Staff notation
-@unnumbered Staff notation
+@chapter Staff notation
+
+@ruser{Staff notation}
@lysnippets
@node Templates
-@unnumbered Templates
+@chapter Templates
@lysnippets
@node Text
-@unnumbered Text
+@chapter Text
+
+@ruser{Text}
@lysnippets
@node Titles
-@unnumbered Titles
+@chapter Titles
+
+@ruser{Titles and headers}
@lysnippets
@node Tweaks and overrides
-@unnumbered Tweaks and overrides
+@chapter Tweaks and overrides
+
+@c FIXME make xref more precise when the chapter has been
+@c revised in GDP
+@ruser{Changing defaults}
+
+@rlearning{Tweaking output}
@lysnippets
@node Unfretted strings
-@unnumbered Unfretted strings
+@chapter Unfretted strings
+
+@ruser{Unfretted string instruments}
@lysnippets
@node Vocal music
-@unnumbered Vocal music
+@chapter Vocal music
+
+@ruser{Vocal music}
@lysnippets
@node Winds
-@unnumbered Winds
+@chapter Winds
+
+@ruser{Wind instruments}
@lysnippets