GeSHI new language - mediawiki

I running a mediawiki and want to use syntax highlighting. I am using the extension https://www.mediawiki.org/wiki/Extension:SyntaxHighlight for that.
That works pretty fine.
Alas I want to highlight a language that is not part of this extension. So I wrote an python egg to extend pygments so it can parse my language (using entry points). This works fine.
Now I am struggling to get both to work together. How do I tell the GeShi Extension of MediaWiki to use my pygments extension? What do I have to do, so that using <syntaxhighlight lang="myLanguage"> will result in using my language lexer and style?

The solution was quite simple. One has to edit the file SyntaxHighlight_GeSHi.lexers.php and add the lexer.
It's important to use only lowercase for the lexer name, otherwise the extension will not find the lexer.

Related

Does anyone know how to get argument name automatically in Visual Studio Code?

Look at the below-given image of Intellij IDEA -
When we use a function it automatically provides the argument name and when we copy a code-snippet then that argument name is not copied(it is just for our reference).
I want to do the same in my vs-code editor but, I can't find any way to do it.
Looks like Inline Parameters for VSCode extension you looking for.
There is a new version of VS Code, there they had given support for Parameter hint highlight See the release notes
This feature, called "parameter hints", requires support from the language server, so whether or not this is currently supported varies from language to language.
For C++, clangd has experimental support for this (enabled by adding --inlay-hints=true to "clangd.arguments") starting from clangd 13.
I'm not familiar with the status for other languages, so will let others answer on that front.

Automate Haml & Sass with Sublime Text 2 for Windows

I am a front-end guy using Windows for design and html/js/css coding. My work is separate from the back-end guy using .NET. I am also new to Haml/Sass thing as well as Ruby. And definitely not using Rails. After few search, I decided to pick Sublime Text 2 for Sass/Haml support and get rid of my old Notepad++. My first question is:
1. What is the best practice / efficiency to automatically convert whole folder of Haml (primary) and/or Sass to static documents (html/css)?
I have a separate solution for Sass by setting the "watch". I was searching for Haml automatic conversion solution and found few options:
Library for making static websites with HAML/SASS/CSS framework
2. Should I use StaticMatic?
Google search said it is the best. But there seems no update for 2 years
https://github.com/staticmatic/staticmatic
There is also this site (Is it the same?): http://staticmatic.rubyforge.org/how_to_use.html
If I use StaticMatic, I can setup a build system in Sublime Text to run from the Build Menu (http://docs.sublimetext.info/en/latest/file_processing/build_systems.html)
3. OR should I go with all-in-one solution like this (may cost few bucks)? Is there free one?
http://fireapp.handlino.com/
I don't mind to have Sass -watch running separately and another polling mechanism for Haml. I just want to make sure I have the "latest" out there.
Hope to get some advise for my unique situation. Thanks.
The answer is Middleman
http://middlemanapp.com/
It's the replacement for out-dated StaticMatic
HAML:
For automatic conversion from haml to sass you can use this gist: https://gist.github.com/3898955. If you want to automate even more the workflow process, you can use https://github.com/alexnj/SublimeOnSaveBuild sublime package to run the command on file save.
SASS:
For SASS here is the needed setup. https://gist.github.com/3899112.
For automatic conversion on save, the same rules are applied here too, but it's important to include the .sass and .haml extension in SublimeOnSaveBuild.sublime-settings file.
So your file should look like this:
{
"filename_filter": "\\.(css|js|sass|less|scss|jade|haml)$",
"build_on_save": 1
}
You can extend this list at your own wish.

Using syntax highlight from GitHub

What syntax highlighting is used on GitHub (for HTML, CSS, JavaScript, C#) when viewing source code-file and is it available for the public to use?
It works on the page and it works when embedding on a page (from a Gist), like this:
<script src="https://gist.github.com/1009439.js"></script>
But can I just include their JavaScript-library and let it highlight my code?
Github uses pygments to highlight syntax. Pygments is running on the server, instead of a pure Javascript client solution. If you're looking for a Javascript solution check out this review of the various options.
According to this help page, GitHub currently highlights syntax with the open-source Linguist library for Ruby. Linguist highlights each language using the tmLanguage files linked in vendor/grammars.
Since Linguist is written in Ruby, it can only be used on the server. If you want a client-side JavaScript library that you can just include on a page, you will have to find a different library.
According to this: http://www.infoq.com/news/2008/03/github-git-repository-hosting
they are using Python Pygments
Chris Wanstrath shared some
information about the inner workings
of GitHub with InfoQ:
GitHub is mostly implemented in Rails.
The post-commit integration mini-apps
we're working on are all written in
Merb, we use the Python Pygments for
syntax highlighting, and we use Ara T.
Howard's Bj plus some Ruby scripts for
our queueing system. And, of course,
we use the Ruby Grit library to
interface with Git.
I believe they use their albino gem. It is a Ruby wrapper for the pygments syntax highlighter.
Here is an article of a comparison I read recently on javascript based syntax highlighters (if that is what you need): http://softwaremaniacs.org/blog/2011/05/22/highlighters-comparison/
As others have said previously, GitHub uses Pygments. You can achieve the same effect by using it together with pygments-style-github.

Find and Replace in Files - UTF8

Searching for a free application for commercial usage that allows find/replace in multiple files (regular expressions are nice but not a must), that supports opening and saving in UTF-8.
Tried a few like BKReplaceEm but the application ends up saving all the files as ASCII which causes some problems with web-rendering.
Please advise.
[UPDATE] To further clarify, I am searching for a windows utility.
[UPDATE #2] This is going to be used to run through our 450 page site and replace all french characters with the much needed HTML entities.
Notepad++ supports this feature, and is a great little editor in it's own regard.
Edit : Actually, Notepad++ does support replace in files. Click Search -> Find in Files, then select "Replace in files" in the dialog.
In the spirit of previous answer, you can use Perl (which has seamless native Unicode support and whose RegEx capablity are unparalleled). There are Windows perl versions avialable (ActivePerl, Strawberry, or you can use CygWin), and you can even slap GUIs on top of it -= for the latter, you can see what answers are given to my very recent So question :)
Plus, Perl can grab pretty much unlimitedly powerful collection of files, by using globs for simple things, File::Find for more complicated, and using grep on resulting file list to refine further if you need more fancy stuff, e.g. by content of modification time.
UPDATE For a Windows Editor, you can use UltraEdit. It has free evaluation period, and to be perfectly honest, I find the purchase price to be WELL worth paying for this very nice and powerful editor. Among its other features, it supports Unicode, and has pretty fancy search/replace ablities, including Perl RegEx support and S/R in multiple files.
Use sed.
jEdit has a feature called "HyperSearch" (just open the find dialog). You can specify a directory, a file name pattern and jEdit (being based on Java) does support lots of different encodings (and is often smart enough to figure out the correct one).
You could try my editor, Code Trowel
If it doesn't do what you want I'd probably fix it :-)
For windows, Notepad++ is awesome. It's licensed under the GPL. It does search and replace in files and does support regular expressions.

Repository of BNF Grammars?

Is there a place I can find Backus–Naur Form or BNF grammars for popular languages? Whenever I do a search I don't turn up much, but I figure they must be published somewhere. I'm most interested in seeing one for Objective-C and maybe MySQL.
you have to search on tools used to create grammars: "lex/yacc grammar", "antlr grammar" "railroad diagram"
http://www.antlr3.org/grammar/list.html
Here's some grammar files
objective-c
http://www.omnigroup.com/mailman/archive/macosx-dev/2001-March/022979.html
http://www.cilinder.be/docs/next/NeXTStep/3.3/nd/Concepts/ObjectiveC/B_Grammar/Grammar.htmld/index.html
https://github.com/pornel/objc2grammar
python
http://www.python.org/dev/summary/2006-04-16_2006-04-30/#the-grammar-file-and-syntaxerrors
javascript
http://tomcopeland.blogs.com/EcmaScript.html
http://www.ccs.neu.edu/home/dherman/javascript/
ruby
http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/yacc.html
FWIW, the MySQL grammar file (mysql-server/sql/sql_yacc.y) is open source and browseable at launchpad.net (though it's a bit slow and I got an error when I tried to pull up the specific file).
Also, a snapshot of the whole MySQL Server source is downloadable from dev.mysql.com.
There are some links from w:BNF#Language Grammars.
BNF Grammars for SQL-92, SQL-99 and SQL-2003
I also found a page that lists grammars for Objective C.
Objective-C grammar for Lex/Yacc Flex/Bison
Reference Manual for the Objective-C Language
IIRC, BNF grammars are just different enough from what yacc/bison want as input to be really annoying :) If you intend to feed these files into a parser generator, you may want to look for files in the appropriate format. I recall seeing such files for Java, JavaScript and C++ at one point. Probably as part of Eclipse, Firefox and GCC, respectively, but I can't remember for sure. I would assume you can find pretty much any parser input file by finding an open source project that uses that language.
I also searched this and i collected this repository
http://slps.github.io/zoo/