lilypond-user
[Top][All Lists]
Advanced

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

Re: justified paragraphs in bookTitleMarkup


From: Thomas Morley
Subject: Re: justified paragraphs in bookTitleMarkup
Date: Fri, 18 Jul 2014 16:06:40 +0200

2014-07-18 13:58 GMT+02:00 Urs Liska <address@hidden>:
> Am 18.07.2014 13:45, schrieb Thomas Morley:
>>
>> 2014-07-18 12:57 GMT+02:00 Urs Liska <address@hidden>:
>>>
>>> Hi,
>>>
>>> I still don't seem to understand this markup stuff sufficiently :-(
>>>
>>> ...
>>>
>>> Best
>>> Urs
>>
>>
>>
>> Does justify-string what you want?
>
>
> Unfortunately not. It's the same as with justify-field. The result is
> basically right, but I can only supply a string to it and not a markup (i.e.
> no further formatting).

Best I can think of right now is the coding below.
You'll need to insert "\n" (or another separator-sign) manually at the
appropiate places.
I didn't manage to make the empty lines being automagically recognized instead.

#(define-markup-command (my-justify layout props args)
  (markup-list?)
  #:category align
  #:properties ((baseline-skip)
                (par-indent 2)
                wordwrap-internal-markup-list)

  (let* ((splitted-args
           (split-list-by-separator args (lambda (x) (equal? x "\n"))))
         (indented-splitted-args
           (map
             (lambda (arg)
               (cons (markup #:hspace par-indent) arg))
             splitted-args))
         (proc
           (lambda (x)
             (stack-lines DOWN 0.0 baseline-skip
               (wordwrap-internal-markup-list layout props #t x))))
         (lst (map proc indented-splitted-args)))
  (stack-lines DOWN 0.0 (* 3 baseline-skip) lst)))

\header {
  desc = \markup \my-justify {
    \italic When working on a score it is often necessary to mark the state of
    development on a given intermediate state (printout or shared PDF).
    Instead of simply adding a date it can be very useful to add information
    about the Git revision if the document is in a version control repository.
    "\n"
    This module provides markup commands that retrieve information about the
    current \bold { Git repository}. It is not only possible to get information
    about the current commit but also whether the repository is in a clean state
    (i.e. whether the score represents the state of a commit or contains
    modifications in the working tree).
    "\n"
    A generic command can be used to issue arbitrary Git commands.
    For a list of defined commands see the usage example.
  }
}

\paper {
  bookTitleMarkup = \markup {
     \fromproperty #'header:desc
  }
}

{ c' }

Cheers,
  Harm



reply via email to

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