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

code #418

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

code #418

wants to merge 2 commits into from

Conversation

gintama91
Copy link
Collaborator

Description

Image(if needed, helps for a faster review)

Checklist

  • Run tests locally
  • Run linter(check for linter errors)

# frozen_string_literal: true

module Shoes
class Codes < Shoes::Drawable
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm when i use code it giving me superclass mismatch idk if some other gem we using has it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be weird, because it's under Shoes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the superclass mismatch when I check out your branch. Maybe try a "git status" and see if you have any un-checked-in changes that might cause the problem?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that why this PR isn't using code as a widget (e.g.here https://github.com/scarpe-team/scarpe/blob/main/docs/static/manual.md)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we have a code TextDrawable already, called "code". So yeah, this is a bit odd - one called "codes", but also a regular Drawable not a TextDrawable.

So if you declared it as Code, not Codes, you'd get the superclass error because Code is a child of Shoes::TextDrawable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what codes does
Screenshot_20231017_144622

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noahgibbs

should i remove this? i dont think we are using code anywhwere? in examples?

Should we remove the code text drawable, and make this PR code for this part of the spec?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gintama91 btw this looks super cool :)

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really does look awesome :-)

It's true that we have no legacy examples using code(), only more recent ones. In Shoes3, looking at their source, it looks like code (grep for cCode) is a text type, so you can use it like em() inside a para(), and it's basically just monospaced like typewriter font in HTML.

If we accept this, it should definitely be renamed to replace the other code element, not add ones named codes.

@Schwad
Copy link
Collaborator

Schwad commented Dec 4, 2023

I'd love to have this merged if possible, the code looks great, as "code"

@noahgibbs
Copy link
Collaborator

If we merge this as "code" we'll want to figure out how to update the Shoes manual, etc. Because old Shoes already has something called code and it doesn't work like this.

@@ -0,0 +1,3 @@
Shoes.app do
codes "Shoes.app do\n para 'Hello, world!'\nend"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noahgibbs can you explain to me the differences?

Our examples don't have much use of this historically. And the manual says it is a text fragment

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact the only examples are ours. So, I'm possibly willing to go out on a limb for this feature? WDYT?

Copy link
Collaborator

@noahgibbs noahgibbs Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main difference is that one is a text fragment, like em() or strong() or sup(). It goes inside a para. So you'd do something like this:

para "Yup, this is ", strong(em("totally")), code(" made of code"), "!"

Pavan's codes() here is a Drawable like para. It does formatting but doesn't really support other formatting inside it (unless we don't escape the HTML, but Shoes doesn't normally let you just put random HTML in places and have it format correctly.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, given that we now have the ability to add Scarpe-specific extensions, I think it should be one of those.

@gintama91
Copy link
Collaborator Author

If this gets approved , i'll add syntax highlighting ig, dk how exactly but should be easy.

@Schwad
Copy link
Collaborator

Schwad commented Jan 1, 2024

If we merge this as "code" we'll want to figure out how to update the Shoes manual, etc. Because old Shoes already has something called code and it doesn't work like this.

Could we add it as a new optional feature and call it "kode"? I'd like to explore this approach but appreciate that it is not canonical shoes. But in 2023 it's an excellent addition.

It would be v handy for building out a native shoes school I think!

@noahgibbs
Copy link
Collaborator

Yup, as long as we don't use the same name it's fine.

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.

3 participants