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.9k
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.8k
実践TypeScriptトークバトル
gfx
1
1k
歴史的経緯の説明 as code
gfx
7
2.6k
Elasticsearchによる 全文検索の実装 in Rails
gfx
5
9.3k
すばらしきGraphQLのSEKAIへようこそ
gfx
20
9.1k
マルチテナント・ウェブアプリケーションの実践
gfx
14
9.4k
How to choose the ORM on Android
gfx
1
4.1k
How Do We Get Along With Static Types
gfx
5
3.3k
Other Decks in Technology
See All in Technology
App Router を実プロダクトで採用して見えてきた勘所をちょっとだけ紹介
marokanatani
0
780
Analytics-Backed App Widget Development - Served with Jetpack Glance
miyabigouji
0
210
Monitor GraalVM Native Apps with OpenTelemetry
logico_jp
0
120
Creative UIs with Compose: DroidKaigi 2024
chrishorner
1
190
Estrategias de escalabilidade para projetos web
jessilyneh
2
220
強いチームを夢見て-PMからSREに転身して1年の振り返り / 20240906_bengo4_sre
bengo4com
2
830
20240912 JJUGナイトセミナー
mii1004
0
130
LLVM/ASMを使った有限体の高速実装
herumi
0
110
社内の学びの場・コミュニティ形成とエンジニア同士のリレーションシップ構築/devreljapan2024
nishiuma
3
110
2024年版 運用者たちのLLM
nwiizo
3
520
React Aria で実現する次世代のアクセシビリティ
ryo_manba
4
1k
PdMはどのように全てのスピードを上げられるか ~ 非連続進化のための具体的な取り組み ~
sansantech
PRO
1
150
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
123
18k
Fontdeck: Realign not Redesign
paulrobertlloyd
80
5.1k
Visualization
eitanlees
142
15k
GitHub's CSS Performance
jonrohan
1029
450k
For a Future-Friendly Web
brad_frost
174
9.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
41
6.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
43
2k
The Language of Interfaces
destraynor
153
23k
Into the Great Unknown - MozCon
thekraken
28
1.4k
The Pragmatic Product Professional
lauravandoore
31
6.2k
Build your cross-platform service in a week with App Engine
jlugia
228
18k
Documentation Writing (for coders)
carmenintech
65
4.3k
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