]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-markup-commands.scm
* scm/define-markup-commands.scm (verbatim-file): new markup
[lilypond.git] / scm / define-markup-commands.scm
index 7e405f0f19ccf13313777427c8ded5ae92a51561..0f5392c850fc087135169cd1e3c67b6305c0f9bb 100644 (file)
@@ -746,6 +746,25 @@ any sort of property supported by @internalsref{font-interface} and
 "
   (interpret-markup layout (cons (list new-prop) props) arg))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; files
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(def-markup-command (verbatim-file layout props name) (string?)
+  "Read the contents of a file, and include verbatimly"
+
+  (interpret-markup
+   layout props
+   (if  (ly:get-option 'safe)
+       "Cannot read file in Safe mode"
+       (let*
+           ((str (ly:gulp-file name))
+            (lines (string-split str #\n)))
+
+         (make-typewriter-markup
+          (make-column-markup lines)))
+       )))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; fonts.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;