From: Julien Rioux Date: Fri, 22 Oct 2010 08:18:49 +0000 (+0100) Subject: lilypond-book: add a --safe mode option (1281). X-Git-Tag: release/2.13.37-1~41 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a672bdf4929d3cca8eec06a58e0ad7982fa8d2f0;p=lilypond.git lilypond-book: add a --safe mode option (1281). --- diff --git a/python/book_snippets.py b/python/book_snippets.py index a19a5796d7..a1b1328c57 100644 --- a/python/book_snippets.py +++ b/python/book_snippets.py @@ -201,6 +201,8 @@ PREAMBLE_LY = '''%%%% Generated by %(program_name)s \layout { %(layout_string)s } + +%(safe_mode_string)s ''' @@ -556,6 +558,10 @@ left-margin-default right-margin-default)" notes_string = '\n '.join (compose_dict[NOTES]) % vars () preamble_string = '\n '.join (compose_dict[PREAMBLE]) % override padding_mm = self.global_options.padding_mm + if self.global_options.safe_mode: + safe_mode_string = "#(ly:set-option 'safe #t)" + else: + safe_mode_string = "" d = globals().copy() d.update (locals()) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index f8f09966fd..c16abf4a7b 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -179,6 +179,11 @@ def get_option_parser (): action='store', dest='process_cmd', default='') + p.add_option ('-s', '--safe', help=_ ("Compile snippets in safe mode"), + action="store_true", + default=False, + dest="safe_mode") + p.add_option ('--skip-lily-check', help=_ ("do not fail if no lilypond output is found"), metavar=_ ("DIR"),