-
-
Notifications
You must be signed in to change notification settings - Fork 990
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
Add color=value to [message] #651
Add color=value to [message] #651
Conversation
Well, I'm not against something that means less explicit Pango markup... though a better markup would be even better. |
Can't you simplify it to this:
I think it's clearer to read. |
On one hand, I do agree that your code is clearer. On the other hand, the intent I had when writing it as I did was that it could be easily expanded to cover all pango markup options with a simple copy/paste/edit. So supporting fonts, for example, would look like this:
|
That's a point, though I don't know if it's a good idea to add more markup shortcut tags. I'd prefer if we kept to raw markup. |
I suppose. Though in the situation where the intent is to apply markup to the whole message, wrapping the entire thing in a |
I hate the raw markup, so I wouldn't be strongly opposed to adding more format options to [message]. However, the downside of implementing format options in this way is that it only applies to [message], and if you want to add similar support to other tags, you'll need to do that separately. (Which could mean reimplementing it, or potentially moving the current function to wml-utils.lua and making it a little more generically usable.) It'd be nice if we could use something simpler such as Markdown for formatting, but that's a separate issue. |
cfg.message is usually a translatable string, which Lua sees as a
That can be simplified as just
Actually, until version 1.6 we used to have something to that effect. I'm copying this from an old version of our InterfaceWML wiki page:
|
I think the translatable string metatable does include
That's also a terrible system though, because it only checks the first character. (Or maybe the first character of every line?) It's not a proper markup syntax. Still, something based on that would be better than the Pango markup in my opinion. |
I updated the add_formatting function to simplify it a bit, as well as to make it more generic - it is now able to wrap any string passed to it in a As for the whole markup debate, I would probably have still submitted the PR regardless of what was used, since it will always look cleaner to separate the meaningful text from the description of how to display the text. Ultimately, I think the best solution would be if we could make our own stylesheets, so instead of things like I'd still be here asking for a style=value attribute though. |
I don't mean to nag or anything, but is there something else I need to do for this to move forward? Or do I just wait? |
Mostly I think it's just waiting for someone to get around to it. It would be good to add changelog and (if this is your first contribution) credits entries though. |
And, um... how would I go about adding files to this pull request? |
What do you mean? If you're adding files, just commit them regularly and push them to the forked branch. |
I've made the changes to my forked branch to changelog and about.cfg, but they aren't showing up here. |
Are they in the Pentarctagon-message-color branch? Did you make sure to push the changes to that branch? |
Well... I can't anymore, actually. I merged that into my fork, and it closed the pull request I used to open this one. In fact the 2nd and 3rd commits made to message.lua here aren't even in my fork. |
You need to have the original base branch in order to add new commits, I think. |
While a shortcut like that is convenient, I'm a bit bothered by how it's different from every other color-defining key. Others such as [label], [unstore_unit], [print] and such always let you specify the color as normal 0-255 RGB (either as color= or red,green,blue=), whereas this one breaks that rule and only takes a pango color. So I'd say this would need to take the color as 0-255 RGB and pango-specific syntax shouldn't "leak" outside the actual pango markup. |
So you're saying it should allow both color= and red,green,blue= ? Or just one of those? Also, should it specifically not support hex colors and only allow decimal RGB? |
color= is enough. Don't use red= green= blue=. |
Added support for RGB decimal values. The follow code all displays as expected:
edit - unless there are any objections, I will add support for all the available pango markup attributes as well. |
|
|
Also, I read through the whole PR for changing the copyrights, and if this ends up committed, the copyright can go to the BfW project. |
Cover case of a non-existent WML variable being used, which is passed to lua as an empty string rather than nil. Also if for some reason an actual empty string is set as the attribute value.
Made this request, then realized I could do it myself.