向Uliweb find -t 添加查看模板块定义的命令行支持

今天应 rainwoods 的建议,向uliweb的find -t命令添加了 --blocks 和 --with-filename 的支持。这两个都是和 -t 一起使用的。其中 --blocks 将显示查找模板中都定义了哪些块。比如:

D:\project\mywork\uliwebzone>uliweb find -t TutorialView/index.html --blocks
apps/tutorials/templates/TutorialView/index.html

-------------- Blocks --------------
    html_tag
    meta
    title
    _css
    body_tag
    before_header
    header
        project
        nav
        user_info
    content
        content_main
    footer_container
        footer
    after_footer

上面只是看出一个简单的关系。如果还想知道每个block都是在哪个模板中定义的(因为Uliweb的模板和django一样是可以继承的,所以模板一多就变得复杂了),可以再加一个 --with-filename,这样在每个block后面还会显示生效的模板文件名。如:

D:\project\mywork\uliwebzone>uliweb find -t TutorialView/index.html --blocks --with-filename
apps/tutorials/templates/TutorialView/index.html

-------------- Blocks --------------
    html_tag   (d:/project/mywork/plugs-git/plugs/ui/bootstrap/templates/bootstrap/bootstrap_layout.html)
    meta   (d:/project/mywork/plugs-git/plugs/ui/bootstrap/templates/bootstrap/bootstrap_layout.html)
    title   (apps/tutorials/templates/tutorial_layout.html)
    _css   (d:/project/mywork/plugs-git/plugs/ui/bootstrap/templates/bootstrap/bootstrap_layout.html)
    body_tag   (d:/project/mywork/plugs-git/plugs/ui/bootstrap/templates/bootstrap/bootstrap_layout.html)
    before_header   (apps/project/templates/layout_container.html)
    header   (d:/project/mywork/plugs-git/plugs/ui/bootstrap/templates/bootstrap/bootstrap_layout.html)
        project   (d:/project/mywork/plugs-git/plugs/layout/bootstrap/templates/layout_container.html)
        nav   (d:/project/mywork/plugs-git/plugs/layout/bootstrap/templates/layout_container.html)
        user_info   (apps/project/templates/layout_container.html)
    content   (d:/project/mywork/plugs-git/plugs/ui/bootstrap/templates/bootstrap/bootstrap_layout.html)
        content_main   (apps/tutorials/templates/tutorialview/index.html)
    footer_container   (d:/project/mywork/plugs-git/plugs/ui/bootstrap/templates/bootstrap/bootstrap_layout.html)
        footer   (d:/project/mywork/plugs-git/plugs/layout/bootstrap/templates/layout_container.html)
    after_footer   (d:/project/mywork/plugs-git/plugs/ui/bootstrap/templates/bootstrap/bootstrap_layout.html)

转载于:https://my.oschina.net/limodou/blog/170888

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值