Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-08-10 10:46:37

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Generate flow charts from if/else code blocks

This caught my eye recently. Note the attachments, particularly the flow chart for the if/else blocks. I have never considered this visual approach, I’ve always just gone for the code route and sort of gone into The Matrix mode with text and left it at that.

Is there something can do this flow chart stuff automatically, either as an IDE function/extension? I realise it’ll have to learn the Textpattern if/else. There are plenty of open source/libre charting apps, I’m just trying to minimise the friction of writing code and visualising it (since now I’m sort of kicking myself I didn’t think of this sooner).

Offline

#2 2020-08-11 04:39:54

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Generate flow charts from if/else code blocks

I do these kind of flow charts constantly (both for txp and my architecture), alas not as beautiful, and many times on paper, using almost extinct technologies, like pencils.

I think the one you pointed to has been generated manually.

> Edited to add: It’s a great idea for an admin side plugin which may even help with debugging.

Last edited by colak (2020-08-11 06:43:24)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2020-08-11 08:55:36

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Generate flow charts from if/else code blocks

Not entirely sure, as I haven’t used it for about 10 years, but vaguely remember Adobe Dreamweaver having a flowchart mode.

EDIT: oh, it seems they removed that after Dreamweaver MX become CS. Ignore me.

Offline

#4 2020-08-11 08:59:35

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Generate flow charts from if/else code blocks

Looks like VS Code has an extension that does something like that marketplace.visualstudio.com/items?itemName=AleksandarDev.vscode-sequence-diagrams

There’s more than likely extensions for other IDEs that do this in some way too.

Offline

#5 2020-08-16 13:08:38

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Re: Generate flow charts from if/else code blocks

Nice one, Phil – thank you.

Offline

#6 2020-08-30 20:38:02

giz
Member
From: New Zealand
Registered: 2004-07-26
Posts: 259
Website

Re: Generate flow charts from if/else code blocks

A long time ago I used Omnigraffle (Mac only) for this. Surprise: my old (circa 2002) version still works on Catalina!

https://www.omnigroup.com/omnigraffle

Offline

#7 2020-08-30 23:26:28

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,072
Website Mastodon

Re: Generate flow charts from if/else code blocks

giz wrote #325665:

A long time ago I used Omnigraffle (Mac only) for this. Surprise: my old (circa 2002) version still works on Catalina!

https://www.omnigroup.com/omnigraffle

working on Mac OS Sierra


…. texted postive

Offline

#8 2020-08-31 09:46:57

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Re: Generate flow charts from if/else code blocks

giz wrote #325665:

A long time ago I used Omnigraffle

Thank you. Yep, I’ve got a licence for that…somewhere…haven’t used it in time!

I was looking for something specifically that could interpret Textpattern conditional tags and visually show what the flow route would be, rather than having to build out the chart myself.

Offline

#9 2020-08-31 17:32:22

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Generate flow charts from if/else code blocks

Txp tags regex being rather specific, I doubt some app would do it out of the box. But a plugin based on txp_tokenize() function shouldn’t be too complex to write… with enough motivation :-)

Offline

Board footer

Powered by FluxBB