@c -*- coding: utf-8; mode: texinfo; -*-

@ignore
****************************
MACRO DEFINITIONS GUIDELINES
****************************

This file contains macro definitions that are common to all languages,
i.e., all macro definitions that do not contain translatable text
(namely text visible in the output).

Macro definitions that contain translatable text belong to file
`macros.itexi'.
@end ignore


@c Don't replace quotes with directed quotes.

@set txicodequoteundirected
@set txicodequotebacktick
@set txiindexbackslashignore


@include cyrillic.itexi


@c   ***** Displaying text *****

@c We need this since @q{\} doesn't work with makeinfo 4.11 --
@c say @q{@bs{}} instead.

@macro bs
\\
@end macro


@ifnotinfo

@macro notation{TEXT}
@var{\TEXT\}
@end macro

@end ifnotinfo

@ifinfo

@macro notation{TEXT}
\TEXT\
@end macro

@end ifinfo


@macro smallspace
@sp 1
@end macro


@c   ***** Displaying images not generated by lilypond-book *****

@c Current installation setup of Info docs requires that all images are
@c expected to be found in the `lilypond/' subdirectory.  `lilypond-book'
@c already generates proper @image commands for images of music; these
@c macro definitions do the same for other images.

@ifnotinfo

@macro sourceimage{FILENAME,WIDTH,HEIGHT,ALTTEXT}
@image{pictures/\FILENAME\,\WIDTH\,\HEIGHT\,\ALTTEXT\}
@end macro

@end ifnotinfo

@ifinfo

@macro sourceimage{FILENAME,WIDTH,HEIGHT,ALTTEXT}
@image{lilypond/pictures/\FILENAME\,\WIDTH\,\HEIGHT\,\ALTTEXT\}
@end macro

@end ifinfo


@c   ***** Headers *****

@c For use as the Level 5 header
@macro subsubsubheading {TEXT}
@subsubheading @i{\TEXT\}
@end macro

@ifclear snippets-sections
@macro lydoctitle {TEXT}
@need 600
@emph{\TEXT\}
@end macro
@end ifclear

@c   ***** Indexing *****

@c Don't remove the `@c' within the macro definition!  See section 19.3,
@c `Macro Details and Caveats', in the texinfo info file for explanation.

@iftex

@c In TeX output mode we unify `@findex', `@cindex', and `@vindex'
@c entries in the concept index; this is done with the `@syncodeindex'
@c lines in macro `@lilyTitlePage'.  We also set
@c `txiindexbackslashignore' so that `\foo' gets sorted as `foo'.
@c However, the latter directive has the side effect that `\foo' and
@c `foo' are treated as equal by the index sorting program.  We don't
@c want that: It is important for us that entries for both `\foo' and
@c `foo' appear in the unified index.
@c
@c For this reason, we make macro `@funindex' use `@sortas' to set a
@c special sorting key, and we redefine texinfo's internal macro
@c `\indexwritesortas' to swallow backslashes.  We also modify
@c `@cindex' to insert another sorting key to ensure that `\foo'
@c immediately comes after `foo', followed by entries like `foo bar'.
@c
@c While the above works well for most cases, there is still a problem
@c if we have `@funindex foo' and `@funindex \foo' at the same time.
@c This can't be handled in an automated way, so we introduce two
@c macros `@funindexpre' and `@funindexpost'.  In particular,
@c
@c * `@funindexpre foo' gets sorted before `@funindex \foo'.
@c * `@funindexpost \foo' gets sorted after `@funindex foo'.
@c
@c `@cpindex' is the internal version of `@cindex'.

@tex
{
\catcode`\-=13
\gdef\indexwritesortas{%
  \begingroup
  \indexnonalnumreappear
  \backslashdisappear
  \indexwritesortasxxx}
}

% `@macro' doesn't allow redefinition of existing commands.
\global\let\cindex\relax

% For index sorting we need two characters with charcode values less
% than that of the space character.  Note that this only works if TeX
% is called with option `-8bit' so that real 8-bit characters are
% emitted to the auxiliary index files.
{
\catcode`\^^A=11 % 0x01
\catcode`\^^B=11 % 0x02
\catcode`\^^C=11 % 0x03
\catcode`\^^D=11 % 0x04
\xdef\indexA{^^A}
\xdef\indexB{^^B}
\xdef\indexC{^^C}
\xdef\indexD{^^D}
}
@end tex

@macro cindex {TEXT}
@cpindex @sortas{\TEXT\@indexA{}}\TEXT\
@c
@end macro

@macro funindexpre {TEXT}
@findex @sortas{\TEXT\@indexB{}}\TEXT\
@kindex @sortas{\TEXT\@indexB{}}\TEXT\
@c
@end macro

@macro funindex {TEXT}
@findex @sortas{\TEXT\@indexC{}}\TEXT\
@kindex @sortas{\TEXT\@indexC{}}\TEXT\
@c
@end macro

@macro funindexpost {TEXT}
@findex @sortas{\TEXT\@indexD{}}\TEXT\
@kindex @sortas{\TEXT\@indexD{}}\TEXT\
@c
@end macro

@end iftex

@ifnottex

@macro funindexpre {TEXT}
@findex \TEXT\
@kindex \TEXT\
@c
@end macro

@macro funindex {TEXT}
@findex \TEXT\
@kindex \TEXT\
@c
@end macro

@macro funindexpost {TEXT}
@findex \TEXT\
@kindex \TEXT\
@c
@end macro

@end ifnottex

@c XXX Currently we are forced to use ancient version 1.82 of texi2html
@c     (from 2005); we thus have to provide a macro for `@sortas',
@c     which was introduced in texinfo version 6.1 (in 2016).

@ifhtml
@macro sortas {TEXT}
@end macro
@end ifhtml



@c   ***** Macros specific to translated docs *****

@c ugh, cannot set/define global variable 'translationof' in any way :-(

@iftex

@macro translationof{TEXT}
@end macro

@end iftex

@ifinfo

@macro translationof{TEXT}
@set translationof \TEXT\
@end macro

@end ifinfo

@ifhtml

@ifset bigpage
@macro untranslated
@end macro
@end ifset

@ifclear bigpage
@macro untranslated
UNTRANSLATED NODE: IGNORE ME
@end macro
@end ifclear

@end ifhtml

@ifnothtml

@macro untranslated
@end macro

@end ifnothtml


@c  ***** Macros specific to the web site *****

@ifset web

@c make link to bugfixes for news-old.itexi
@c use underscores for version: @bugfixes{2_13_13,}
@c use specifier arg when listing multiple versions
@c (see September 20, 2007 post for an example)
@macro bugfixes{version,specifier}
@uref{https://code.google.com/p/lilypond/issues/list?can=1&q=fixed_\version\&colspec=ID+Type+Status+Priority+Milestone+Owner+Summary,Bugfixes
\specifier\}
@end macro

@macro divId {ID}
@html
<div id="\ID\">
@end html
@end macro

@macro divClass {CLASS}
@html
<div class="\CLASS\">
@end html
@end macro

@macro divEnd
@c keep the space for proper nesting of </p>

@html
</div>
@end html
@end macro

@ifhtml
@ifclear bigpage
@macro docSize{before,target,after}
@html
\before\<!-- file-size:, href="../\target\"-->\after\
@end html
@end macro
@end ifclear
@ifset bigpage
@macro docSize{before,target,after}
@html
\before\<!-- file-size:, href="\target\"-->\after\
@end html
@end macro
@end ifset
@end ifhtml
@ifnothtml
@macro docSize{before,target,after}
\before\\after\
@end macro
@end ifnothtml

@ifclear web_version
@ifclear bigpage
@macro docLink{name,target,webLink}
@uref{../\target\, \name\}
@end macro
@end ifclear
@ifset bigpage
@macro docLink{name,target,webLink}
@uref{\target\, \name\}
@end macro
@end ifset
@end ifclear
@ifset web_version
@macro docLink{name,target,webLink}
\webLink\
@end macro
@end ifset

@macro miscLink{MISC-FILE,MISC-TEXT}
@uref{https://lilypond.org/website/misc/\MISC-FILE\,\MISC-TEXT\}
@end macro

@macro spanClass {CLASS}
@html
<span class="\CLASS\">
@end html
@end macro

@macro spanEnd
@c keep the space for proper nesting of </p>

@html
</span>
@end html
@end macro


@c not strictly necessary, but it makes things easier for updating news
@macro newsItem
@html
<div class="news-item">
@end html
@end macro

@macro newsEnd
@c keep the space for proper nesting of </p>

@html
</div>
@end html
@end macro


@macro imageClickable{IMAGE-FILE, EXT, MORE-TEXT, CLICK-FILE, CLICK-EXT, POSITION}
@html
<div class="float-\POSITION\">
  <a class="clickable" href="pictures/\CLICK-FILE\.\CLICK-EXT\">
    <img src="pictures/\IMAGE-FILE\.\EXT\" alt="\IMAGE-FILE\">
  </a>
  <p style="text-align: center">
    \MORE-TEXT\
  </p>
</div>
@end html
@iftex
@image{pictures/\IMAGE-FILE\,,,\IMAGE-FILE\}
@end iftex
@ifinfo
@image{lilypond/pictures/\IMAGE-FILE\,,,\IMAGE-FILE\}
@end ifinfo
@end macro

@macro imageFloat{IMAGE-FILE, EXT, POSITION}
@html
<img class="float-\POSITION\" src="pictures/\IMAGE-FILE\.\EXT\" alt="\IMAGE-FILE\">
@end html
@iftex
@image{pictures/\IMAGE-FILE\,,,\IMAGE-FILE\,\EXT\}
@end iftex
@ifinfo
@image{lilypond/pictures/\IMAGE-FILE\,,,\EXT\}
@end ifinfo
@end macro

@macro imageId{ID, IMAGE-FILE, EXT, ALT}
@html
<div id="\ID\">
  <img src="pictures/\IMAGE-FILE\.\EXT\" alt="\ALT\">
</div>
@end html
@iftex
@image{pictures/\IMAGE-FILE\,,,\ALT\}
@end iftex
@ifinfo
@image{lilypond/pictures/\IMAGE-FILE\,,,\ALT\}
@end ifinfo
@end macro

@end ifset

@macro staticFile{RELLINK, DESC}
@uref{https://lilypond.gitlab.io/static-files/\RELLINK\, \DESC\}
@end macro
