lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue 3491: Add \displayMarkup command. (issue 12732043)


From: markpolesky
Subject: Issue 3491: Add \displayMarkup command. (issue 12732043)
Date: Mon, 12 Aug 2013 03:36:11 +0000

Reviewers: ,

Message:
Hi all, here's a new patch.

- Mark

Description:
Issue 3491: http://code.google.com/p/lilypond/issues/detail?id=3491

Please review this at https://codereview.appspot.com/12732043/

Affected files:
  M Documentation/extending/programming-interface.itely
  M ly/music-functions-init.ly


Index: Documentation/extending/programming-interface.itely
diff --git a/Documentation/extending/programming-interface.itely b/Documentation/extending/programming-interface.itely index 3b5e147664bb8fa341d111448d58700493f62fb5..ca710c57b93011b6e96a19e5f8a75f363b0cbba7 100644
--- a/Documentation/extending/programming-interface.itely
+++ b/Documentation/extending/programming-interface.itely
@@ -609,21 +609,48 @@ Markups are implemented as special Scheme functions which produce a
 @subsection Markup construction in Scheme

 @cindex defining markup commands
address@hidden \displayMarkup
+
+Markup expressions are internally represented in Scheme using the
address@hidden macro:

-The @code{markup} macro builds markup expressions in Scheme while
-providing a LilyPond-like syntax.  For example,
 @example
-(markup #:column (#:line (#:bold #:italic "hello" #:raise 0.4 "world")
-                  #:larger #:line ("foo" "bar" "baz")))
+(markup @var{expr})
address@hidden example
+
+The easiest way to see how this works is with the
address@hidden command, which converts a markup expression
+into its equivalent Scheme expression:
+
address@hidden
+\displayMarkup
+\markup @{
+  \column @{
+    \line @{ \bold \italic "hello" \raise #0.4 "world" @}
+    \larger \line @{ foo bar baz @}
+  @}
address@hidden
 @end example

 @noindent
-is equivalent to:
+Compiling the code above will send the following to the display
+console:
+
 @example
address@hidden \markup \column @{ \line @{ \bold \italic "hello" \raise #0.4 "world" @}
-                  \larger \line @{ foo bar baz @} @} address@hidden
+(markup
+  #:line
+  (#:column
+   (#:line
+    (#:bold (#:italic "hello") #:raise 0.4 "world")
+    #:larger
+    (#:line
+     (#:simple "foo" #:simple "bar" #:simple "baz")))))
 @end example

+As with the @code{\displayMusic} command, the output of
address@hidden can be saved to an external file.  See
address@hidden music expressions}.
+
 @noindent
 This example demonstrates the main translation rules between regular
 LilyPond markup syntax and Scheme markup syntax.  Using @address@hidden
@@ -640,7 +667,7 @@ Scheme-only solution.
 @item @code{\markup-command} @tab @code{#:markup-command}
 @item @code{\variable} @tab @code{variable}
 @item @code{\center-column @{ @dots{} @}} @tab
-        @code{#:center-column ( @dots{} )}
+        @code{#:center-column ( @dots{} )}
 @item @code{string} @tab @code{"string"}
 @item @code{#scheme-arg} @tab @code{scheme-arg}
 @end multitable
@@ -850,7 +877,7 @@ padding.
             \override #'(box-padding . 0.6) \box @{ #text @address@hidden))
 @end lisp

-or, equivalently
+or, equivalently

 @lisp
 #(define-markup-command (double-box layout props text) (markup?)
Index: ly/music-functions-init.ly
diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index 8af797115f6a730b08e4ee153c71ac939f031591..4028ad7d2452f379c9ac672a14a79272ee142d41 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -342,6 +342,12 @@ displayMusic =
    (display-scheme-music music)
    music)

+displayMarkup =
+#(define-void-function (parser location markup) (markup?)
+ (_i "Display the internal representation of @var{markup} to the console.")
+   (newline)
+   (display-scheme-music markup))
+


 endSpanners =





reply via email to

[Prev in Thread] Current Thread [Next in Thread]