I've installed mediawiki-1.26.2 on a private server and want to display latex formulas in that. So I decide to use Extension:MathJax.
At first I installed a local copy of MathJax to render the equations (at top level of server:/var/www/html/mediawiki-1.26.2/). After completing the installation I tested it by visiting http://(Server)/MathJax/test, where the page tells me that "MathJax Appears to be Working!".
Then I downloaded the extension, extracted archive, renamed it to "MathJax" and moved it to “extensions” sub directory of mediawiki-1.26.2. After that I created symbolic link to "mwMathJaxConfig.js" in [local MathJax location]/config/local which is "/var/www/html/mediawiki-1.26.2/MathJax/config/local" directory. So already there exists two files:
local.js
mwMathJaxConfig.js (symbolic link)
Then I changed the last line of "mwMathJaxConfig.js" from:
MathJax.Ajax.loadComplete("_SUBSTITUTE YOUR URL___/mathjax/config/local/mwMathJaxConfig.js");
to this:
MathJax.Ajax.loadComplete("http://localhost/MathJax/config/local/mwMathJaxConfig.js");
Because extension page says: "You might need to modify mwMathJaxConfig.js file to make this work ... ".
After all of them, I tested did extension installed correctly? (wiki → special pages → version → Installed extensions part) And name of "MathJax" was there.
But when I try to show a latex in mediawiki, even simple terms like these:
We consider, for various values of $s$, the $n$-dimensional integral
:<math> \frac{f}{g} </math>
do not shown correctly. Results are:
We consider, for various values of $s$, the $n$-dimensional integral
\[ \frac{f}{g} \]
You can see :<math> is replaced by \[ and </math> by \]. So I guess MathJax is loaded but does not load correctly and problem is in about last line of mwMathJaxConfig.js.
Also I saved page as html and looked at to its code and only this part of code was related to MathJax:
<script type="text/javascript" src="./PageName_files/MathJax.js"> </script>
Above code was not in head and PageName is the name of saved page. I think that is replaced instead of this code which is described in MathJax docs:
<script type="text/javascript" async src="path-to-MathJax/MathJax.js?config=TeX-MML-AM_CHTML"></script>
I looked at Third-party Extensions in MathJax docs but did not understand its meaning.
Also I checked local.js file in [local MathJax location]/config/local whose last line is:
MathJax.Ajax.loadComplete("[MathJax]/config/local/local.js");
Do I have to change the last line of that and replace another string instead of [MathJax]?
The solution which worked for Davide Cervone and hasanghaforian:
Name of directory of local MathJax must be mathjax and not MathJax, then \frac{f}{g} is displayed correctly.
Two errors are shown in the browser console:
MathJax.js?config=TeX-AMS-MML_HTMLorMML-full,local/mwMathJaxConfig:19 GET http://localhost/mathjax/extensions/TeX/xypic.js?V=2.7.0
MathJax.js?config=TeX-AMS-MML_HTMLorMML-full,local/mwMathJaxConfig:19 GET http://localhost/mathjax/extensions/fp.js?V=2.7.0 404 (Not Found).
These two files are part of a third-party extension called XyJax for handling commutative diagrams called xypic. I suspect that the MediaWiki extension you installed is configured to load that, you would would need to obtain it separately from the link above. I don't know a lot about the extension, but I think that the references are to an old version, and that both xypic.js and fp.js have been combined in later versions. If you don't want to do commutative diagrams, you can remove them from the mwMathJaxConfig configuration file.
Related
I am trying to run a script through HTML but I am having some problems. I searched online and found how to do so, however the issue is that even if I correctly type the path of the .js file, it seems to add some strange characters before it.
This is in index.html
<script type="text/javascript" src="fractalTest/fractalTest.js"></script>
I expected this to work but when I open index.html in google chrome and inspect then look under the elements tab, this "â©fractalTest/fractalTest.js" is replacing "fractalTest/fractalTest.js" in the path of the file. I believe this is whats causing the error but I do not know how to fix it!
...it seems to add some strange characters before it.
That usually means that the file is saved with a byte-order mark (BOM) of some kind, but isn't being sent with the correct charset for that byte-order mark.
Be sure that the server is configured to serve the files with a specific encoding (UTF-8 is a good choice), and that you save the files using that encoding (in your text editor, etc.). It's also usually best not to include a BOM on UTF-8 files (although it's valid, some tools don't handle it well).
Side note: No need for the type attribute. The default is JavaScript.
I am trying to integrate Sonarqube analysis into the JavaScript sources of my project. It is a project using Spring components for the back-end, and as a first step, we did the integration of Java sources, without problem at that point.
We are using Sonarqube v5.6.3
The problem I am finding comes with the sonar.exclusions property. Apparently, that property can't exclude a folder that has already been added as sources (see question and answer explaining that exact issue).
I have the following lines in my pom.xml, which are not working properly; and that's understandable according to the aforelinked question:
<sonar.sources>src/main/java,src/main/docker,js-sources</sonar.sources>
<sonar.tests>src/test</sonar.tests>
<sonar.exclusions>**/target/*</sonar.exclusions>
The problem is: the front-end is made of several modules which are compiled one by one under their own /target sub-folder before being deployed all together into src/main/webapp. (They work as regular target folders: when a new compilation is launched, those folders get deleted/recreated.)
Those js-sources/moduleA/target, js-sources/moduleB/target, js-sources/moduleC/target folders are being automatically included as sources, and thus ignored by the exclusions directive. Those target folder still contain a /src subfolder, which makes it hard to use the limited Sonar patterns (full xpath-like selectors are not allowed) to include or exclude only certain paths.
As I don't think that the Sonarqube team was expecting everyone to add each little subfolder one by one (that's why they made patterns in the first term), I am looking for help: How do I exclude those per-module target folders living down the folder-tree inside my sources?
Another possibility would be that it is kind of a bug forcing us to store this config at a Jenkinsfile or even directly in the Jenkins config (at a job level), but I remain unsure and still think that something can be fixed in the way I am declaring the sources and exclusions.
Try
<sonar.exclusions>**/target/**/*</sonar.exclusions>
EDIT : while inclusions are useful in other cases, the accepted answer above is the correct one. I'm leaving mine, which follows, for the record and just as an example of using inclusions.
Try using inclusions rather than exclusions, I've setup a project as close to yours as I could guess from your description and I was able to ignore the target folders of the js-sources modules :
<properties>
<sonar.sources>src/main/java,js-sources</sonar.sources>
<sonar.inclusions>**/*.java, **/src/**/*.js</sonar.inclusions>
</properties>
You can read this as : 'scan all java files no matter where they are, scan only the javascript files that are found within the src of a subfolder of root'
I use JXA to script workflows for Alfred 2 and recently tried to run a script from within another script. I need to pass some text between the scripts, so I decided to use parameters, but whenever I try to pass a string, a number, an array or anything else that isn't an object to it, it gives the error "Error on line 4: Error: An error occurred.". If I do pass an object, the second script (the one being run by the first script) receives an empty object rather than the one passed to it. The same happens when the first script is an AppleScript, but if the second script is an AppleScript, it all works perfectly. Passing arguments through osascript from the command line also works. Is the API broken or is there something that I'm doing wrong?
First script:
var app = Application.currentApplication();
app.includeStandardAdditions = true;
app.runScript(new Path("/path/to/second/script.scpt"), { withParameters: "Hello World!" });
Second script:
function run(args) {
return args;
}
Edit:
If the second script is edited as below, the dialogue is displayed but the runScript method of the first script still returns an error.
function run(args) {
var app = Application.currentApplication();
app.includeStandardAdditions = true;
app.displayDialog(args.toString());
return args;
}
Edit 2:
The runScript function actually seems to be working perfectly other than the problem with the parameters. The error isn't actually being thrown, just displayed by the Script Editor, and execution continues after the call to runScript as if nothing had happened. The returned value also work perfectly, despite the parameters not working.
A note about Alfred 2 workflows
To run some code in Alfred 2 (triggered by a search, keyboard command, etc.), it must be typed into a box in the app, not in a file.
The box to enter code in is very small and does not provide syntax highlighting, and this makes editing code difficult and annoying. For smaller files, it is okay, but for larger files it is easier to use a short script to run a script file. I've tried Bash, which would be the simplest option, but Alfred 2 does not provide an option to escape single quotes. I also cannot use script libraries (to my knowledge, correct me if I'm wrong), as the code is not in a script bundle and all of the required files need to be within the same folder (for exportation reasons).
I don't know how to avoid the runScript error, but I can suggest an alternative approach: load the script as a script library.
Using a script library
Turning a script into a library can be as simple as saving the script to ~/Library/Script Libraries. If your script file is named script.scpt and has a run handler, and you save it to the Script Libraries folder, then you can then invoke it from another script like so:
Library("script").run(["Hello, world!"])
Script libraries are documented in the JXA release notes for OS X 10.10, in the WWDC 2014 session video introducing JXA, and in the AppleScript Language Guide.
Embedding a script library inside of a script bundle
According to the AppleScript Language Guide documentation for script libraries, there is a search policy for finding Script Libraries folders. The first place it searches is:
If the script that references the library is a bundle, the script’s bundle Resources directory. This means that scripts may be packaged and distributed with the libraries they use.
To apply this to the example given in the question, you would need to re-save the first script as a script bundle, and then embed the second script inside of the first script.
For example, if you re-save the first script as script.scptd, then you could save the second script embedded.scpt to script.scptd/Resources/Script Libraries/embedded.scpt. You should then be able to use Library('embedded') to access the script library.
To re-save an existing script as a script bundle, you can either use the File > Export... menu item in Script Editor, or you can hold down option while selecting the File menu to reveal the File > Save As... menu item. The File Format pop-up menu lets you choose the Script bundle format.
Once you have a script bundle open, you can reveal the bundle content panel by using the Show Bundle Contents menu item or toolbar button. You can then use the gear menu to create the Script Libraries folder inside of the Resources folder, and then you can drag a script into that folder.
I've just installed nXhtml by downloading their zip file, extracting the archive into my home directory and adding (load "/home/spinlock/nxhtml/autostart.el") to my .emacs file. My problem is that when I try to edit a .js.erb file, I'm getting the error:
(No javascript-mode/eruby-javascript)
and I'm not getting the syntax highlighting that I'd expect (for instance, comments are the same color as javascript code). However, when I move the cursor inside a Ruby section of this file, that notice changes to:
(Ruby/eruby-javascript)
which I take as a good sign plus it does look like I've got the proper Ruby syntax highlighting in this part of the buffer (e.g. comments are show in red font).
I assume that I need to add a configuration file that tells emacs how to manage javascript-mode but I have no clue how to do this. Any help would be greatly appreciated.
Thanks!
I know that Vim has sophisticated support for tags but I am struggling to get them to work with JavaScript and TCL.
I am using Vim 7.2.330 under Ubuntu Lucid, a standard Vim install and standard Exuberant CTags install.
I wish to keep my tags in a file called ~/.vimtags/tags
I have included the tags file in my vimrc file set tags+=$HOME."/vimtags/tags".
I have run the following command from the base code directory:
ctags-exuberant -f ~/.vimtags/tags -h ".js" --totals=yes --tag-relative=yes --fields=+akst -R
I also have the following in my .ctags file - I saw an article somewhere online that said you should add these to make it compatible with modern JavaScript.
--langdef=js
--langmap=js:.js
--regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/,object/
--regex-js=/([A-Za-z0-9._$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/,function/
--regex-js=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*\(([^)])\)/\1/,function/
--regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/,array/
--regex-js=/([^= ]+)[ \t]*=[ \t]*[^"]'[^']*/\1/,string/
--regex-js=/([^= ]+)[ \t]*=[ \t]*[^']"[^"]*/\1/,string/
When I load up Vim, the tags file definitely gets loaded. A set tags? shows that the tag file has been included.
However, whenever I CTRL-] over a keyword, it always says that there are no tags.
Please could you share how you set up Vim tags with JavaScript, and also show how you use the tag system? It seems to be a great feature of Vim, if only I could get it working.
However, whenever I CTRL-] over a keyword, it always says that there are no tags.
tags are not supposed to work on keywords, they work on symbols you have defined (functions, variables, constants, etc) in the indexed files. So if you are trying on a Javascript keyword it won't work. It won't work on a function from a library either, if you have not included the JS library to your tag file (using ctags -a for example).
If you want to be sure what has been indexed and what you have access to with <C-]>, you can simply open your "tag" file, and see what's in there.
:e ~/.vimtags/tags
You should see a header with information relative to the tag file format, followed by a tag list, which include the tag name followed by a file path, a line number, and a character identifying the type of tag.
If it has some content, it should work for the listed symbols.
Regarding your ctag setup, it looks fine in my opinion.
There is a very neat and easy way to get JavaScript source-code browsing / tag-listing in Vim, using Mozilla's DoctorJS (formerly known as jsctags).
See my answer for this question for more info.
Enjoy. :)