Sublime Text 2: Embed snippets inside snippets - sublimetext2

I have been looking for over 40 minutes for any information about embedding snippets inside snippets using Sublime Text 2
I want to do something like
<snippet>
<content> <![CDATA[Header content here]]> </content>
<tabTrigger>header</tabTrigger>
<scope>source.php</scope>
<description>Function</description>
</snippet>
Above is the header snippet I would like to embed inside the below, content snippet
<snippet>
<content> <![CDATA[
${trigger:header}
Content Body Goes Here
]]> </content>
<tabTrigger>content</tabTrigger>
<scope>source.php</scope>
<description>Function</description>
</snippet>
If there is nothing like this out there already, I would really like to know how I can add the
${trigger:<tabTrigger>}
command to the existing snippet functionality by creating an extension or plugin...
Any ideas, links to how I can add the ${trigger:} command, or links to an existing plugin that already does this, are greatly appreciated!
Thank you!
- Jeff

Don't think it is possible. You can have the same trigger for multiple snippets (don't ask why, I'm just saying you can), so it's not really something you you can reference.
I can think of a few solutions though. All of them are probably suboptimal, but I'll list them anyways. Perhaps one of them will give you an idea.
Set things up so you can manually enter snippets (or other autocompletions) into the snippet body.
Insert the content from the first snippet into the second.
Write/find a plugin to do it. I don't know of any off the top of my head though so I can't help with anything specific. If I think of any though, I'll update my answer.

Related

Latex to html conversion

I am building a website with an implemented forum using Xobor. I want to make a button in the toolbar of the Textwindow that can convert Latex to html. Something like [Latex] \sqrt{a^2+b^2} [/Latex] would be great. Alternativly it can also be a button that creates a popup window, where Latex code can be written. Something like this:
Here you can click on the Button fx and a new window pops up, where you can enter latex code, which is then converted
I already found converters like Mathjax and Katex but I don't think, that they do what I need, because these tools seem to work only for the website text itself, but not for the forum posts.
I honestly don't know much about html, so maybe I am mistaken (I have a friend that will help me implement these things as soon as I find a tool that is fit to do what we need).
I can create the button itself like this (picture below), but obviously it doesn't convert anything yet.
So basically what I am looking for, are some lines of Code that I can put in that textbox shown in the picture above, which create a button in the toolbox, to be able to write formulas and other latex math stuff in my forum.
I really hope that this makes sense.
Thanks in advance!
After installing katex in my Angular project (npm install ng-katex --save
) I use it like:
Typescript:
var equaciones = [' H = \\sum_{i=1}^{m} p_{i} log_{2} (p_{i})']
Html:
<ng-katex [equation]="equaciones[0]"></ng-katex>
Result:
You can see an example of the result here: web_example

Jupyter Notebook: Hide / fold a paragraph of text as "hints"

I am using a Jupyter Notebook for an interactive coding demonstration. There is an exercises block where the user should enter their own code to try and solve a problem.
I now want to optionally give some further instructions, i.e. hints how to solve the problem, which should be hidden by default.
I found this answer, which links to this site here, using JavaScript in a raw nbconvert cell to hide output cells. However, this only seems to work for exported notebooks, while I want something in the notebook itself.
So I've tried adding similar JS into a Markdown cell, but that doesn't work because the JS gets sanitized away.
I'm not sure if CSS also gets sanitized, but raw HTML works. Is there a good way to create a hidden/folded text paragraph with something like "click here for further instructions" to show the text?
The best I could come up with so far was a title attribute to create a mouse-over text, unfortunately without further formatting:
<span title="Instruction text goes here">Mouse over for further instructions</span>
The <details> tag is pure HTML which does just that, and which does not get removed by the sanitizer. It can have a <summary> to describe the contents of the fold.
<details>
<summary>Click here for instructions</summary>
Instructions go here
</details>
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details

Making "personalized variables" in html

Okay, my english is not the greatest so I apologize in advance. Question is really stupid and I dont know how that is called but I will try to explain it here better. So I am making a template for one restourant and menus are changing every week. So is it possible to write paragraphs somewhere else ( in separated place (external or internal)) and then "call them" somewhere in .html.
Example. making methods in C# and then calling them anywhere when we want to
In my opinion the simplest method will be to use php.
Then in place with menu you can only use something like this:
<?php inlcude('menus/file.php');
And on server create a folder menus where you wil put php files with html.
All files can be simple html. There is no need to learn php just in place you want to call a file use code i placed earlier.
HTML doesn't have a good way to achieve this (although iframe exists).
This sort of thing is generally handled by software that generates the HTML, either when the page is requested (via something like the very basic SSI support in some webservers to full on server side programming (which you could use C# for)) or at publication time (via a build tool such as Gulp).
You could use jQuery to achieve it (if it is a simple website and simple menu), read more the related function on http://api.jquery.com/load/
You may also read a simple here: HTML File including another HTML file
I may also include a very basic example for you
main.html
<body>
<header>Some header</header>
<content>
<main class="the-menu"></main>
</content>
<script>
$(".the-menu").load("menu.html");
</script>
</body>

YouTube subscribe button code doesn't work

When I customize the YouTube subscribe button code to reflect my channel, the code changes when I try pasting it into the html space in my wordpress blog.
I try copying this:
<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-ytsubscribe" data-channel="TheAtheistsNextDoor" data-layout="full" data-count="default"></div>
and then when it pastes, it always ends up like this:
<div class="g-ytsubscribe"></div>
I should add that when I copy the html from the code box, it changes the preview from what is correct, to: These aren't the XSS vulnerabilities you're looking for.
How is the simple act of copying the code changing it somehow? Why would it paste as something completely different?
Hey #Bridget Ludwa O'Hanlon, I am not too familiar with Wordpress. With that being said to answer your first question, not sure why the code is changing may be the client your using or you. To using the subscribe button here is the code***Note I am using my channel as you did not say yours***:
Default:
<script src="https://apis.google.com/js/platform.js"></script>
Full:
<script src="https://apis.google.com/js/platform.js"></script>
There are many different combinations you can do i would highly suggest checking out the first source posted below as google is a programmers friend (remember this) Thankfully google helps you out by telling you how to create this button and even gives you a generator for it.
sources: https://developers.google.com/youtube/youtube_subscribe_button
sources:http://www.wpbeginner.com/wp-tutorials/how-to-add-youtube-subscribe-button-in-wordpress/
Wordpress has this thing where it modifies you code if you jump between visual and text tab. But a rule of thumb, goto text tab -> paste your code and click the update button. Dont go to the visual tab unless the code is pasted and updated.
OR
You can try using. You can try replacing the existing editor with https://wordpress.org/plugins/foliopress-wysiwyg/

MediaWiki : is it possible to add an edit link in a template?

I have a template on my wiki, kind of a box template.
Then, there is this page where I use it several times.
Can I add an edit link to each of the boxes so I don't have to edit the whole page in order to modify one of the boxes?
The boxes contain only text, not other templates.
Thanks!
Edit: Actually there's an easier way to ask my question:
Let's say I have a page without sections defined (namely without == titles ==):
content A
content B
content C
Is there a way to open an edit form only for content B?
"Is there a way to open an edit form only for content B?" - in standard mediawiki - no, but you can do sth like this
Main page will look like this:
{{/subpageA}}
{{/subpageB}}
{{/subpageC}}
subpageA will contain link to edit subpageA etc
But it is worse than sections in every possible way.
If I understand your question, and I'm not sure I do, I'm assuming your box is a div or table of some sort? If so, you could add id="{{{1|Some identifying parameter}}} to it.. Now, similar to if you had used == header 2 == you will be able to link to that section of the page with [[{{PAGENAMEE}}#{{{1|Some identifying parameter}}}]]. The only trick is to edit that section. You would likely have to set up a <span class=plainlinks>[http://somewiki.com/edit/{{PAGENAMEE}}&section={{{1|Some identifying parameter}}}]</span> Although, I'm not sure using the section name will work on your wiki, it works on only one of four that I edit. The other three require the section number, which may be harder to figure out, or at very least is beyond my pay-grade atm..
Not sure what you're asking here. Do you want to edit the template from the referring page?
Update:
One: The ugly but simple solution:
Add the following code above the text you want to edit:
=== ===
This will create a section with no name, but with an edit link. If you make four or more of these links, you will create a TOC in the page. You can suppress this with:
__NOTOC__
Two: The neat but extensive solution:
Make your wiki semantic and use Semantic_Forms to edit the page using a form.
Not with the standard installation.
But, I'm sure you could write an extension to do this. Eg. Right click on the page and it will start editing there.
It is possible to add link to edit template, so you can make ugly hack and create separate templates/subpages for every single box.