Register / Log in

Server Costs Jun

Ends in 14 days 0%
It is currently Sun Jun 16, 2019 4:41 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Taking Advantage of HTML Entities
PostPosted: Sat Jun 21, 2014 7:21 pm 
Muse

Joined: Fri May 07, 2010 6:57 pm
Posts: 137
Location: The RnP
Faction: Jade Hand

Offline
I was thinking about Phédre's accented name again, and I suddenly recalled the regex that is already in place to catch double quotes and special formatting commands and so on. I've always been a fan of special characters, such as my favoured M Dash and accented/modified characters. However, because writing HTML entities leave SR Classic readers with objectionably distracting strings such as &stuff; and ?, I've been reluctant to take advantage of this property of Skylight.

What I propose is to make special characters readily available to Skylight users whilst maintaining the readability of those characters in SR Classic. To do this, Skylight clients could be adapted to translate HTML entities and their identity codes to intuitive strings upon sending a post to the server, and translate those strings to rendered HTML entities upon pushing in a new post.

For example, it is not uncommon to see the M Dash written as --, and it is clear enough as to not be particularly distracting. But I want my fancy —, so I identify it or copy/paste it into my post (Heck, I could just write --) and hit enter. The server gets -- in any case, and SR Classic users will read the same. Jusque clients will receive -- but convert it to — before rendering.

In my head, the most difficult aspect of this would be design, not implementation (Coming up with a reasonably exhaustive list of conversion pairs that are both intention-readable and unlikely to be Scunthorpe'd). From what I recall last time I went looking through the generated code, the structure already allows for this sort of thing (See Phédre's properly-rendered name in Jusque clients). Of course, it could clog up the client if too many regex operations precede the renderer.

ADDENDUM:
I think it would also be neat if Skylight could render /inline italics/ and *bold phrases*, too; though, I wonder whether or not people would like to keep the formatting symbols visible. Heck, maybe we could just give the Jusque clients a mini pseudo-bbCode renderer.
I can't wait to get home so I can try making some mock-up versions for Katie to make fun of. :secret:

_________________
Image


Last edited by Maya on Tue Jun 24, 2014 12:24 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Taking Advantage of HTML Entities
PostPosted: Sun Jun 22, 2014 4:53 pm 
Developer

Joined: Tue Dec 12, 2006 7:05 am
Posts: 3635
Location: Skybrary Archives
Offline
My gracious how I've missed Maya.


Top
 Profile  
 
 Post subject: Re: Taking Advantage of HTML Entities
PostPosted: Mon Jun 23, 2014 5:39 pm 
Muse

Joined: Fri May 07, 2010 6:57 pm
Posts: 137
Location: The RnP
Faction: Jade Hand

Offline
Is that so? :razz:

_________________
Image


Top
 Profile  
 
 Post subject: Re: Taking Advantage of HTML Entities
PostPosted: Sun Jun 29, 2014 12:32 pm 
Muse

Joined: Fri May 07, 2010 6:57 pm
Posts: 137
Location: The RnP
Faction: Jade Hand

Offline
I wrote a few modifications to the generated code and tested it with Tabris in GreenChat. It seems to work exactly as I had hoped, though there are still many bits to add. So far, the proof of concept is there.

In the helpers.js file, I added a new list of elements that looks like this:
'--': '—',
'a`': 'á',
'`a': 'à',
'e`': 'é',
'`e': 'è',
'i`': 'í',
'`i': 'ì',
'o`': 'ó',
'`o': 'ò',
'u`': 'ú',
'`u': 'ù'

What you type is what the other clients get, but this list is used to find special patterns in incoming posts and render prettier versions of those patterns. Before Skylight goes character-by-character to ensure the post is clean, I inserted a Jquery for-each snippet that goes through and does a split-join replaceall for the list above.

The next step is to convert typed HTML entities to their backwards-compatible cousins before sending a post; after that, I want to do something about inline styling. Unfortunately, I can't publish this on the Chrome webstore, and a direct download won't be accepted by Chrome without getting hacky, so I can only talk about these things instead of sharing, but I'd be happy to send modified source code for those who want to go through the Dev Mode workaround, or in the case that somebody else wants to do something with this.

_________________
Image


Top
 Profile  
 
 Post subject: Re: Taking Advantage of HTML Entities
PostPosted: Sun Jul 06, 2014 6:43 am 
Tally Teller

Joined: Mon Mar 03, 2008 1:20 am
Posts: 388
Faction: Azure League

Offline
Figured I couldn't let all that good mayafruit just rot on the vine, so I did stuff.


Inline Styles

If somebody types
Code:
A *big* fish, a **really big** fish.

you might see
Quote:
A big fish, a really big fish.

as long as at least one of you is in Skylight. The flash client doesn't do bold italic, so Skylight won't either. Just keep it simple.


Fancy Character Substitutions

I put in all Maya's
Code:
Type This        See This
=========        ========
--               —
a`               á
`a               à
e`               é
`e               è
i`               í
`i               ì
o`               ó
`o               ò
u`               ú
`u               ù

plus one more that you'll figure out. If you want to change these, or add more, shout out here. (The relevant code section is here on github if you want to be a real dear with a fork and pull request instead.)

Now, I'm not convinced of the utility of this, I'm not sure what's meant to happen if someone types a`e, I think it might make Phédre's name even a little more problematic, and I fear it might become a bit annoying for people on the flash client. But let's suck it and see.


Note: "Skylight" above refers to the Skylight Chrome extension, version 2014.7.4.0.

_________________
Image


Top
 Profile  
 
 Post subject: Re: Taking Advantage of HTML Entities
PostPosted: Sun Jul 06, 2014 8:28 am 
Muse

Joined: Fri May 07, 2010 6:57 pm
Posts: 137
Location: The RnP
Faction: Jade Hand

Offline
Kathryn, your openness never fails to warm me. :grin:

The issue of a`e is one I hadn't considered; it seems my proof-of-concept needs more proofing.
I'll see about getting a more reliable list of conversions up for your review, and making a formal request regarding the choice of symbolism for the inline styling.

As I've seen, for lack of access to these special characters, Classic users have made up similar mock-ups to represent these characters when needed, so the hope was that to them, little has changed except the standardisation of these symbolic patterns.

The utility is people like myself wanting our beloved special characters. Not a particularly important reason, but one that could come in handy on occasion (particularly in roleplay, where most of the users are on Skylight, anyhow).

Since Phédre's name is converted by its own pattern, which lacks any graves, I don't imagine it ought to be affected by this.

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group