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

Internal: Have a class/function that splits text into multiple events at max size #294

Open
ShadowJonathan opened this issue May 14, 2022 · 1 comment · May be fixed by #376
Open

Internal: Have a class/function that splits text into multiple events at max size #294

ShadowJonathan opened this issue May 14, 2022 · 1 comment · May be fixed by #376

Comments

@ShadowJonathan
Copy link
Contributor

This is needed for !mjolnir rules, at the very least, to make it possible to display large amounts of listed items.

My thought process is to encapsule these kinds of display events into a seperate structure anyway, to make things like "X rooms: <li><li><li>"/"no rooms" more idiomatic;

(pseudocode)

class Listing:
  header: (str, str) # html + text
  items: [](str, str)

class MultipleListings:
  listings: []Listing

Passing a single Listing would (if needed) chunk up items so that it fits in a series of events, and MultipleListings would have multiple lists with each a header, trying to fit these in a single event if possible.

This'd make the code to pass large lists of items like this more generic, and would allow mjolnir to work even if these lists (like !mjolnir rules) would get too big.

@ShadowJonathan ShadowJonathan changed the title Internal: Have a function that splits text into multiple events at max size Internal: Have a class/function that splits text into multiple events at max size May 14, 2022
@ShadowJonathan
Copy link
Contributor Author

Additionally, for the function actually chunking the text into events, the binary search algorithm can probably be applied to find the "right" size per event quickly and efficiently.

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 a pull request may close this issue.

1 participant