如何用zen编码增加价值?

时间:2011-04-23 08:38:49

标签: input emmet

我喜欢在输入zen编码时添加值。例如,输入:文本变为:。如何使输入:文本成为并将键盘光标置于'value属性?'/ / p>之间

6 个答案:

答案 0 :(得分:3)

@Moon

这是我使用的技巧。

select>option#$*5  // this would give the following HTML <select>

<select>
  <option id="1"></option>
  <option id="2"></option>
  <option id="3"></option>
  <option id="4"></option>
  <option id="5"></option>
</select>

然后,在文本编辑器中选择整个<select>块 然后,将所有"<option id"替换为"<option value"

干杯: - )

答案 1 :(得分:3)

如果通过定义应包装的值(在打开和关闭标记之间)来确定值,则使用以下模式

b{this is a bold text}

导致

<b>this is a bold text</b>

虽然我不知道编辑器和IDE支持这个功能,但我只能说它适用于IntelliJ和Notepad ++。

答案 2 :(得分:1)

添加 table>tr*5>td*5>lorem10

将生成:

<table>
            <tr>
                <td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia, aperiam.</td>
                <td>Sit eius temporibus optio reprehenderit itaque blanditiis harum consectetur rerum.</td>
                <td>Ex, odit, nostrum quia nemo consequuntur quisquam corrupti ipsam quis.</td>
                <td>Voluptatibus, cum, aspernatur rem officia recusandae similique saepe praesentium nulla.</td>
                <td>Labore, obcaecati iure rerum beatae dignissimos fugit sapiente! Sequi, fugit.</td>
            </tr>
            <tr>
                <td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Culpa, totam.</td>
                <td>Officiis, dolores facilis non vitae eius accusamus consequatur magnam incidunt!</td>
                <td>Voluptates repellendus delectus illo facilis at provident unde sint error!</td>
                <td>Quibusdam, nisi, reprehenderit incidunt rem a ducimus sint expedita molestias?</td>
                <td>Quam, laborum rerum unde quaerat fuga architecto odio voluptatum nemo.</td>
            </tr>
            <tr>
                <td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. In, architecto.</td>
                <td>Maiores, voluptatum modi sunt iure aperiam aut quisquam nobis suscipit?</td>
                <td>Repellendus, amet vero modi inventore ipsam libero culpa animi debitis.</td>
                <td>Earum consequuntur ut totam possimus provident libero ad commodi esse!</td>
                <td>Reprehenderit, quo, et laboriosam inventore error quas facilis dignissimos voluptate.</td>
            </tr>
            <tr>
                <td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maxime, necessitatibus.</td>
                <td>Officiis maxime praesentium repellendus distinctio cum atque aspernatur animi dolorum.</td>
                <td>Culpa pariatur quos quis voluptate ratione eos unde accusantium quisquam.</td>
                <td>Id possimus nisi sequi nostrum cum pariatur eius vel commodi.</td>
                <td>Velit, et, iure incidunt illum culpa cum nihil quidem perferendis.</td>
            </tr>
            <tr>
                <td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est, ab?</td>
                <td>Labore, voluptatem quasi temporibus fugit cumque possimus obcaecati id dolor?</td>
                <td>Asperiores hic maiores architecto alias commodi ea in suscipit unde!</td>
                <td>Distinctio, quasi reprehenderit tempora ipsa nisi ad ut eaque numquam!</td>
                <td>Nobis, illum ex excepturi quaerat mollitia animi vero repellat quam.</td>
            </tr>
        </table>

答案 3 :(得分:0)

据我所知,你不能 - 至少不是默认的Zen Coding标准。至少有一个项目尝试向Zen Coding添加值和一些基本逻辑(如循环),请参阅https://github.com/zodoz/jquery-ZenCoding。这是一个Javascript实现,请注意。

答案 4 :(得分:0)

您可以使用方括号向标记添加属性,因此编写input:text[value]会创建<input type="text" name="|" id="|" value="|"> - 输入带有三个占位符位置,两个通用位置,附带:text和来自value的{​​{1}}属性。

答案 5 :(得分:0)

我用过的东西..

select>option[value=$].gameSize${$x$}*10

将生成

<select name="" id="">
<option value="1" class="gameSize1">1x1</option>
<option value="2" class="gameSize2">2x2</option>
<option value="3" class="gameSize3">3x3</option>
<option value="4" class="gameSize4">4x4</option>
<option value="5" class="gameSize5">5x5</option>
<option value="6" class="gameSize6">6x6</option>
<option value="7" class="gameSize7">7x7</option>
<option value="8" class="gameSize8">8x8</option>
<option value="9" class="gameSize9">9x9</option>
<option value="10" class="gameSize10">10x10</option>
</select>

所以,$会扩展到相应的数字......无论你把它放在哪里!

我正在使用带有Sublime Text 2的Emmet插件。