Unexpected token ILLEGAL with dangerouslySetInnerHTML - symfony

I am using Symfony2 framework with reactjs for view part. I have a twig variable having html tags.
So I did this - <span {{"dangerouslySetInnerHTML={{__html: ' "~content|raw~" '}}"}}></span>
But this is giving me following error
Error: Parse Error: Line 95: Unexpected token ILLEGAL
at http://localhost/url/abcd
... ouslySetInnerHTML={{__html: '<p></p><p&g ...
When I write something like <span {{"dangerouslySetInnerHTML={{__html: '<div>abcd</div>'}}"}}></span> , Then everything works fine. But when I use a twig variable, this error is thrown.

I would recommend using twig only to output your delimiters and the variable itself:
<span dangerouslySetInnerHTML={{ '{{' }}__html: '{{ content|raw }}' {{ '}}' }}></span>

Related

Ansible looping Ansible_net_interfaces isn't seeing item.key as defined

No matter how I call the items in the ansible_net _interfaces dictionary it keeps telling me "item" isn't defined. I did a debug and the dictionary has all the values I want just can't call them in the parents line here. Any ideas what I'm doing wrong?
- name: Un-Apply the policy-map sed-input-mark
ios_config:
lines:
- no policy-map sed-input-mark
parents: interface {{ item.key }}
with_dict: "{{ ansible_net_interfaces }}"
Here is Error message:
fatal: [192.168.50.4]: FAILED! => {
"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined\n\nThe error appears to have been in '/home/drojas/networkautorepo/plays/QoSSed/qossedpolicy.yml': line 96, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Un-Apply the policy-map sed-input-mark\n ^ here\n"

Assertion failed in Wijmo: Date expected

While using wijmo input date control wj-input-date error coming Assertion failed in Wijmo: Date expected.
<wj-input-date [(value)]="_deal.AppReceived" [format]="'M/d/yyyy'" class="ibox1 rightalign" [placeholder]="'M/d/yyyy'" [required]="false"></wj-input-date>
same while using wj-input-number error coming Assertion failed in Wijmo: Number expected
<wj-input-number [(value)]="_deal.TotalCommitment" class="ibox1 rightalign" [format]="'n2'"></wj-input-number>
import directive in Typescript
import { WjInputModule } from 'wijmo/wijmo.angular2.input';
use html
<wj-input-number #TotalCommitment [isRequired]="false" [(value)]="TotalCommitment" class="ibox1 rightalign" [format]="'n2'"></wj-input-number>

Blank lines not allowed in multi-line string when using the Yaml component of symfony?

<?php
$raw = <<<YAML
foo:
bar:
- field1: value
field2: |
bla
bla
bla
YAML;
\Symfony\Component\Yaml\Yaml::parse($raw);
?>
This code results in a ParseException (Using symfony yaml component 2.8.14)
Unable to parse at line 7 (near " bla").
According to this, the syntax is correct. Does anybody know if this is a bug in the Yaml parser of symfony? Could not find anything about it in their docs.

How to add a background image inline style to link tag Rails

I just can't seem to get this right.
In my rails app I am using ActionCable, it has issues with sending over URLs in partials. To fix this I am going to let the CSS do the work of setting the image, only to allow the image to be set dynamically I am going to need to have access to the view hence the fact this has to be inline css.
.message
%a.message_profile-pic{ :href => "", {:style=>"background-image:url('avatar.png')" } }
I have an image called avatar.png in my app/assets/images directory just as a test. It's an empty a-tag for now but it will become a link_to once I sort out the profile sections of the app.
I am getting the following error:
SyntaxError - syntax error, unexpected ')', expecting =>
...nd-image:url('avatar.png')" } )}></a>\n #{
How do I set this? I am using Rails 5 rc1 and Ruby 2.3 with bootstrap.
Note:
I have also tried the new HAML syntax with the same result:
%a.message_profile-pic{ :href => "", style: {background-image: "url('avatar.png')"}}
Edit
Here is what better errors is showing me:
Full stack trace looks like this:
SyntaxError - syntax error, unexpected ')', expecting =>
...nd-image:url('avatar.png')" } )}></a>\n #{
... ^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:6: unknown regexp option - a
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:6: syntax error, unexpected $undefined
));}\n </a>\n <span class='message_timestamp'>\n #{
^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:6: syntax error, unexpected keyword_class, expecting keyword_do or '{' or '('
));}\n </a>\n <span class='message_timestamp'>\n #{
^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:6: syntax error, unexpected $undefined
));}\n </a>\n <span class='message_timestamp'>\n #{
^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:8: syntax error, unexpected '}', expecting tSTRING_DEND
));}\n </span>\n <span class='m...
^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:8: unknown regexp options - pa
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:8: syntax error, unexpected $undefined
...n class='message_star'></span>\n <span class='message_conte...
... ^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:8: syntax error, unexpected keyword_class, expecting keyword_do or '{' or '('
...ge_star'></span>\n <span class='message_content'>\n #{
... ^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:8: syntax error, unexpected $undefined
...<span class='message_content'>\n #{
... ^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:11: syntax error, unexpected '}', expecting tSTRING_DEND
));}\n </span>\n</div>\n", -2, f...
^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:11: unknown regexp options - dv
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:11: syntax error, unexpected $undefined
));}\n </span>\n</div>\n", -2, false);::Haml::Util.h...
^
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:11: unterminated string meets end of file
/Users/ruberto/Personal/Projects/splat/app/views/messages/_message.html.haml:11: syntax error, unexpected end-of-input, expecting tSTRING_DEND:
You can do something like this:
:style => "background-image: url(#{image_path "avatar.png"})"
To find more about image_path.

"XMLCommand.initialize failed: java.lang.NullPointerException" when using dataset-proxy in a workflow databroker

I'm creating a workflow databroker, and in the pre-workflow I am using a dataset-proxy to iterate over the populate-dataset. However I get the following error when I compile:
XMLCommand.initialize failed: java.lang.NullPointerException
at nz.co.aviarc.xml.command.dataset.DatasetProxy.initialize(DatasetProxy.java:35)
at com.aviarc.framework.xml.command.XMLCommandElementImpl.finalize(XMLCommandElementImpl.java:90)
at com.aviarc.framework.xml.compilation.XMLSAXHandler.endElement(XMLSAXHandler.java:336)
at net.sf.saxon.event.ContentHandlerProxy.endElement(ContentHandlerProxy.java:391)
at net.sf.saxon.event.NamespaceReducer.endElement(NamespaceReducer.java:213)
at net.sf.saxon.event.ReceivingContentHandler.endElement(ReceivingContentHandler.java:443)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:598)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:673)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1645)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:875)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:798)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1198)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:564)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:404)
at net.sf.saxon.event.Sender.send(Sender.java:193)
at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:30)
at com.aviarc.framework.xml.compilation.AviarcXMLResourceCompiler.compile(AviarcXMLResourceCompiler.java:137)
...
I get exactly the same error even when I use the code example straight out of the documentation (com.aviarc.dataset:1.1.0):
<workflow xmlns:ds="urn:aviarc:xmlcommand:com.aviarc.dataset">
<ds:dataset-proxy dataset="ds" proxyname="dsproxy">
<set-current-row dataset="dsproxy" position="2" />
<set-field field="dsproxy.email" value="test#test.com" />
</ds:dataset-proxy>
</workflow>
Turns out that the documentation is wrong, as proxyname is not a valid attribute on dataset-proxy. I didn't see it at first (because of the huge stack trace) but I was also getting this warning:
Unknown attribute 'proxyname'
The correct attribute is name, not proxyname. Changing this resolved the error.

Resources