Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Xslate振り返り
Search
FUJI Goro
October 17, 2014
Technology
2
4.8k
Xslate振り返り
Template Engine Night 2014/10/17 の資料です
FUJI Goro
October 17, 2014
Tweet
Share
More Decks by FUJI Goro
See All by FUJI Goro
How to Boost Your Code with WebAssembly
gfx
2
2.6k
AssemblyScriptでライブラリコードの高速化をしてみる
gfx
5
2.7k
実践TypeScriptトークバトル
gfx
1
970
歴史的経緯の説明 as code
gfx
7
2.5k
Elasticsearchによる 全文検索の実装 in Rails
gfx
5
9.1k
すばらしきGraphQLのSEKAIへようこそ
gfx
20
9k
マルチテナント・ウェブアプリケーションの実践
gfx
14
9.3k
How to choose the ORM on Android
gfx
1
4k
How Do We Get Along With Static Types
gfx
5
3.2k
Other Decks in Technology
See All in Technology
Oracle Database 23ai Overview
oracle4engineer
PRO
0
310
UFACTORY Lite 6用リーダーフォロワーシステムの作成
hygradme
0
120
RAGのサービスをリリースして1年が経ちました
segavvy
3
1.2k
はてなのSRE組織2024 / Road to SRE NEXT@福岡
cohalz
1
540
左手は添えるだけ!?AWS Well-Architected Frameworkが教えてくれる大事なデータの守り方
ohtk79
0
360
エンジニアとしてのキャリアを支える自宅サーバー
jacopen
9
6k
온디바이스 AI 및 로컬 AI의 도전 과제 / Challenges of On-Device AI and Local AI
inureyes
PRO
0
770
Building Static Websites with Sculpin
opdavies
0
1.3k
From Chaos to Clarity: The Power of Refactoring
zikriyeurkmez
0
100
De 0 a SRE en un año - tech4impact 2024
pablokbs
1
180
Custom Query で監視が捗った話 / Monitoring with Custom Query
akitok_
0
150
Databricksのご紹介
taka_aki
1
280
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
25
2.1k
Unsuck your backbone
ammeep
664
57k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
It's Worth the Effort
3n
180
27k
How to train your dragon (web standard)
notwaldorf
76
5.3k
Building an army of robots
kneath
300
42k
The World Runs on Bad Software
bkeepers
PRO
61
6.8k
Build your cross-platform service in a week with App Engine
jlugia
227
17k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
12
1.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
244
12k
How GitHub Uses GitHub to Build GitHub
holman
469
290k
Transcript
Xslate։ൃͷৼΓฦΓ Template Engine Night 2014-10-17 by gfx (CPAN:GFUJI)
ࣗݾհ • gfx • ϞόΠϧΞϓϦΤϯδχΞ • Android / iOS ༻ͷࣾϥΠϒϥϦ։ൃ͕ओ
• HTMLΑΓAndroidͷlayout XMLͷ΄͏Λࢁॻ͍ ͯ·͢ • Xslate20104݄ʹ։ൃͯ͠20111݄ʹ1.0
http://xslate.org/ https://github.com/xslate
arity
Introduction to Xslate • Xslate: Perl࠷ͷςϯϓϨʔτΤϯδϯ • ʮςϯϓϨʔτΤϯδϯͷ࣮ʰʱͱʰػೳʱ ͷτϨʔυΦϑ͕͋Δʯͱ͍͏ݴઆΛ൱ఆͨ͠ʂ •
࣮ߦΤϯδϯCͰ࣮ͨ͠ԾϚγϯ • DTC: Direct Threaded Code • YARV ManiacsͱCRubyΛࢀߟʹͨ͠
ࢀߟ: XslateҎલͷ࣌ • ߴ • HTML::Template::Pro, Text::ClearSilver • ߴػೳ •
Template-Toolkit, Text::MicroTemplate
)FMMP OBNF "45 0QDPEF4FRVFODF %5$ < <MJUFSBM l)FMMP l>
<QSJOU lOBNFz> > QBSTF DPNQJMF BTTFNCMF
Virtual Machine (written in C)
Template Syntax (“Kolon”)
Xslateͷಛ • छྨ • ൚༻ɾಠࣗݴޠܕʢSmarty, Mustache) • ࢀߟ: ൚༻ɾϗετݴޠܕʢerb, JSPʣ,
HAMLܕ (haml, Jade), XMLܕ (Thymeleaf, Genshi) • ॏ • ߴػೳ & ߴ ʢ͍͍ͩͨओཁͳػೳ͍͋ͬͯʣ • ࢀߟ: Τϯδϯͷอकੑ, ςϯϓϨʔτϑΝΠϧͷอकੑ, ଞͷݴޠ͔Βͷར༻
ৼΓฦΓ Keep / Problem / Try
Keep - Α͔ͬͨ͜ͱ • σϑΝΫτͩͬͨTemplate-Toolkitͷ100ഒߴ • ͷܕͰHTML escapeͷཁɾෆཁΛܾఆ͢Δ • PSGI͚ͩΛߟ͑ͯೖग़ྗΛ୯७ʹͨ͠
• ύʔαɾίϯύΠϥɾVMΛ͍͓͔ͯͨ͛͠Ͱ੩తղੳπʔϧ Λ࡞Δ༨͕͋ͬͨ • Locale::Maketext::Extract::Plugin::Xslate • جຊػೳҎ֎ͯ͢ϢʔβʔఆٛؔͰఏڙͱ͍͏ͷΑ͔ͬͨ
Problem - ѱ͔ͬͨ͜ͱ • ʹͩ͜ΘΓ࣮͕͗ͯ͢ղʹͳͬͨ • CʹΑΔͩ͜ΘΓͷVM, ෳࡶ͗͢ΔΩϟογϡγεςϜ… • ࣮༻Ϩϕϧͷ͕͋Εɺ࣍ʹॏཁͳͷอकੑ
• ಈతܕ͖ݴޠతͳܽ • ͋Δύϥϝʔλ͕ʮҙʯͳͷ͔ʮඞਢʯͳͷ͔Λهड़Ͱ͖ͳ͍ • ΠϯΫϧʔυͰมΛೝΊΔʢ<: include $file :> ʣඞཁຊʹඞ ཁ͔ͩͬͨ • ։ൃऀ͕Σϒ։ൃΛ͠ͳ͔ͬͨʢࣄͰ͏ͱࢥͬͨΒΘͳ͔ͬͨʣ
Try - ະདྷͷςϯϓϨʔτΤϯδϯ • ७ਮʹϗετݴޠͰ࣮͢Δ or JavaScriptͰ࣮ • ੩తղੳΛ༰қʹͯ͠πʔϧνΣΠϯΛ๛ʹ •
ςϯϓϨʔτϑΝΠϧͷؔΛநग़͢Δπʔϧ • Ͳ͏͍͏ύϥϝʔλΛͱΔ͔Λநग़͢Δπʔϧ • ϓϩϑΝΠϥ͕΄͍͠ • ͍ͣΕʹͤΑςϯϓϨʔτݴޠJSͷαϒηοτͰΑ͍
࣮ݴޠ • ϗετݴޠͰ࣮͢Δͱϝϯς͍͢͠ • Keep It Simple, Stupid! • JavaScriptͰ࣮͢ΔͱϒϦοδ෦Ͱτϥϒϧ
͕ى͖͕͕ͪͩ࠶ར༻Ͱ͖ΔՄೳੑߴ͍ • ͤΔσʔλJSONʹ੍ݶͤ͟ΔΛ͑ͳ͍ • རศੑͱͷτϨʔυΦϑ͕ͩݕ౼ͷՁ͋Δ
ςϯϓϨʔτͷछྨ • ൚༻ܕHTMLͷग़ྗҎ֎ʹ͑ΔͷͰඞਢ • hamlܕॻ͘ͷָ͕ͳ໘ɺֶशίετ͕ߴ ͍ɻه๏౷Ұ͞Ε͓ͯΒͣաظͳײ͡ • XMLܕͷϝϦοτΑ͘Θ͔Βͳ͍ • SࣜͰॻ͘ͷҙ֎ͱѱ͘ͳ͍Μ͡Όͳ͍͔
hamlͷޭࡑ • %ul • %li • - if expr •
Hello, world # ΠϯσϯτϨϕϧʁ • ࣮͕buggy & slowͰΞϨ͗͢Δ
੩తղੳ • ϓϩάϥϜΛ࣮ߦͤͣʹɺߏจˍincludeͷଥੑ&ύϥϝʔλͷ ଥੑΛνΣοΫ͍ͨ͠ • <: $foo :> ͕ۭʹͳΔͷϩδοΫΤϥʔ •
<: $foo // “bar” :> $foo͕ۭͰ͋ΕbarʹͳΔ • <: f($foo) :> ͜ͷϢʔβʔఆٛؔͱΈΒΕΔf()ଥ͔ʁ • ͜ͷνΣοΫΛ੩తʹ͢Δͷ͍͠ • ఆٛͷΈΛॻ͍ͨσʔλ = IDL͕ඞཁ
That’s all. ! ࢀߟ: https://gist.github.com/ tokuhirom/61f5e20cf759706ca3c9