Graph-Easy ascii图片绘制

安装

  • 环境:
    • cenos7, X86_64
    • kernel: 3.10.0-862.el7.x86_64
  • 依赖安装包

    1) graphviz, perl-ExtUtils-MakeMaker

    yum install graphviz
    yum install perl-ExtUtils-MakeMaker
    

    2) 通过cpan进行安装

    • perl-CPAN.noarch
    yum install perl-CPAN
    

    3) 运行cpan

    cpan> install Graph::Easy
    ...
    Reading '/root/.cpan/sources/modules/03modlist.data.gz'
    DONE
    Writing /root/.cpan/Metadata
    Graph::Easy is up to date (0.76).
    
  • 下载安装包安装

    1) 通过https://metacpan.org查找,Graph::Easy下载, 验证时需要安装 Test::More

    wget https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Graph-Easy-0.76.tar.gz
    wget https://cpan.metacpan.org/authors/id/E/EX/EXODIST/Test-Simple-1.302168.tar.gz
    

    2) 编译

    $ tar -zxvf Test-Simple-1.302167.tar.gz
    $ cd Test-Simple-1.302167
    $ make install
    $ tar -zxvf Graph-Easy-0.76.tar.gz
    $ perl Makefile.PL
    $ make test
    $ make install
    

demo

画个图验证一下

# cat page1.txt
[page1||
page2||
page3||
page4||
page5||]{basename:parent}

[page1||
page2||
page3||
page4||
page5||]{basename:ram}

[page1||
page2||
page3||
page4||
page5||]{basename:child}

[child.1]{flow: west} -> [ram.1]
[parent.1]{flow: east} -> [ram.1]

[child.3]{flow:west} -> [ram.3]
[parent.3]{flow:east} -> [ram.2]

输出结果,看上去还不错 🙂


+-------+ +-------+ +-------+ | page1 | | page1 | | page1 | +-------+ +-------+ +-------+ | | | | | | | page2 | --> | page2 | <-- | page2 | +-------+ +-------+ +-------+ | | | | | | | page3 | +> | page3 | | page3 | +-------+ | +-------+ +-------+ | | | | | | | | page4 | -+ | page4 | <-- | page4 | +-------+ +-------+ +-------+ | page5 | | page5 | | page5 | +-------+ +-------+ +-------+

相关文档

Graph::Easy – Manual – Introduction

参考

ASCII Art:使用纯文本流程图
graph easy绘制ascii简易流程图

Be First to Comment

发表回复