Inserting HTML character codes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Inserting HTML character codes

horrido
I'm trying to insert a copyright symbol into HTML text, but I don't know how to do that with Amber. Here's my code snippet:

Silk P: {'style'->'font-size:14px;'. 'Copyright (c) 2015 Pathway Productions Inc.'}.

I would like to replace "(c)" with "©".

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Inserting HTML character codes

Herby Vojčík
Richard Eng wrote:
> I'm trying to insert a copyright symbol into HTML text, but I don't
> know how to do that with Amber. Here's my code snippet:
>
> Silk P: {'style'->'font-size:14px;'. 'Copyright (c) 2015 Pathway
> Productions Inc.'}.
>
> I would like to replace "(c)" with "©".

Hm.

I think there is no support for raw HTML (string "©" is raw HTML) atm.

You may try to insert the character directly (entity just encodes the character above 7bit ASCII set),
or make helper rawHtml method somewhere, something like

  rawHtml: aString
  <var f = document.createDocumentFragment(); f.innerHTML = aString; return f._asSilk();>

The classic web module has an entity: method which does similar thing (wraps an entity using jQuery and returns the character it represents).

Herby

>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to amb
[hidden email]
> <mailto:[hidden email]>.
> For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Inserting HTML character codes

Herby Vojčík
In reply to this post by horrido
Richard Eng wrote:
> I'm trying to insert a copyright symbol into HTML text, but I don't know
> how to do that with Amber. Here's my code snippet:

I release new version on DOMite. Update by deleting bower_components
then doing bower install in your project.

>
> Silk P: {'style'->'font-size:14px;'. 'Copyright (c) 2015 Pathway
> Productions Inc.'}.
>
> I would like to replace "(c)" with "&copy;".

It now installs String >> htmlTextContent method. So you can do:

   Silk P: {
     'style'->'font-size:14px;'.
     'Copyright &copy; 2015 Pathway Productions Inc.' htmlTextContent
   }.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.