allow inherits in json file
This commit is contained in:
parent
e9b904c32c
commit
88f0dc9f8f
@ -2,6 +2,7 @@
|
||||
|
||||
#(if (defined? 'LAYOUT) #f (load (string-append (dirname (current-filename)) file-name-separator-string "json_parser.scm")))
|
||||
#(use-modules (json parser))
|
||||
\include "resolve_inherits.ly"
|
||||
\include "basic_format_and_style_settings.ly"
|
||||
\include "eps_file_from_song_dir.ly"
|
||||
\include "title_with_category_images.ly"
|
||||
|
22
resolve_inherits.ly
Normal file
22
resolve_inherits.ly
Normal file
@ -0,0 +1,22 @@
|
||||
#(define (resolve-inherit-entry-in-list alist entry)
|
||||
(let* ((key (car entry))
|
||||
(attributes (cdr entry))
|
||||
(inherits (assoc-ref attributes "inherits")))
|
||||
(if inherits
|
||||
(let* ((alist-without-entry (alist-delete key alist))
|
||||
(inherit-entry (assoc inherits alist-without-entry))
|
||||
(inherits-attributes (if inherit-entry (alist-copy (cdr (resolve-inherit-entry-in-list alist-without-entry inherit-entry)))))
|
||||
(override-attributes (alist-delete "inherits" attributes)))
|
||||
(if inherit-entry
|
||||
(begin
|
||||
(for-each (lambda (attribute) (assoc-set! inherits-attributes (car attribute) (cdr attribute))) override-attributes)
|
||||
(cons key inherits-attributes)
|
||||
)
|
||||
(ly:error "~a can not inherit from ~a" key inherits))
|
||||
)
|
||||
entry
|
||||
)))
|
||||
|
||||
#(define (resolve-inherits alist)
|
||||
(map (lambda (entry) (resolve-inherit-entry-in-list alist entry)) alist)
|
||||
)
|
Loading…
Reference in New Issue
Block a user