How to change the config file for MathJax in doxygen? - doxygen

I am using doxygen 1.8.9.1 and want to use AsciiMath in the hmtl output. It requires me to use a new config file, i.e. http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML. However, the configuration "MATHJAX_RELPATH" can only set the root path of mathjax.
How could I change the config to mathjax? Thanks for any suggestions.
EDIT:
I have tried to use MATHJAX_CODEFILE to change the config file "config: ["local/local.js","MMLtoHTML.js"]", but don't work for me. The URL should be modified, not just the configuration files. (i.e. MathJax.js?config=AM_HTMLorMML).
BTW: The render html should be change from \[sum_(i=1)^n i^3=((n*(n+1))/2)^2\] to `sum_(i=1)^n i^3=((n*(n+1))/2)^2`.

One solution is to modify MATHJAX section of footer.html in the Doxygen folder.
For example, use this to modify the url to MathJax.js?config=local/local.js
<!-- BEGIN MATHJAX-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="../mathjax/MathJax.js?config=local/local.js"></script>
<!-- END MATHJAX-->
The $mathjax line of header.html should also be deleted.

Related

TYPO3 Form Multicheckbox Partial

I tried to edit the core file form\Resources\Private\Frontend\Partials\Field\Field.html to change the html output in the frontend. If I change that file, it has not effetcs. If I change the core file form\Resources\Private\Frontend\Partials\Textarea.html it effects the output in the frontend.
I've tried to set a custom partial, layout and templates folder like this:
I've set the following in the setup part of the page template:
plugin.tx_form {
settings {
yamlConfigurations {
# register your own additional configuration
# choose a number higher than 30 (below is reserved)
100 = fileadmin/my_site_package/Configuration/Form/CustomFormSetup.yaml
}
}
}
In fileadmin/my_site_package/Configuration/Form/CustomFormSetup.yaml I have
TYPO3:
CMS:
Form:
prototypes:
standard:
formElementsDefinition:
Form:
renderingOptions:
templateRootPaths:
20:'fileadmin/my_site_package/Resources/Private/Templates/Form/Frontend/'
partialRootPaths:
20: 'fileadmin/my_site_package/Resources/Private/Partials/Form/Frontend/'
In the folder fileadmin/my_site_package/Resources/Private/Partials/Form/Frontend/ I have the copied Multicheckbox.html and the other copied partial files from the form core folder. I have edited the Multicheckbox.html, but it has not effects to the frontend.
Thank you so much for your input. The problem was because of the bootstrap package. There was a file Multicheckbox.html in the folder "typo3conf/ext/bootstrap_package/Resources/Private/Partials/Form". This one overrided the core file Multicheckbox.html
But what am I doing wrong in my steps? I'm getting now the following error in the frontend:
Oops, an error occurred!
Tried resolving a template file for controller action "FormFrontend->form" in format ".html", but none of the paths contained the expected template file (FormFrontend/Form.html). No paths configured.
More information regarding this error might be available online.
Did I set the paths in CustomFormSetup.yaml wrong?
I've also tried
TYPO3:
CMS:
Form:
prototypes:
standard:
formElementsDefinition:
Form:
renderingOptions:
templateRootPaths:
1:'/my_site_package/Resources/Private/Templates/Form/Frontend/'
partialRootPaths:
1:'/my_site_package/Resources/Private/Partials/Form/Frontend/'
with the same error.

Automatically create i18n directory for VSCode extension

I am trying to understand the workflow presented in https://github.com/microsoft/vscode-extension-samples/tree/master/i18n-sample for localizing Visual Studio Code extensions.
I cannot figure out how the i18n directory gets created to begin with, as well as how the set of string keys in that directory get maintained over time.
There is one line in the README.md which says "You could have created this folder by hand, or you could have used the vscode-nls-dev tool to extract it."...how would one use vscode-nls-dev tool to extract it?
What I Understand
I understand that you can use vscode-nls, and wrap strings like this: localize("some.key", "My String") to pick up the localized version of that string at runtime.
I am pretty sure I understand that vscode-nls-dev is used at build time to substitute the content of files in the i18n directory into the transpiled JavaScript code, as well as creating files like out/extension.nls.ja.json
What is missing
Surely it is not expected that: for every file.ts file in your project you create an i18n/lang/out/file.i18n.json for every lang you support...and then keep the set of keys in that file up to date manually with every string change.
I am assuming that there is some process which automatically goes "are there any localize("key", "String") calls in file.ts for new keys not yet in file.i18n.json? If so, add those keys with some untranslated values". What is that process?
I have figured this out, referencing https://github.com/Microsoft/vscode-extension-samples/issues/74
This is built to work if you use Transifex for your translator. At the bare minimum you need to use .xlf files as your translation file format.
I think that this is best illustrated with an example, so lets say you wanted to get the sample project working after you had deleted the i18n folder
Step 1: Clone that project, and delete the i18n directory
Step 2: Modify the gulp file so that the compile function also generates nls metadata files in the out directory. Something like:
function compile(buildNls) {
var r = tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject()).js
.pipe(buildNls ? nls.rewriteLocalizeCalls() : es.through())
.pipe(buildNls ? nls.createAdditionalLanguageFiles(languages, 'i18n', 'out') : es.through())
.pipe(buildNls ? nls.bundleMetaDataFiles('ms-vscode.node-debug2', 'out') : es.through())
.pipe(buildNls ? nls.bundleLanguageFiles() : es.through())
Step 3: Run the gulp build command. This will generate several necessary metadata files in the out/ directory
Step 4: Create and run a new gulp function to export the necessarry translations to the xlf file. Something like:
gulp.task('export-i18n', function() {
return gulp.src(['package.nls.json', 'out/nls.metadata.header.json', 'out/nls.metadata.json'])
.pipe(nls.createXlfFiles("vscode-extensions", "node-js-debug2"))
.pipe(gulp.dest(path.join('vscode-translations-export')));
}
Step 5: Get the resulting xlf file translated. Or, add some dummy values. I cant find if/where there is documentation for the file format needed, but this worked for me (for the extension):
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="package" source-language="en" target-language="ja" datatype="plaintext"><body>
<trans-unit id="extension.sayHello.title">
<source xml:lang="en">Hello</source>
<target>JA_Hello</target>
</trans-unit>
<trans-unit id="extension.sayBye.title">
<source xml:lang="en">Bye</source>
<target>JA_Bye</target>
</trans-unit>
</body></file>
<file original="out/extension" source-language="en" target-language="ja" datatype="plaintext"><body>
<trans-unit id="sayHello.text">
<source xml:lang="en">Hello</source>
<target>JA_Hello</target>
</trans-unit>
</body></file>
<file original="out/command/sayBye" source-language="en" target-language="ja" datatype="plaintext"><body>
<trans-unit id="sayBye.text">
<source xml:lang="en">Bye</source>
<target>JA_Bye</target>
</trans-unit>>
</body></file>
</xliff>
Step 6: Stick that file in some known location, let's say /path/to/translation.xlf. Then add/run another new gulp task to import the translation. Something like:
gulp.task('i18n-import', () => {
return es.merge(languages.map(language => {
console.log(language.folderName)
return gulp.src(["/path/to/translation.xlf"])
.pipe(nls.prepareJsonFiles())
.pipe(gulp.dest(path.join('./i18n', language.folderName)));
}));
});
Step 7: Run the gulp build again.
The i18n/ directory should now be recreated correctly! Running the same build/export/translate/import/build steps will pick up any new changes to the localize() calls in your TypeScript code
Obviously this is not perfect, there are a lot of hardcoded paths and such, but hopefully it helps out anyone else who hits this issue.

How to get Codeigniter 3 to use project root instead of referencing full file path on localhost for key folders

I've looked around and I'm sure this is common but can't seem to get the right answer.
I've just recently set up a Codeigniter 3 project on my localhost and a migrating some Codeigniter 2 code.
The index.php file is a bit different.
I can get the project up and running except the main folders references in the index.php file such as APPLICATION and others I've added like "ASSETS" etc are loading like this:
<link href="http://[::1]/projectOne/E:\public_html\projectOne\assets\css\style.php?1537317115" rel="stylesheet" type="text/css" >
Even when I set a base_url:
<link href="http://localhost/projectOne/E:\public_html\projectOne\assets\css\style.php?1537317115" rel="stylesheet" type="text/css" >
I've checked it wasn't just the folders I added by echoing out the APPPATH variable:
define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
echo APPPATH;
Which produces:
E:\public_html\projectOne\application\
What am I missing here?
How do I get my paths to folder set in the index.php to just use the project root, and not the whole filepath on the computer?
Figured it out. For anyone else that hits this issue.
This new part in CI3:
if (($_temp = realpath($application_folder)) !== FALSE)
{
$application_folder = $_temp;
}
Allows you to more securely/easily have your application folder outside of the website root.
My additional ASSETS folder was then showing the full web path which you obviously don't want.
So commenting out this part leaving only:
$application_folder = strtr(
rtrim($application_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
);
And then setting you base_url value in the config.php file gives your CSS, JS and IMAGES proper site relative paths.

Sinatra can't see styles.css

In my directory I have:
shop.rb (App < Sinatra::Base)
lib directory - Ruby models inside
views directory - erb files inside
Gemfile
Where should I place my style.css ? I tried every place possible, I created public folder and tried with also every possible place, but my styles doesn't work.
In layout I have:
<link rel="stylesheet" href="/style.css"/>
I tried also with:
<link rel="stylesheet" href="style.css"/>
It might be because the app is not configured to find the public directory/ First make sure the public directory exists relative to the main entry file of your application (assuming shop.rb) and use the following configuration:
class Shop < Sinatra::Base
configure do
set :public_folder, File.expand_path('../public', __FILE__)
set :views , File.expand_path('../views', __FILE__)
set :root , File.dirname(__FILE__)
end
get '/' do
erb :index
end
end
Once set up, Sinatra should now know where to find your public directory and you can just include the asset file like this:
CSS:
<link rel="stylesheet" href="/style.css"/>
Image:
<img src="/img/background.png" alt="Image" />
JavaScript:
<script src="/js/main.js"></script>

ReferenceError: JST is not defined in Sails.js

I have an ejs javascript template in:
/assets/linker/template
I changed the line in gruntfile.js from:
linker/**/*.html to linker/**/*.ejs
I have underscore.js in:
assets/linker/js
But when I try:
JST['assets/linker/templates/addUser.ejs']( obj ) from app.js
I get this error in the console:
ReferenceError: JST is not defined
Any help would be appreciated! Thanks!
I had the same problem. I solved it by manually linking JST into my index.ejs file.
so I just added
<script type="text/javascript" src="/jst.js"></script>
where I load my javascripts in sailsProject>views>home>index.ejs.
Not pretty, as the linker should do the job, but for now it works.
cheers
The Pipeline
The template files that are injected are specified in tasks/pipeline.js
The default is set to:
var templateFilesToInject = ['templates/**/*.html']
Files in assets/templates (or any subdirectory) with the .html file extension are injected.
Also check out the JST task in tasks/config/jst.js. It takes the template files to inject (from pipeline.js) and precompiles them into a file called jst.js.
Only once these other tasks have completed does the sails-linker begin its task. tasks/config/sails-linker.js takes the jst.js that was generated by the JST task and includes it into the template start and template end tag in .tmp/public/index.html, views/**/*.html, and views/**/*.ejs.
So the default pipeline for client-side templates is:
Precompile templates/**/*.html into jst.js
Include jst.js in index.html, views/**/*.html, and views/**/*.ejs between <!--TEMPLATES--> and <!--TEMPLATES END-->
Customization Examples
All of this default configuration can be changed to suit your needs. For example, to have templates with a different extension or multiple extensions edit the templateFilesToInject in tasks/pipeline.js:
let templateFilesToInject = [
'vendor/templates/vendor_template.html',
'templates/**/*.ejs',
'templates/**/*.html'
]
Or to only inject templates on specific views if they have the comment <!--TPL--><!--END TPL-->, edit the devTpl config in tasks/config/sails-linker.js:
// Bring in JST template object
devTpl: {
options: {
startTag: '<!--TPL-->',
endTag: '<!--END TPL-->',
fileTmpl: '<script type="text/javascript" src="%s"></script>',
appRoot: '.tmp/public'
},
files: {
'views/that/use/templates/**/*.ejs': [
'.tmp/public/jst.js'
]
}
}