texlive[47584] Master: lyluatex in luatex, per wl 12 Apr 2018

commits+karl at tug.org commits+karl at tug.org
Thu May 3 18:40:38 CEST 2018


Revision: 47584
          http://tug.org/svn/texlive?view=revision&revision=47584
Author:   karl
Date:     2018-05-03 18:40:37 +0200 (Thu, 03 May 2018)
Log Message:
-----------
lyluatex in luatex, per wl 12 Apr 2018 07:14:26

Modified Paths:
--------------
    trunk/Master/tlpkg/libexec/ctan2tds

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/luatex/lyluatex/
    trunk/Master/texmf-dist/tex/luatex/lyluatex/lyluatex.sty

Removed Paths:
-------------
    trunk/Master/texmf-dist/tex/latex/lyluatex/

Added: trunk/Master/texmf-dist/tex/luatex/lyluatex/lyluatex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lyluatex/lyluatex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/luatex/lyluatex/lyluatex.sty	2018-05-03 16:40:37 UTC (rev 47584)
@@ -0,0 +1,242 @@
+%Lyluatex LaTeX style.
+%
+% Copyright (C) 2015-2018 jperon and others (see CONTRIBUTORS.md)
+% License: MIT
+% This file is part of lyluatex.
+
+\NeedsTeXFormat{LaTeX2e}%
+\ProvidesPackage{lyluatex}[2018/03/12 v1.0b]  %%LYLUATEX_DATE LYLUATEX_VERSION
+
+% Dependencies
+\RequirePackage{luatexbase}
+\RequirePackage{luaotfload}
+\RequirePackage{xkeyval}
+\RequirePackage{graphicx}
+\RequirePackage{minibox}
+\RequirePackage{environ}
+\RequirePackage{currfile}
+\RequirePackage{pdfpages}
+
+\RequirePackage{metalogo}
+\newcommand{\lyluatex}{\textit{ly}\LuaTeX}
+
+\edef\ly at false{false}\def\ly at istwosided{\if at twoside\else\ly at false\fi}
+\savecatcodetable 40
+
+% Options
+\catcode`-=11
+\directlua{
+  ly = require(kpse.find_file("lyluatex.lua") or "lyluatex.lua")
+  ly.declare_package_options({
+    ['addversion'] = {'false', 'true', ''},
+    ['autoindent'] = {'true', 'false', ''},
+    ['cleantmp'] = {'false', 'true', ''},
+    ['currfiledir'] = {},
+    ['debug'] = {'false', 'true', ''},
+    ['extra-bottom-margin'] = {'0', ly.is_dim},
+    ['extra-top-margin'] = {'0', ly.is_dim},
+    ['fragment'] = {'', 'false', 'true'},
+        ['nofragment'] = {'default', ly.is_neg},
+    ['fullpagealign'] = {'crop', 'staffline'},
+    ['fullpagestyle'] = {''},
+    ['gutter'] = {'.4in', ly.is_dim},
+        ['exampleindent'] = {'gutter', ly.is_alias},
+        ['leftgutter'] = {'', ly.is_dim}, ['rightgutter'] = {'', ly.is_dim},
+    ['hpadding'] = {'0.75ex', ly.is_dim},
+    ['includepaths'] = {'./'},
+    ['indent'] = {'', ly.is_dim},
+        ['noindent'] = {'default', ly.is_neg},
+    ['insert'] = {'', 'systems', 'fullpage', 'inline', 'bare-inline'},
+    ['intertext'] = {''},
+    ['label'] = {'false'}, ['labelprefix'] = {'ly_'},
+    ['line-width'] = {[[\linewidth]], ly.is_dim},
+    ['ly-version'] = {'2.18.2'},
+    ['max-protrusion'] = {[[\maxdimen]], ly.is_dim},
+        ['max-left-protrusion'] = {'', ly.is_dim},
+        ['max-right-protrusion'] = {'', ly.is_dim},
+    ['noclef'] = {'false', 'true', ''},
+    ['nostaff'] = {'false', 'true', ''},
+    ['nostaffsymbol'] = {'false', 'true', ''},
+    ['notime'] = {'false', 'true', ''},
+    ['notiming'] = {'false', 'true', ''},
+    ['notimesig'] = {'false', 'true', ''},
+    ['optimize-pdf'] = {'false', 'true', ''},
+    ['paperwidth'] = {[[\paperwidth]], ly.is_dim},
+    ['paperheight'] = {[[\paperheight]], ly.is_dim},
+    ['papersize'] = {'false'},
+    ['pass-fonts'] = {'false', 'true', ''},
+        ['current-font'] = {}, ['current-font-as-main'] = {'false', 'true', ''},
+        ['rmfamily'] = {}, ['sffamily'] = {}, ['ttfamily'] = {},
+    ['print-page-number'] = {'false', 'true', ''},
+    ['print-only'] = {''},
+    ['printfilename'] = {'false', 'true', ''},
+    ['program'] = {'lilypond'},
+    ['protrusion'] = {'', ly.is_dim},
+        ['noprotrusion'] = {'default', ly.is_neg},
+    ['raw-pdf'] = {'false', 'true', ''},
+    ['quote'] = {'false', 'true', ''},
+    ['ragged-right'] = {'default', 'true', 'false', ''},
+        ['noragged-right'] = {'default', ly.is_neg},
+    ['relative'] = {'false', ly.is_num},
+        ['norelative'] = {'default', ly.is_neg},
+    ['showfailed'] = {'false', 'true' ,''},
+    ['staffsize'] = {'0', ly.is_dim},
+        ['inline-staffsize'] = {'0', ly.is_dim},
+    ['tmpdir'] = {'tmp-ly'},
+    ['twoside'] = {'\ly at istwosided', 'false', 'true', ''},
+    ['verbatim'] = {'false', 'true', ''},
+    ['voffset'] = {'0pt', ly.is_dim},
+    ['valign'] = {'center', 'top', 'bottom'},
+    % MusicXML options
+    ['absolute'] = {'false', 'true', ''},
+    ['language'] = {'false'},
+    ['lxml'] = {'false', 'true'},
+    ['no-articulation-directions'] = {'true', 'false', ''},
+    ['no-beaming'] = {'true', 'false', ''},
+    ['no-page-layout'] = {'true', 'false', ''},
+    ['no-rest-positions'] = {'true', 'false', ''},
+    ['verbose'] = {'false', 'true', ''},
+    ['xml2ly'] = {'musicxml2ly'},
+  })
+}
+\directlua{
+  if ly.get_option('cleantmp') then
+    luatexbase.add_to_callback('stop_run', ly.clean_tmp_dir, 'lyluatex cleantmp')
+    luatexbase.add_to_callback('stop_run', ly.conclusion_text, 'lyluatex conclusion')
+  end
+}
+\catcode`-=12
+
+%\directlua{ly.TWOSIDE = 'f'}
+
+\newcommand{\ly at setunits}{%
+  \let\ly at old@in\in\protected\def\in{in}%
+  \let\ly at old@pt\pt\protected\def\pt{pt}%
+  \let\ly at old@mm\mm\protected\def\mm{mm}%
+  \let\ly at old@cm\cm\protected\def\cm{cm}%
+  \let\ly at old@hfuzz\hfuzz\setlength{\hfuzz}{\maxdimen}%
+}
+\newcommand{\ly at resetunits}{%
+  \let\in\ly at old@in%
+  \let\pt\ly at old@pt%
+  \let\mm\ly at old@mm%
+  \let\cm\ly at old@cm%
+  \setlength{\hfuzz}{\ly at old@hfuzz}%
+}
+
+% Command to change options during the document
+\newcommand{\lysetoption}[2]{\directlua{ly.set_property([[#1]], [[#2]])}}
+
+% How the filename of a score will look like (if printed)
+\newcommand{\lyFilename}[1]{\noindent #1\par\bigskip}
+
+% Appearance of verbatim 'intertext' (if printed)
+\newcommand{\lyIntertext}[1]{\noindent #1\par\bigskip}
+
+% Appearance of LilyPond version (if printed)
+\newcommand{\lyVersion}[1]{\noindent {\footnotesize\emph{(GNU LilyPond #1)}\par}\bigskip}
+
+% Retrieve the three main font families (rm, sf, tt)
+% and store them as options. Additionally store the
+% *current* font for optional use.
+\newcommand{\ly at currentfonts}{%
+  \begingroup%
+    \directlua{ly.set_property('current-font', ly.get_font_family(font.current()))}%
+    \rmfamily \edef\rmfamilyid{\fontid\font}%
+    \sffamily \edef\sffamilyid{\fontid\font}%
+    \ttfamily \edef\ttfamilyid{\fontid\font}%
+    % Set font families to those of the document
+    % that haven't been set explicitly as options.
+    \directlua{ly.set_fonts(\rmfamilyid, \sffamilyid, \ttfamilyid)}%
+  \endgroup%
+}
+
+% Main commands
+% Score processing
+\newcommand*{\ly at compilescore}[1]{%
+  \ly at setunits%
+  \directlua{
+    ly.set_property('currfiledir', [[\currfiledir]])
+    ly.set_property('twoside', '\ly at istwosided')
+    #1
+    ly.newpage_if_fullpage()
+  }%
+  \ly at resetunits%
+  \ly at currentfonts%
+  \directlua{ly.score:process()}%
+}
+
+% Inclusion of a .ly file
+\newcommand*\includely[2][]{%
+  \directlua{ly.state = 'file'}%
+  \ly at compilescore{ly.file(
+    '\luatexluaescapestring{#2}', [[#1]]
+  )}%
+}
+
+% Inclusion of a musicxml file
+\newcommand*\musicxmlfile[2][]{%
+  \directlua{ly.state = 'file'}%
+  \ly at compilescore{ly.file_musicxml(
+    '\luatexluaescapestring{#2}', [[#1]]
+  )}
+}
+
+% Base environments to include a LilyPond fragment integrated into
+% the document.
+\newcommand\lyscorebegin{\directlua{ly.buffenv_begin()}}
+\newcommand\lyscoreend{\directlua{ly.buffenv_end()}}
+\newenvironment{ly at bufferenv}{%
+  \lyscorebegin%
+}{%
+  \lyscoreend%
+  \ly at compilescore{ly.fragment(ly.score_content, [[\options]])}%
+}
+
+\NewEnviron{ly at compilely}{%
+  \ly at compilescore{ly.fragment(
+    '\luatexluaescapestring{\unexpanded\expandafter{\BODY}}',
+    [[\options]]
+  )}%
+}
+
+% Commands to print verbatim content of the score
+\newcommand\lysetverbenv[2]{%
+  \directlua{ly.verbenv = {
+    '\luatexluaescapestring{\detokenize{#1}}',
+    '\luatexluaescapestring{\detokenize{#2}}'
+  }}%
+}
+
+% Parametrized command and environment for included LilyPond fragment
+\newenvironment{ly}[1][noarg]{%
+  \edef\options{#1}%
+  \directlua{ly.env_begin([[#1]])}%
+}{%
+  \directlua{ly.env_end()}%
+}
+
+\newcommand*{\lily}[2][]{%
+  \edef\options{#1}%
+  \let\ly at oldrepeat\repeat\def\repeat{}% Fix #51
+  \directlua{ly.state = 'cmd'}%
+  \begin{ly at compilely}%
+    #2
+  \end{ly at compilely}%
+  \let\repeat\ly at oldrepeat%
+}
+
+\newcommand{\lyscore}[1]{\directlua{
+  local i = tonumber('#1') or '#1'
+  if i == '' then i = 1 end
+  tex.sprint(ly.score[i] or '')
+}}
+
+% Commands for compatibility with lilypond-book
+\let\lilypondfile\includely%
+\protected\def\lilypond{%
+  \def\reserved at a{lilypond}%
+  \ifx\reserved at a\@currenvir\expandafter\ly%
+  \else\expandafter\lily\fi%
+}%
+\let\endlilypond\endly


Property changes on: trunk/Master/texmf-dist/tex/luatex/lyluatex/lyluatex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2018-05-03 08:20:55 UTC (rev 47583)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2018-05-03 16:40:37 UTC (rev 47584)
@@ -1472,6 +1472,7 @@
  'lollipop',	'lollipop',
  'luatexja',    'luatex',
  'luaxml',      'luatex',
+ 'lyluatex',	'luatex',
  'mathabx',     'generic',
  'mathdots',    'generic',
  'metatex',     'plain',



More information about the tex-live-commits mailing list