Rebol 编程/stylize
外观
< Rebol 编程
STYLIZE specs /master /styles styls
返回一个样式表块。
STYLIZE 是一个函数值。
- specs -- 一个包含新样式:旧样式方面的块 (类型:块)
- /master -- 添加到或更改主样式表
- /styles
- styls -- 基于现有样式表 (类型:块)
stylize: func [ "Return a style sheet block." specs [block!] "A block of: new-style: old-style facets" /master "Add to or change master style sheet" /styles styls [block!] "Base on existing style sheet" /local new old new-face old-face args tmp ][ styles: either master [vid-styles] [copy either styles [styls] [[]]] while [specs: find specs set-word!] [ set [new old] specs specs: skip specs 2 new: to-word :new if not word? :old [error "Invalid style for:" new] if not any [ old-face: select styles old old-face: select vid-styles old ] [error "No such style:" old] if not tmp: find specs set-word! [tmp: tail specs] args: copy/part specs tmp forall args [ if any [ find facet-words first args all [old-face/words find old-face/words first args] ] [ change args to-lit-word first args ] ] args: reduce head args new-face: make old-face either tmp: select args 'with [expand-specs old-face tmp] [[]] new-face/facets: args new-face/style: old new-face/flags: exclude new-face/flags state-flags grow-facets new-face args either old: find styles new [change next old new-face] [repend styles [new new-face]] if tmp: new-face/words [ while [tmp: find tmp block!] [ change tmp func [new args] first tmp ] ] ] styles ]