In atom text editor, I'm not able to use jinja, it is not taking or reading the variable name - jinja2

here are the image of the code which i was working on .
this the output
this is the code which I was working on .

Related

Csv and text editor showing different values

When I open the csv , it shows 0.103945 as value . But when i open it in text editor the value is shown as 0.10394500000000001 . Why this problem occurs when we open in csv and text editor?
Because of this issue I'm having problems. Is there any way to fix this issue and the csv is generated through java code.

Searching a directory of files for matching string, when found append specified text to the end

I currently have thousands of .html & .htm files which all have a consistent banner at the top of the page. Some of the attributes may be in different locations within the tag, but they all begin with img src=. I want to find the banner - enclosed within an img tag - in all of these files, locate the closing '>' and then append another image directly after it.
So I want to find
<img src="images/banner.jpg".*>$ and append immediately after it
<img src="images/new-banner.jpg> so that it would look like
<img src="images/banner.jpg width="x" height="x">
<img src="images/new-banner.jpg">
I know, "regex can't be used to parse HTML" as stated here. But really, I think it should say that regex shouldn't be used to parse HTML, because can't is a powerful word and isn't truthful in this instance.
If you have a recommendation of how I can achieve the same result without regex, I'm happy to try other alternatives. I am after the result and I am not closed off to suggested methods of getting there.
What I current have is this
Select-String -Pattern '<img src="images/banner.jpg".*>$' *.htm -AllMatches | % { $_.Matches } | % { $_.Value }
This gets me halfway there. It returns the found match in its entirety, however, I am not sure how to proceed such that I can append my desired string immediately following the closing >
Thank you all for your time and thoughts :).
Here's one way to do it...
Open your IDE of choice that supports regex Find & Replace across multiple files. I'll use the free Visual Studio Code for the following steps:
File > Open... and select the root folder containing all of your files (if they're buried in subfolders, that's fine).
Edit > Replace in Files and click the Use Regular Expression toggle (the icon with .* on it).
Insert this in the Find box: src="images/banner\.jpg"(.*?)>
Insert this in the Replace box: src="images/banner.jpg"$1>\n<img src="images/new-banner.jpg">
Preview the change and click Replace All if you're ready!
Hope this helps.

Trouble with printing <bbb>-constructs in perl

I have a small CGI perl script that I would like to print a file containing plain text to be output as html. So far, so god, however, the file contains some text enclosed with < and >, ie. <bbb>. The problem is that the <bbb> are removed. The same happens when I do a simple print statement like this:
print "aaa <bbb> ccc";
displays
aaa ccc
I have searched around, but not been able to find the solution. Amongst others, I have found this Printing string in Perl, but can't really see how the answer applies?
Are you displaying the output in a web browser? Then try
print "aaa <bbb> ccc";
and see the HTML::Entities module if you'll need to make conversions like this on other lines of text.

MVC shows the htmlcode inside my webpage that is created by tiny mce

I am using tiny mce (a kind of editor like fckeditor ) .so i use that to get my news content .
when i save the content of tiny mce textbox something like this is saved to the database :
<p>this is a test&nbsp;</p>
<p>good luck</p>
I use the #html.raw(newstext) .But the browser shows this :
best regards.
The content is stored in your database as encoded HTML so to display it you need to decode. So this should work:
#Html.Raw(HttpUtility.HtmlDecode(newstext))
Or you can most likely drop the Raw method too and just go with:
#HttpUtility.HtmlDecode(newstext)

tab expansion of snippets in sublime text 2?

I'm trying to create a simple snippet in ST2 that will be expanded when I type in a bit of text and hit tab.
I've gone to 'tools'->'create new snippet'. I've edited the template thus:
<snippet>
<content><![CDATA[
<?php ${1} ?>
]]></content>
<tabTrigger>php</tabTrigger>
<scope>source.php</scope>
</snippet>
I'd like to be able to enter 'php', and have the string expanded as ''.
I've saved the snippet in the default location presented to me when I've hit 'save as'.
However, I'm not getting the desired result. After restarting ST2, and opening a php file, and making sure the file is being read as php, I'm not getting my desired expansion.
How do I get the expansion?
1. Did you save correctly your snippet file ?
Snippets should be saved as Snippet1.sublime-snippet, preferably in Packages/User
2. Did your tabTrigger has the same name as another one ?
It is not really an issue, here php is already used as a snippet by Sublime Text2, since you can choose which one to use, but we're never too careful. Try a different one, like newphp or phptags.
3. Did you use Sublime Text 2 Documentation?
For example you can look at Snippets Documentation here.
Your code:
<snippet>
<content><![CDATA[<?php ${1} ?>]]></content>
<tabTrigger>newphp</tabTrigger>
<scope>source.php</scope>
</snippet>
works fine if you save the file as .sublime-snippet in Packages.