TheDonutProject icon indicating copy to clipboard operation
TheDonutProject copied to clipboard

Added donut.ascii.svg

Open EvanZhouDev opened this issue 2 years ago • 14 comments

Description

Added a new SVG donut with an ASCII design.

This is an alternate implementation to Joe Skeen's original SVG donut; it has been added because it has a different donut design (ASCII).

However, it is not donut-shaped! If anyone has an idea for easily formatting these 4000 lines, please let me know! (@IOKG04 , @joeskeen, @ThatXliner)

Checklist

EvanZhouDev avatar Oct 21 '23 22:10 EvanZhouDev

Once I'm back home (in like 8 hours or so) I could make it donut shaped if you are okay with that.

Alternatively I could first program (or try to at least) an automatic donutification program (you can then use).
Already made a very primitive version for donut.jsfuck, though for actual programming languages it of course has to be a little more complex (so it doesn't split keywords for example). (By automatic donutification program I mean something where you just give it a one line implementation and it outputs a donut, that should work if the programming language follows some assumptions)

IOKG04 avatar Oct 22 '23 05:10 IOKG04

Feel free to do it! I will be making a video about this donut today (without the formatting), so if you want to, you can make a follow-up video about the automatic donut formatting program :)

EvanZhouDev avatar Oct 22 '23 16:10 EvanZhouDev

“Auto donut-formatting” is the exact same problem as code formatting.

Essentially you want to create your own formatter. You can parse the code and re-spit out the tokens with added white space. I would look into tree-sitter as a potential language-agnostic parser.

You can also look at Python’s black formatter for inspiration

ThatXliner avatar Oct 22 '23 19:10 ThatXliner

why do i only see this now after i already made my own parser...

Anyway, i think imma stay with mine, since it it language independent (which is good for languages that arent supported by tree-sitter) and cause I dont want to code this tool in a programming language I dont know.

Still thanks for telling me though :)

IOKG04 avatar Oct 22 '23 21:10 IOKG04

I got the svg kinda working and into a kinda donut shape, but cant identify why it still has the error it has rn (cause I dont know scg syntax and mostly guessed my way here)

Anyone got an idea what could be wrong here?: https://drive.google.com/file/d/1hr6joJIqpGXI2xUXR05GD6t-bfgcuvLT/view?usp=sharing

(also I used the older version with the   instead of , cause otherwise it worked even less)

IOKG04 avatar Oct 23 '23 14:10 IOKG04

Two things, first the fact that content isn't allowed in trailing sections (which I would assume you noticed), and two, I think using spaces in the tspan causes it to indent... with preserve-whitespace, it automatically parses spaces, without need of the escape sequence. (Noticed that a bit late lol)

EvanZhouDev avatar Oct 23 '23 22:10 EvanZhouDev

I guess the only option left is to split the tspan tags at certain points to make it donut-shaped unless you have some other idea?

EvanZhouDev avatar Oct 24 '23 01:10 EvanZhouDev

One unrelated comment - once this gets merged, you need to add the ASCII SVG to the README for this project (so it's easier to show off what the code should be doing)

joeskeen avatar Oct 24 '23 20:10 joeskeen

I guess the only option left is to split the tspan tags at certain points to make it donut-shaped unless you have some other idea?

That's what I would probably do.

joeskeen avatar Oct 24 '23 20:10 joeskeen

@EvanZhouDev I took where you left off and took a stab at donut-ifying the SVG, and I'm very very close... but it currently outputs something that looks like a cryptid. :laughing:

https://gist.githubusercontent.com/joeskeen/5f3487f1ab260575a712e9f18abfed23/raw/43722cc78a810f68dbb0d9da6121b49c919661b0/donut.ascii.svg

See my gist

Edit: I switched out animation: ... linear with animation: ... step-end and now it looks like a donut... for about one second then disappears until the animation resets. I tried updating the gist, but it's being dumb.

https://github.com/EvanZhouDev/TheDonutProject/assets/12286274/8da9f8ee-1b6c-4685-8881-850b1e62f95d

image

joeskeen avatar Oct 25 '23 19:10 joeskeen

I finally got it working! (I've updated my gist)

A total of 1.2 million characters, 824 lines of SVG, and it works! donut ascii animated svg

Here's the closest thing to a screenshot of the code I can get: image image image

joeskeen avatar Oct 25 '23 21:10 joeskeen

I didn't want to push to your branch in case you had a better solution already

joeskeen avatar Oct 25 '23 21:10 joeskeen

Also included in my gist is the NodeJS file I used to generate both the SVG and put it into donut shape. I'm not gonna lie, this has shaken my faith in having an auto-donut formatter where you give it code and it pops out donut-shaped code. Especially with languages like SVG, HTML, etc, where you have both XML stuff and CSS stuff and plaintext stuff you have to be extremely context-aware to know where you can put line breaks and extra spaces. Since every language will have different safe characters to split on and may have different valid split points in different parts of the code, it could be a lost cause to make it work for any language. But... if you do get one working, try it out on all the existing donuts (after collapsing all consecutive whitespaces) and see if it works. It may work for one language, but not many.

joeskeen avatar Oct 25 '23 22:10 joeskeen

@joeskeen This looks great, but is there any reason you know it is kinda flickering up and down? It's a bit jarring 😅

EvanZhouDev avatar Oct 30 '23 01:10 EvanZhouDev