Skip to content

Instantly share code, notes, and snippets.

@webbingstudio
Last active November 16, 2020 08:09
Show Gist options
  • Save webbingstudio/13c3b98d3a99ea64d446f4a71edb102c to your computer and use it in GitHub Desktop.
Save webbingstudio/13c3b98d3a99ea64d446f4a71edb102c to your computer and use it in GitHub Desktop.
MovableType.netでカスタムブロックの複数項目、かつ重複したセレクトボックスの値を変数に置換する。あらかじめセレクトボックスの値には「幅 : 」などの接頭辞を付与しておく
<mt:Ignore>
# =======================
#
# カスタムブロック-グループ
#
# vars:
# __group_html__
# __group_class__
# __group_exclass__
# __group_align__
# __group_bg__
#
# =======================
</mt:Ignore>
<mt:SetVar name="__group_html__" value="" /><mt:SetVar name="__group_class__" value="" /><mt:SetVar name="__group_exclass__" value="" /><mt:SetVar name="__group_align__" value="" /><mt:SetVar name="__group_bg__" value="" />
<mt:BlockEditorBlocks>
<mt:If name="type" eq="sixapart-select">
<mt:If name="__value__" like="幅 :">
<mt:SetVarBlock name="__group_align__"><mt:Var name="__value__" /></mt:SetVarBlock>
<mt:ElseIf name="__value__" like="背景 :">
<mt:SetVarBlock name="__group_bg__"><mt:Var name="__value__" /></mt:SetVarBlock>
</mt:If>
<mt:ElseIf name="type" eq="sixapart-input">
<mt:SetVarBlock name="__group_exclass__"> <mt:Var name="__value__" /></mt:SetVarBlock>
<mt:Else>
<mt:SetVarBlock name="__group_html__"><mt:Var name="__group_html__" /><mt:Var name="__value__" /></mt:SetVarBlock>
</mt:If>
</mt:BlockEditorBlocks>
<mt:If name="__group_align__" like="広い">
<mt:SetVarBlock name="__group_class__"><mt:Var name="__group_class__" /> echo-mt-be-alignwide</mt:SetVarBlock>
<mt:ElseIf name="__group_align__" like="全体">
<mt:SetVarBlock name="__group_class__"><mt:Var name="__group_class__" /> echo-mt-be-alignfull</mt:SetVarBlock>
</mt:If>
<mt:If name="__group_bg__" like="メイン">
<mt:SetVarBlock name="__group_class__"><mt:Var name="__group_class__" /> echo-mt-be-has-bg u-bg-first</mt:SetVarBlock>
<mt:ElseIf name="__group_bg__" like="サブ1">
<mt:SetVarBlock name="__group_class__"><mt:Var name="__group_class__" /> echo-mt-be-has-bg u-bg-second</mt:SetVarBlock>
<mt:ElseIf name="__group_bg__" like="サブ2">
<mt:SetVarBlock name="__group_class__"><mt:Var name="__group_class__" /> echo-mt-be-has-bg u-bg-third</mt:SetVarBlock>
</mt:If>
<mt:If name="__group_bg__" like="薄">
<mt:SetVarBlock name="__group_class__"><mt:Var name="__group_class__" /> u-bg-fade</mt:SetVarBlock>
</mt:If>
<div class="echo-mt-be-group <mt:Var name="__group_class__" /><mt:Var name="__group_exclass__" />">
<div class="echo-mt-be-group-inner">
<mt:Var name="__group_html__" />
</div><!-- /.echo-mt-be-group-inner -->
</div><!-- /.echo-mt-be-group -->
<mt:Ignore>
# =======================
#
# ページ(一部)
#
# =======================
</mt:Ignore>
<mt:BlockEditorBlocks tag="PageBody">
<mt:If name="type" eq="custom-echo_group">
<mt:Include module="カスタムブロック-グループ" />
<mt:Else>
<mt:Var name="__value__" />
</mt:If>
</mt:BlockEditorBlocks>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment