流程图的语法大体分为两段,第一段用来定义元素,第二段用来连接元素
定义元素
tag=>type: content:>url
tag:就是一个标签,在第二段连接元素时用
type:是这个标签的类型,从上段内容看有6中类型,非别为:
start
end
operation
subroutine
condition
inputoutput
content:流程语句中放置的内容
注意: type:与content之间一定要有一个空格,否则会出问题!
url:链接,与流程语句绑定
连接元素
使用->符号,如:
c2(yes)->io->e
c2(no)->op2->e
代码块
Markdown使用flow定义流程图的代码块
测试
st=>start: Start|past:>http://blog.xiaoyulive.top
e=>end: End:>http://www.xiaoyulive.top
op1=>operation: My Operation|past
op2=>operation: Stuff|current
sub1=>subroutine: My Subroutine|invalid
cond=>condition: Yes or No?|approved:>https://github.com/quanzaiyu
c2=>condition: Good idea|rejected
io=>inputoutput: catch something...|request
st->op1(right)->cond
cond(yes, right)->c2
cond(no)->sub1(left)->op1
c2(yes)->io->e
c2(no)->op2->e
st=>start: start:>http://www.baidu.com
op1=>operation: 操作1
cond1=>condition: YES or NO?
sub=>subroutine: 子程序
e=>end
st->op1->cond1
cond1(yes)->e
cond1(no)->sub(right)->op1
st=>start: Start|past:>http://www.baidu.com
e=>end: Ende|future:>http://www.baidu.com
op1=>operation: My Operation
op2=>operation: Stuff|current
sub1=>subroutine: My Subroutine|invalid
cond=>condition: Yes or No|approved:>http://www.google.com
c2=>condition: Good idea|rejected
io=>inputoutput: catch something...|future
st->op1(right)->cond
cond(yes, right)->c2
cond(no)->sub1(left)->op1
c2(yes)->io->e
c2(no)->op2->e
st=>start: Start
i=>inputoutput: 输入年份n
cond1=>condition: n能否被4整除?
cond2=>condition: n能否被100整除?
cond3=>condition: n能否被400整除?
o1=>inputoutput: 输出非闰年
o2=>inputoutput: 输出非闰年
o3=>inputoutput: 输出闰年
o4=>inputoutput: 输出闰年
e=>end
st->i->cond1
cond1(no)->o1->e
cond1(yes)->cond2
cond2(no)->o3->e
cond2(yes)->cond3
cond3(yes)->o2->e
cond3(no)->o4->e
网友评论