Nitrogen 学习过程实录(12)

7、Nitrogen 的元件(elements)

元件是构成Nitrogen动态网页的代码片断。元件由Erlang的记录(record)和支持模块(.erl文件)组成,用以告知编译器(rendering engine,直译是“渲染机”,感觉不符合汉语习惯),如何翻译成HTML内容。

许多Erlang元件有HTML的同等对应。例如,元件#span直接译成<span>。

(1) Nitrogen元件的标准属性

id – 元件的名字。

actions – 元件的行为。后面会讲述。

show_if – 值为true或false以显示或隐藏该元件。

class – 元件的CSS类名称。 

style – 元件的CSS风格。

大多数元件还有其他特别属性。例如,元件#panel创建HTML标签div,其中就有属性body。元件#checkbox,创建HTML标签checkbox,其中包含着另一个元件text,用以管理checkbox中的文字。

(2) 元件树

元件可以组合成列表,或者嵌套构成复合结构。例如:

Body = #body { body=[

    #panel { body=[

        #label { text="This is a label." },

        #label { id=label1, text="This is another label with a name." },

        #button { id=button1, class=mybutton, text="Push Me" }

    ]}

]}

(3) 直接使用HTML正文

Nitrogen允许你在动态网页中,在元件外部直接书写HTML正文。例如:

Body = #body { body=[

    #panel { body=[

        #label { text="This is a label." },

        "This is some <b>plain</b> HTML.",

        #label { text="This is another label." },

        " 

        This is some more HTML. Erlang allows for multiline strings

        as long as you escape your double-quotes like this (/").

        " 

    ]}

]}

(4) 创建自定义元件

这十分简单。

首先,定义记录如下:

-record(myelement, {?ELEMENT_BASE, attr1, attr2}). 

然后,创建名为element_myelement的支持模块。你的模块应该导出函数render(ControlID, Record),由其返回编译后的HTML正文。

render(ControlID, Record)

ControlID – 元件在HTML正文中的id。

Record – 类型为myelement的记录,其中的参数用以创建自定义控件。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Rab GTPases serve as master regulators of membrane trafficking. They can be activated by guanine nucleotide exchange factors (GEF) and be inactivated by GTPase-activating proteins (GAPs). The roles of some GAPs have been explored in Saccharomyces cerevisiae, but are largely unknown in filamentous fungi. Here, we investigated the role of GAP Gyp3 gene, an ortholog of S. cerevisiae Gyp3, in an entomopathogenic fungus, Metarhizium acridum. We found that MaGyp3 is mainly localized to the endoplasmic reticulum (ER) of vegetative hyphae, nuclei of mature conidia, and both ER and nuclei in invasive hyphae. Lack of MaGyp3 caused a decreased tolerance to hyperosmotic stress, heat-shock and UV-B radiation. Moreover, the ΔMaGyp3 mutant showed a significantly decreased pathogenicity owing to delayed germination, reduced appressorium-mediated penetration and impaired invasive growth. Loss of MaGyp3 also caused impaired fungal growth, advanced conidiation and defects in utilization of carbon and nitrogen sources, while overexpression of MaGyp3 exhibited delayed conidiation on nutrient-rich medium and conidiation pattern shift from microcycle conidiation to normal conidiation on nutrient-limited medium. Mavib-1, a tanscription factor invloved in conidiation by affecting nutrient utilizaiton, can directly bind to the promoter of MaGyp3. ΔMaGyp3 and ΔMavib-1 mutants shared similar phenotypes, and overexpression mutants of MaGyp3 and Mavib-1 (Mavib-1-OE) exhibited similar phenotypes in growth, conidiation and pathogenicity. Reintroduction of the Magyp3 driven by strong promoter gpd in ΔMavib-1 mutant recovered the defects in growth and conidiation for dysfunction of Mavib1. Taken together, our findings uncovered the role of GAP3 in a filamentous pathogenic fungus and and illustrated the upstream regulatory mechanism by direct interaction with Mavib-1.请用nature杂志的风格润色成学术论文的形式。
02-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值