How to create Snippet for .sublime-snippet file? - sublimetext2

How to create Snippet for .sublime-snippet file?? ON SUBLIME-TEXT 2
<snippet>
<content><![CDATA[
<tabTrigger>${1}</tabTrigger>
]]></content>
<tabTrigger>tabt</tabTrigger>
<scope>source.sublime-snippet</scope>
<description>Snippet sublime</description>
</snippet>
this snippet code does not work for sublime.snippet file

The scope of the snippet is text.xml typo in my comment, sorry about that. You can identify the scope of the file by pressing ctrl+alt+shift+p in Windows and Linux or cmd+alt+p in OS X.

Related

visual studio code not recognizing html files

VS code has suddenly stopped recognizing html files (the file icon is the default one for files with no extension)
all other file extensions work just fine
except for html
the tags still work but it won't autocomplete
Adding this to file extensions worked for me:
"files.associations": {
"*.html": "html"
}
In my case, for this problem the solution was to manually add *.html to files.associations, in user settings. Its unlogical but it seems that somehow the extension wasn't associated to the type of file. Now everything works perfectly...
Go to the settings (In mac it is Code -- > Preferences --> Settings)
In the search bar search for Association.
In Files:Associations click on Add items.
update key = *.html & Value = html
Below is the screenshot for reference.
I had the same issue but none of the other solutions worked for me!
You can try this:
Go to the path where the "settings.json" file exits, for my case the path is:
C:> Users> User123 > AppData > Roaming > Code > User > settings.json
Now, paste the code in the file:
"code-runner.executorMap": {
"html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\"",
}
Now search for the "files.associations" section in your settings.json file:
As an example
Now if you have the "files.associations" section then just add the line there:
"*html": "html"
(don't forget to write a comma after a line if there are more lines in it)
or if you don't have a "files.associations" section, then copy paste the code there:
"files.associations": {
"*.rmd": "markdown",
"*html": "html"
},
I had the same problem in Windows 10 a few minutes ago:
Yeah, from the solutions above I did this but still had some errors:
File -- > Preferences --> Settings
In the search bar search for Files: Association.
In Files:Associations click on Add item button.
update Item = *.html & Value = HTML
As shown below:
When I saved, I got this error
Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.
The problem is that terminal.integrated.shellArgs settings have been deprecated.
One of the answers here will help:
So I just had this problem and I figured it out the problem was from an extension that I installed which is the pyscript extension I disabled it and everything started to work again!
Well if you have pyscript extension installed, disable it. It has conflicts with html files I guess.
Or if you don't want to disable it just ctrl+shift+p then change language mode. Select configure file association for html.
This applies for any extension not just pyscript. For me it was pyscript

open topic in merged chm file in master chm file window

I would like to open topic in merged chm file in master chm file windows.
I have main chm file of application help. So this main chm file includes sub chm file. And I would like to open the topic in sub (merged) chm file in the window of main chm file by calling htmlhelp function.
The following is header file in main chm project.And operation\ACORD_geometry.chm is merged chm file. Now I'm using Adobe robohelp.
[ALIAS]
IDH_operation_geometry=operation\ACORD_geometry.chm:\HID_geometrytab_functions.htm
[MAP]
#define IDH_operation_geometry 9001
And I call htmlhelp function by following way. But The topic don't open. .\help\3DFEMGeo.chm is main chm file.
HtmlHelp(Application.Handle, '.\help\3DFEMGeo.chm', HH_HELP_CONTEXT, 9001);
Please teach me the way to open topic in the sub chm.
Creating modular help systems has some benefits by merging indexes and TOCs of multiple help projects, but overcoming the wall is difficult some times. Some parts of the following instructions have been posted many years ago by Sean Stagmer. For context-sensitive help see also content and links at the bottom:
http://www.help-info.de/en/Help_Info_HTMLHelp/hh_context-id.htm
Long story short (HTH - please try for your needs and environment):
// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:Master.chm::/SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:Master.chm::/SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET
And the stories long version:
RoboHelp e.g. and many other Help Authoring Tools (HAT's) are a IDE front end for utilizing the Microsoft HTML Help compiler (hhw.exe). The designers of RoboHelp's older versions did a pretty good job of separating the technical aspects of building an HTML compiled help file, but left out several features available if you used the underlying tool directly.
Specifically, modular help. I assume that most people who investigated this topic learned about adding the following to their help project file (the .hhp) to begin designing a modular HTML help system:
// *** BEGIN CODE SNIPPET
[MERGE FILES]
SubHelpSubject1.chm
SubHelpSubject2.chm
...
// *** END CODE SNIPPET
Now, tackling the subject of context-sensitive help AND merged files in a modular design adds a new twist: How can the topic ID be mapped to the appropriate merged HTML file? Being modular, the topic ID is not in the master/host help file, but is instead integrated into it through the merged sub-help project's .chm file. This is accomplished by placing the following code in the master/host master's TOC file:
// *** BEGIN CODE SNIPPET
...
<LI>
<OBJECT type="text/sitemap">
<param name="Name" value="SubHelpSubject1">
</OBJECT>
<OBJECT type="text/sitemap">
<param name="Merge" value="SubHelpSubject1.chm::\SubHelpSubject1.hhc">
</OBJECT>
<LI>
<OBJECT type="text/sitemap">
<param name="Name" value="SubHelpSubject2">
</OBJECT>
<OBJECT type="text/sitemap">
<param name="Merge" value="SubHelpSubject2.chm::\SubHelpSubject2.hhc">
</OBJECT>
...
// *** END CODE SNIPPET
With these two additions (the MERGE FILES statement and the addition to the TOC file) the correct resolving of topic id's to their help topic information is complete, EXCEPT that you notice that the HTML help window shows ONLY the TOC for the sub-help project it mapped to! The master/host TOC doesn't show up at all. What gives?
The answer lies in the alias file for the master/host project. Being a good little HTML help content developer, you knew to map the topic id of interest to the appropriate sub-help file by modifying the simple alias syntax like this:
// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1=Topic_1.htm
HID_TOPIC_ID2=Topic_2.htm
...
// *** END CODE SNIPPET
...to this:
// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET
That little 'ms-its:' thing is very much like the 'http:' or 'ftp:' text you type into a web browser: it's known as an Asynchronous Pluggable Protocol from Microsoft. The '::/' portion of it is a reference; a kind of 'level of indirection' or 'reference alias' in C++ parlance. So, to solve the problem of having the context-sensitive help topic BOTH map to the correct help topic html text AND keep the TOC synchronized with the master, you must add an additional level of indirection to make it work, as shown below:
// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:Master.chm::/SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:Master.chm::/SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET
This can be read as meaning this: "When displaying the help topic HID_TOPIC_ID1 information, open Master.chm, then navigate to SubHelpSubject1.chm's HTML file Topic_1.htm, then move down the page to the bookmark Topic1."
Hooray! Your topic pops up, and the master/host TOC is visible as well!
Like thinking in C++ terms the alias file looks very much like how we would reference functionality in a C++ class:
Result = BaseClass::SubClass1::Subclass2::DoFunctionCall();
As a side note, this syntax is being replaced by XML - HTML help will reference a 'Collection' as specified in a collection file (.col), which has XML entries in it. Much easier to read and follow than the obtuse PERL-like syntax in the alias file.

Retrofit: MalformedJsonException despite right return [duplicate]

I use the free webhost 000webhost. The service is okay but it inserts some javascript counter into every file and request.
The script looks like this.
<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></noscript>
<!-- End Of Analytics Code -->
If i do a jquery post it breaks my code and I get no response.
<?xml version="1.0"?>
<response>
<status>1</status>
<time>1266267386</time>
<message>
<author>test</author>
<text>hallo</text>
</message>
<message>
<author>test</author>
<text>hallo</text>
</message>
<message>
<author>test</author>
<text>hallo</text>
</message>
<message>
<author>test</author>
<text>hallo</text>
</message>
<message>
<author>admin</author>
<text>hallo</text>
</message>
</response>
<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></noscript>
<!-- End Of Analytics Code -->
How can I fix that? How can I remove the hosting javascript code?
They have a link in their cPanel where you can disable the analytics code.
http://members.000webhost.com/analytics.php
EDIT
Beware - by doing this you violate their policy and they will eventually drop you from their service and you will lose all your data.
In case anyone run into this problem in the future, to stop the analytic code from being included, all you have to do is use the exit() command at the end of your script. The code is in a PHP auto-append file. It doesn't get executed if you exit explicitly instead of letting the script reach the end of the file. The setup at 000webhost.com parses HTML through PHP as well. If you want your regular HTML files to pass validation, add at the very end the following:
<?php exit; ?>
Adding to Catfish's answer,
They have a link in their cPanel where you can disable the analytics code.
http://members.000webhost.com/analytics.php
EDIT
Beware - by doing this you violate their policy and they will eventually drop you from their service and you will lose all your data.
As asked by asalamon74 in the comments,
When I disable the analytics code with this method my domain get canceled due to inactivity. Is there a way to avoid it
Yes, there is a simple way to avoid it. Go ahead and enable your analytics code. Visit http://members.000webhost.com/analytics.php and enable it again.
Then, create a .htaccess in your public_html folder and add the following code to it:
<FilesMatch "\.(php)$">
php_value auto_append_file none
</FilesMatch>
This will prevent all .php files from been appended with the analytics code. Just replace php with any file extension where you want the analytics code removed.
That's all. This way your domain won't get cancelled. Hope it helps.
According to the FAQ, you can go to http://members.000webhost.com/analytics.php to disable the analytics:
How to disable analytic code from my site? (Note: in some case you
might need to add this "php_value auto_append_file none" to your
.htaccess)
FAQ - Frequent Ask Questions Guide!:
http://www.000webhost.com/forum/faq/7894-faq-frequent-ask-questions-guide.html
Alternatively, you could edit your .htaccess file by adding this line:
php_value auto_append_file none
Try changing the content-type in PHP; that should help. (For example, I assume, it doesn't modify images)
Alternatively, you could remove the code in Javascript using indexOf and substring.
Check the terms of service agreement for your host. They may require their analytics code to run unadulterated as part of your TOS.
If they require this code to run, then there are 2 possible solutions:
Get a new host (see http://www.webhostingtalk.com for hosting reviews and deals)
Figure out what in your code is being affected and find a work around there.
If they do not require the analytics code block as a condition of service then you may be able to block their snippet from running by altering the tag's event handler via jquery that they use to fire their code.
If you are using the $.ajax(); function, there is a dataFilter parameter that lets you modify the raw contents of the request before processing it. In here, you could either substring or replace out the offending text, or you could add a <!-- to the end of your XML file, then stick a --> at the end of the response in the dataFilter code.
The analytics code also creates 3 html errors when checked with the w3c validator, so this also lowers your website ranking with google, as google say their ranking also requires that your pages are well formed! try using the validator on this page HERE and you will see the 3 errors.
I had EXACTLY the same problem with these guys. I was so confounded as Chrome just said there was a problem, but thankfully I tried Firefox and it actually blurted out the offending code. I talked to customer support about it, and they said they don't add content to customer pages. Seriously?! So the solution is, as suggested by others, move on and get someone better.

F# FSharp.Literate formatted code snippet does not display correctly (.css & .js?)

I'm trying to use FSharp.Literate to produce html pages. I'm working in Xamarin using Mono 4.5. I want to turn basic *.fsx scripts into html. I am using the simple script example from the documentation for tests. The script I wish to turn into html looks like this.
(**
# First-level heading
Some more documentation using `Markdown`.
*)
(*** include: final-sample ***)
(**
## Second-level heading
With some more documentation
*)
(*** define: final-sample ***)
let helloWorld() = printfn "Hello world!"
I used the built in NuGet manager to download FSharp.Formatting. It also installed Microsoft.AspNet.Razor 2 and RazorEngine
Based on the example in the documentation, I wrote the following script to turn the above example into html. I'm using the html template from the original FSharp.Formatting on github.
#I "bin/Debug/"
#r "FSharp.Literate.dll"
#r "FSharp.Markdown.dll"
#r "FSharp.CodeFormat.dll"
open System.IO
open FSharp.Literate
let source = __SOURCE_DIRECTORY__
let baseDir = Path.Combine(source, "html/")
let file = Path.Combine(baseDir, "demo.fsx")
let output = Path.Combine(baseDir, "demo-script.html")
let template = Path.Combine(baseDir, "template.html")
Literate.ProcessScriptFile(file, template, output)
The process runs and it does produce an html file. However, the F# code does not tokenize. Instead of nicely formatted code, I get the example below. Am I missing something obvious?
Edit:
Based on Tomas' comment below, I found the problem with the .css and .js files.
The template I used had href="{root}/content/style.css" /> <script src="{root}/content/tips.js"
The {root} tag was the reason it could not find the css and js files.
Changing that to href="content/style.css" /> <script src="content/tips.js" solved the problem
I think the library actually produced the correct HTML. As you can see at the end of the file, the content that should appear in the tool tips (information about the type of helloWorld and printfn) is there.
The problem is likely that the generated HTML file does not correctly reference tips.js and style.css that defines the formatting for the HTML and script to pop-up the tool tips.
These two files should be included in the NuGet package (together with the default templates), or you can find them on the project GitHub.

MathJax not working if loaded from local js file or if the source code is included

I am testing the MathJax javascript library in a local HTML file. It works and correctly renders math formulas if I include:
script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
in the HTML file, but it doesn't work if I include instead:
script type="text/javascript" src="/path_to/mathjax.js"
or even if I put the entire javascript source code.
What is the reason? I need to load mathjax.js from local js file into a local HTML file, so the first way doesn't help me.
(EDIT- I see an error: failed to load /extensions/MathZoom.js)
I had to load the entire MathJax distribution (17 Mb zip file), expand it and put the right configuration string in the HTML file. The final form is:
script type='text/javascript' src='/path_to/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML,local/local'
This may occur due to two reasons
1.You may have not extracted the entire zip folder, so first do that.
Still you are getting the error look into second reason.
2.You are not referring to the file correctly.
eg:
<script type ="text/javascript" src="pathto\mathjax.js">
You have typed an incorrect filename. Correct name of file is MathJax.js.Given below is the correct way.
<script type ="text/javascript" src="pathto\MathJax.js">
MathJax.js is the name of the file in the extracted folder(unless modified)
If all of this is not working,then link to the script in this way:
<script type="text/javascript" src="Pathto\MathJax.js?config=TeX-AMS-MML_HTMLorMML">
The reason that your script is not working is you are not including:
'?config=TeX-AMS-MML_HTMLorMML'