Skip to content

Book img src formatting #115

@Toma400

Description

@Toma400

Books should have a bit simpler formatting than it is suggested on PyGame_GUI guide, at least when it comes to images. Currently, this is how you'd put image via pure PyGame_GUI HTML:

<img src="stats/ansur/assets/london.jpg" float=right>

I assume this means absolute path, which is very rough. I'd suggest using function like that:

def parseBook(book_contents: str) -> str:
  return book_contents.replace('<img src="', f'<img src="stats/{ID}/assets/')

Where ID would be of course related to mod ID of the book - but what's important is that this would allow us to write code like that:

<img src="london.jpg" float=right>

Which is way better, as relative paths should be default for IoA mods, at least in this context (just how other resources were treated).

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestFeature being officially approved to be added

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions