Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added donut.ascii.svg #27

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Added donut.ascii.svg #27

wants to merge 5 commits into from

Conversation

EvanZhouDev
Copy link
Owner

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

@IOKG04
Copy link
Contributor

IOKG04 commented Oct 22, 2023

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)

@EvanZhouDev
Copy link
Owner Author

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

@ThatXliner
Copy link

“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

@IOKG04
Copy link
Contributor

IOKG04 commented Oct 22, 2023

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
Copy link
Contributor

IOKG04 commented Oct 23, 2023

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)

@EvanZhouDev
Copy link
Owner Author

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
Copy link
Owner Author

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?

@joeskeen
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

joeskeen commented Oct 25, 2023

@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. 😆

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.

2023-10-25.13-56-41.mp4

image

@joeskeen
Copy link
Contributor

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
Copy link
Contributor

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

@joeskeen
Copy link
Contributor

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.

@EvanZhouDev
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants