{"id":22133,"date":"2018-07-17T14:25:29","date_gmt":"2018-07-17T18:25:29","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=22133"},"modified":"2019-01-18T10:29:27","modified_gmt":"2019-01-18T15:29:27","slug":"swift-gyb","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/07\/17\/swift-gyb\/","title":{"rendered":"Swift GYB"},"content":{"rendered":"<p><a href=\"https:\/\/nshipster.com\/swift-gyb\/\">Mattt Thompson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/nshipster.com\/swift-gyb\/\"><p>GYB is a lightweight templating system that allows you to use Python code for variable substitution and flow control:<\/p><ul><li>The sequence <code>%{ &lt;#code#&gt; }<\/code> evaluates a block of Python code<\/li><li>The sequence <code>% &lt;#code#&gt;: &#8230; % end<\/code> manages control flow<\/li><li>The sequence <code>${ &lt;#code#&gt; }<\/code> substitutes the result of an expression<\/li><\/ul><p>All other text is passed through unchanged.<\/p><p>A good example of GYB can be found in <a href=\"https:\/\/github.com\/apple\/swift\/blob\/master\/stdlib\/public\/core\/Codable.swift.gyb\">Codable.swift.gyb<\/a>.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Mattt Thompson: GYB is a lightweight templating system that allows you to use Python code for variable substitution and flow control:The sequence %{ &lt;#code#&gt; } evaluates a block of Python codeThe sequence % &lt;#code#&gt;: &#8230; % end manages control flowThe sequence ${ &lt;#code#&gt; } substitutes the result of an expressionAll other text is passed through [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2018-07-17T18:25:31Z","apple_news_api_id":"58cadf2c-d80c-4a00-bbe2-23f994105e6a","apple_news_api_modified_at":"2019-01-18T15:29:31Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/AWMrfLNgMSgC74iP5lBBeag","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[941,71,232,1774,901],"class_list":["post-22133","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-macros","tag-programming","tag-python","tag-swift-codable","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=22133"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22133\/revisions"}],"predecessor-version":[{"id":23983,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22133\/revisions\/23983"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=22133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=22133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=22133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}