向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)

你可能感兴趣的:(向Uliweb find -t 添加查看模板块定义的命令行支持)