Created
January 30, 2014 09:35
-
-
Save shgtkshruch/8705343 to your computer and use it in GitHub Desktop.
create table by jade mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table class="orenge"> | |
<tbody> | |
<tr> | |
<th class="apple">name</th> | |
<th class="apple">birthday</th> | |
<th class="apple">tel</th> | |
<th class="apple">mail</th> | |
</tr> | |
<tr> | |
<td class="cherry">shgtkshruch</td> | |
<td class="cherry">Thu Jun 15 2000 09:00:00 GMT+0900 (JST)</td> | |
<td class="cherry">090-1010-2020</td> | |
<td class="cherry">example@email.com</td> | |
</tr> | |
<tr> | |
<td class="cherry">shgtkshruch</td> | |
<td class="cherry">Thu Jun 15 2000 09:00:00 GMT+0900 (JST)</td> | |
<td class="cherry">090-1010-2020</td> | |
<td class="cherry">example@email.com</td> | |
</tr> | |
</tbody> | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include ./mixin.jade | |
+table_th(index.table).orenge.apple.cherry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index: | |
table: | |
th: | |
- name | |
- birthday | |
- tel | |
td: | |
- td: | |
- shgtkshruch | |
- 2000-06-15 | |
- 090-1010-2020 | |
- example@email.com | |
- td: | |
- shgtkshruch | |
- 2000-06-15 | |
- 090-1010-2020 | |
- example@email.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mixin table_th(table_name) | |
- var classString = attributes.class | |
- var classArray = classString.split(' ') | |
table(class= classArray[0] === 'n' ? '' : classArray[0]) | |
tr | |
each th in table_name.th | |
th(class= classArray[1] === 'n' ? '' : classArray[1])= th | |
each t in table_name.td | |
tr | |
each td, i in t.td | |
td(class= classArray[2] === 'n' ? '' : classArray[2])= td |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment