comp.lang.ada
 help / color / mirror / Atom feed
* AWS template documentation help
@ 2018-12-20 22:35 Michael Hardeman
  2018-12-20 23:39 ` Shark8
  2018-12-21  8:16 ` Per Sandberg
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Hardeman @ 2018-12-20 22:35 UTC (permalink / raw)


Running this code:

Templates.Set_Tag_Separators (Start_With => "'@", Stop_With => "/");
Templates.Insert (Translations, Templates.Assoc ("foo", "'bar/baz"));
Put_Line (Templates.Translate ("test '@foo/one/two/three' test", Translations));

Yields the following error:

raised TEMPLATES_PARSER.TEMPLATE_ERROR : Unknown attribute name "@foo"

I expected it to print:

test 'bar/baz/one/two/three' test

If I remove the initial ' in Start_With it works ok, but if I keep the ' I get this strange error. I assume there might be some undocumented feature for the templates, but I can't find anything having to do with "attribute". Does anyone know what this is?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: AWS template documentation help
  2018-12-20 22:35 AWS template documentation help Michael Hardeman
@ 2018-12-20 23:39 ` Shark8
  2018-12-21  0:12   ` Michael Hardeman
  2018-12-21  8:16 ` Per Sandberg
  1 sibling, 1 reply; 6+ messages in thread
From: Shark8 @ 2018-12-20 23:39 UTC (permalink / raw)


On Thursday, December 20, 2018 at 3:35:43 PM UTC-7, Michael Hardeman wrote:
> Running this code:
> 
> Templates.Set_Tag_Separators (Start_With => "'@", Stop_With => "/");
> Templates.Insert (Translations, Templates.Assoc ("foo", "'bar/baz"));
> Put_Line (Templates.Translate ("test '@foo/one/two/three' test", Translations));
> 
> Yields the following error:
> 
> raised TEMPLATES_PARSER.TEMPLATE_ERROR : Unknown attribute name "@foo"
> 
> I expected it to print:
> 
> test 'bar/baz/one/two/three' test
> 
> If I remove the initial ' in Start_With it works ok, but if I keep the ' I get this strange error. I assume there might be some undocumented feature for the templates, but I can't find anything having to do with "attribute". Does anyone know what this is?

Well, first let's simplify. Try replacing the tag-separators with something unique:
 Templates.Set_Tag_Separators (Start_With => "[[", Stop_With => "]]");
and matching alterations in the translation:
 Put_Line (Templates.Translate ("test '[[foo]]/one/two/three' test", Translations));

See if that helps.
(Sorry, I don't currently have AWS installed on this computer.)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: AWS template documentation help
  2018-12-20 23:39 ` Shark8
@ 2018-12-21  0:12   ` Michael Hardeman
  2018-12-21  0:20     ` Michael Hardeman
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Hardeman @ 2018-12-21  0:12 UTC (permalink / raw)


I have done that, 

It works with other delimiters, but when the Start_With starts with ' it seems to fail.

The problem I'm really solve is creating a modern Single Page App, that's served and built in AWS. I'm using polymer 3, they do some very funky stuff. when It's served via the polymer-cli's "polymer serve" command, all javascript module paths that start with @ are served to the browser modified.  

for example:
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';

is modified to
import { PolymerElement, html } from 'node_modules/@polymer/polymer/polymer-element.js';

So in order to emulate this, I need to replace '@polymer/ with 'node_modules/@polymer/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: AWS template documentation help
  2018-12-21  0:12   ` Michael Hardeman
@ 2018-12-21  0:20     ` Michael Hardeman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Hardeman @ 2018-12-21  0:20 UTC (permalink / raw)


So I could make the Start_With => @, which works, but the problem is that's not unique enough. There is an @license comment at the top of their source code that causes AWS to throw an error for non-terminated templates.


On Thursday, December 20, 2018 at 7:12:24 PM UTC-5, Michael Hardeman wrote:
> I have done that, 
> 
> It works with other delimiters, but when the Start_With starts with ' it seems to fail.
> 
> The problem I'm really solve is creating a modern Single Page App, that's served and built in AWS. I'm using polymer 3, they do some very funky stuff. when It's served via the polymer-cli's "polymer serve" command, all javascript module paths that start with @ are served to the browser modified.  
> 
> for example:
> import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
> 
> is modified to
> import { PolymerElement, html } from 'node_modules/@polymer/polymer/polymer-element.js';
> 
> So in order to emulate this, I need to replace '@polymer/ with 'node_modules/@polymer/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: AWS template documentation help
  2018-12-20 22:35 AWS template documentation help Michael Hardeman
  2018-12-20 23:39 ` Shark8
@ 2018-12-21  8:16 ` Per Sandberg
  2018-12-21  9:35   ` Michael Hardeman
  1 sibling, 1 reply; 6+ messages in thread
From: Per Sandberg @ 2018-12-21  8:16 UTC (permalink / raw)


Why not just use the default ones "@_"  and "_@" ??
/P

On 12/20/18 11:35 PM, Michael Hardeman wrote:
> Running this code:
> 
> Templates.Set_Tag_Separators (Start_With => "'@", Stop_With => "/");
> Templates.Insert (Translations, Templates.Assoc ("foo", "'bar/baz"));
> Put_Line (Templates.Translate ("test '@foo/one/two/three' test", Translations));
> 
> Yields the following error:
> 
> raised TEMPLATES_PARSER.TEMPLATE_ERROR : Unknown attribute name "@foo"
> 
> I expected it to print:
> 
> test 'bar/baz/one/two/three' test
> 
> If I remove the initial ' in Start_With it works ok, but if I keep the ' I get this strange error. I assume there might be some undocumented feature for the templates, but I can't find anything having to do with "attribute". Does anyone know what this is?
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: AWS template documentation help
  2018-12-21  8:16 ` Per Sandberg
@ 2018-12-21  9:35   ` Michael Hardeman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Hardeman @ 2018-12-21  9:35 UTC (permalink / raw)


Because I need to serve code I did not write, that is obtained automatically.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-21  9:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20 22:35 AWS template documentation help Michael Hardeman
2018-12-20 23:39 ` Shark8
2018-12-21  0:12   ` Michael Hardeman
2018-12-21  0:20     ` Michael Hardeman
2018-12-21  8:16 ` Per Sandberg
2018-12-21  9:35   ` Michael Hardeman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox