Just hope to change the footer copyright info, generated by DocFX.
Here is what I have done:
Export template:
Run docfx template export default, get a folder _exported_templates\default
Change the footer partials:
The files I have changed are .\partials_footer.liquid and .\partials\footer.tmpl.partial
Use the updated template:
Run docfx -t _exported_templates\default.
Serve the site again
Run docfx docfx.json --serve.
But the update is not shown when I refresh the documentation page. Is there anything else I have missed?
Try merge step 3, 4 into: docfx -t _exported_templates\default --serve.
Explanation: If you open the build output in _site after step 3, you should find the footer is actually updated. In step 4, DocFX builds the site again before serving, so finally you find the original footer because this build doesn't use your customized template.
Another quick solution is to add _appFooter to global metadata in docfx.json like:
"globalMetadata": {
"_appFooter": "<span>Customized Footer</span>"
},
Full reserved metadata list can be found here: http://dotnet.github.io/docfx/tutorial/docfx.exe_user_manual.html#322-reserved-metadata
The easiest way to do this is to change the model directly. In your template, create a file called conceptual.extension.js and use the following code:
exports.postTransform = function (model) {
model._appFooter = "<span>Copyright © 2015-2017 MY COPYRIGHT<br>Generated by <strong>DocFX</strong></span>";
return model;
}
Related
After add line resultJsonOutputFile: 'report.json', to config file and run my test in Webstorm, there is a report.json created but there is no content on it. I don't know what's the reason.
Please help me to expland why my report.json has no content? And how to generate Html report for my test?
Use cucumber-html-report You might want to have a look at this:
https://stackoverflow.com/a/33739439/790950
Make sure you add the code snippet to your features/support/hooks.js file and also load that file as part of your protractor.conf file:
cucumberOpts: {
require: [
'../e2e/features/**/steps/*.js',
'../e2e/features/support/hooks.js',
],
format: 'pretty',
},
Notice that you don't have to change the console format as it does it dynamically. Also adds screenshots in case of failures.
I found a theme I like but only after executing a program on the command line with a lot of output, so I don't know the name of the current theme!
Here is the relevant part of my .zshrc:
# Set name of the theme to load.
...
ZSH_THEME="random"
Is there a way to determine which theme I am on?
According to oh-my-zsh.sh L81-87:
if [ "$ZSH_THEME" = "random" ]; then
themes=($ZSH/themes/*zsh-theme)
N=${#themes[#]}
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
Therefore you should be able to print the path to the random theme with
print $RANDOM_THEME
As it was requested to its developers team, a new command is added to support this functionality:
just use:
echo $ZSH_THEME
the response will be the current theme which is using by user.
To update the answer of #4a1e1.
The current version of oh-my-zsh has implemented a second option ZSH_THEME_RANDOM_CANDIDATES that works together ZSH_THEME
When
ZSH_THEME="random"
ZSH_THEME_RANDOM_CANDIDATES=("robbyrussell" "rkj-repos")
To each new terminal opening, only robbyrussell or rkj-repos themes will be applied.
In updated versions you can list the current theme using omz theme list. It will list the current theme as well as the available themes for oh-my-zsh.
io :: ~ % omz theme list
Current theme: flazz
Custom themes:
example
Built-in themes:
3den Soliah adben af-magic afowler agnoster alanpeabody
amuse apple arrow aussiegeek avit awesomepanda bira
You can use prompt -c which will print the current theme.
note: I am not sure from which version this is available, mine is zsh 5.8
I find that developing functions in IPython notebook allows me to work quickly. When I'm happy with the results I copy-paste to a file. The autoindent is 4 spaces, but the coding style for indentation at my company is 2 spaces. How do I change the autoindent to 2 spaces?
The official documentation has an example answering this specific question. This worked for me with IPython 4.
Summary: Paste the following into your browser's javascript console
var cell = Jupyter.notebook.get_selected_cell();
var config = cell.config;
var patch = {
CodeCell:{
cm_config:{indentUnit:2}
}
}
config.update(patch)
The setting is persisted. You can roll back by exchanging : 2 for : null.
From the official documentation for CodeMirror Code Cells:
Open an Ipython Notebook
Create a Code Cell e.g. by pressing b
Open your browser’s JavaScript console and run the following
snippet:
var cell = Jupyter.notebook.get_selected_cell();
var config = cell.config;
var patch = {
CodeCell:{
cm_config:{indentUnit:2}
}
}
config.update(patch)
Reload the notebook page in the browser e.g. by pressing F5
This will fix it permanently. I assume this works only on recent versions, not sure though!
AdamAL's answer is correct. It worked for me.
However it only changes the indentation in the Jupyter Notebook and leaves the indentation in the Jupyter Editor unaffected.
A more direct way to change the indentation is to directly edit the Jupyter config files in the .jupyter/nbconfig directory. This directory contains 2 files:
edit.json
notebook.json
The option you must set in either one is indentUnit. Here is the content of my Jupyter config files:
edit.json:
{
"Editor": {
"codemirror_options": {
"indentUnit": 2,
"vimMode": false,
"keyMap": "default"
}
}
}
notebook.json:
{
"CodeCell": {
"cm_config": {
"indentUnit": 2
}
}
}
With this approach I've set the default indentation to 2 in both the Jupyter Notebook and the Jupyter Editor.
Based on this question and the options found here:
In your custom.js file (location depends on your OS) put
IPython.Cell.options_default.cm_config.indentUnit = 2;
On my machine the file is located in ~/.ipython/profile_default/static/custom
Update:
In IPython 3 the plain call does not work any more, thus it is required to place the setting within an appropriate event handler. A possible solution could look like
define([
'base/js/namespace',
'base/js/events'
],
function(IPython, events) {
events.on("app_initialized.NotebookApp",
function () {
IPython.Cell.options_default.cm_config.indentUnit = 2;
}
);
}
);
If you use jupyterlab, there seems to be an easier way:
1) Click jupyterlab menu Settings > Advanced Setting Editor
2) Click "Notebook" on the left hand pane, make sure you are on "Raw View"
3) On the right pane, under "User Overrides", enter this:
{
"codeCellConfig": {
"tabSize": 2
}
}
If you look at the System Defaults, that will give you hint on whats overridable and you can repeat this for other settings.
I tried this on Google Platform AI Notebook which uses Jupyterlab.
I believe this is now best wrapped in a event handler to load once per notebook load:
$([IPython.events]).on('app_initialized.NotebookApp', function(){
IPython.CodeCell.options_default['cm_config']['indentUnit'] = 2;
});
In addition to adding
IPython.Cell.options_default.cm_config.indentUnit = 2;
to your custom.js file as suggested by Jakob, be sure to clear your browser cache as well before restarting ipython notebook!
Also, you may have to first create the ~/.config/ipython/profile_default/static/custom/ directory (use echo $(ipython locate default) to find your default directory) before adding the custom.js file.
We are moving into Scala/SBT from a Java/Gradle stack. Our gradle builds were leveraging a task called processResources and some Ant filter thing named ReplaceTokens to dynamically replace tokens in a checked-in .properties file without actually changing the .properties file (just changing the output). The gradle task looks like:
processResources {
def whoami = System.getProperty( 'user.name' );
def hostname = InetAddress.getLocalHost().getHostName()
def buildTimestamp = new Date().format('yyyy-MM-dd HH:mm:ss z')
filter ReplaceTokens, tokens: [
"buildsig.version" : project.version,
"buildsig.classifier" : project.classifier,
"buildsig.timestamp" : buildTimestamp,
"buildsig.user" : whoami,
"buildsig.system" : hostname,
"buildsig.tag" : buildTag
]
}
This task locates all the template files in the src/main/resources directory, performs the requisite substitutions and outputs the results at build/resources/main. In other words it transforms src/main/resources/buildsig.properties from...
buildsig.version=#buildsig.version#
buildsig.classifier=#buildsig.classifier#
buildsig.timestamp=#buildsig.timestamp#
buildsig.user=#buildsig.user#
buildsig.system=#buildsig.system#
buildsig.tag=#buildsig.tag#
...to build/resources/main/buildsig.properties...
buildsig.version=1.6.5
buildsig.classifier=RELEASE
buildsig.timestamp=2013-05-06 09:46:52 PDT
buildsig.user=jenkins
buildsig.system=bobk-mbp.local
buildsig.tag=dev
Which, ultimately, finds its way into the WAR file at WEB-INF/classes/buildsig.properties. This works like a champ to record build specific information in a Properties file which gets loaded from the classpath at runtime.
What do I do in SBT to get something like this done? I'm new to Scala / SBT so please forgive me if this seems a stupid question. At the end of the day what I need is a means of pulling some information from the environment on which I build and placing that information into a properties file that is classpath loadable at runtime. Any insights you can give to help me get this done are greatly appreciated.
The sbt-buildinfo is a good option. The README shows an example of how to define custom mappings and mappings that should run on each compile. In addition to the straightforward addition of normal settings like version shown there, you want a section like this:
buildInfoKeys ++= Seq[BuildInfoKey](
"hostname" -> java.net.InetAddress.getLocalHost().getHostName(),
"whoami" -> System.getProperty("user.name"),
BuildInfoKey.action("buildTimestamp") {
java.text.DateFormat.getDateTimeInstance.format(new java.util.Date())
}
)
Would the following be what you're looking for:
sbt-editsource: An SBT plugin for editing files
sbt-editsource is a text substitution plugin for SBT 0.11.x and
greater. In a way, it’s a poor man’s sed(1), for SBT. It provides the
ability to apply line-by-line substitutions to a source text file,
producing an edited output file. It supports two kinds of edits:
Variable substitution, where ${var} is replaced by a value. sed-like
regular expression substitution.
This is from Community Plugins.
This is really a newbie question - but basically, how do I enable a template for certain filetypes.
Basically, I just want the template to insert a header of sorts, that is with some functions that I find useful, and libraries loaded etc.
I interpret
:help template
the way that I should place this in my vimrc
au BufNewFile,BufRead ~/.vim/skeleton.R
Running a R script then shows that something could happen, but apparently does not:
--- Auto-Commands ---
This may be because a template consists of commands (and there are no such in skeleton.R) - and in this case I just want it to insert a text header (which skelton.R consist of).
Sorry if this question is mind boggeling stupid ;-/
The command that you've suggested is not going to work: what this will do is run no Vim command whenever you open ~/.vim/skeleton.R
A crude way of achieving what you want would be to use:
:au BufNewFile *.R r ~/.vim/skeleton.R
This will read (:r) your file whenever a new *.R file is created. You want to avoid having BufRead in the autocmd, or it will read the skeleton file into your working file every time you open the file!
There are many plugins that add a lot more control to this process. Being the author and therefore completely biased, I'd recommend this one, but there are plenty of others listed here.
Shameless plug:
They all work in a relatively similar way, but to explain my script:
You install the plugin as described on the linked page and then create some templates in ~/.vim/templates. These templates should have the same extension as the 'target' file, so if it's a template for .R files, call it something like skeleton.R. In your .vimrc, add something like this:
let g:file_template_default = {}
let g:file_template_default['R'] = 'skeleton'
Then create your new .R file (with a filename, so save it if it's new) and enter:
:LoadFileTemplate
You can also skip the .vimrc editing and just do:
:LoadFileTemplate skeleton
See the website for more details.
Assume that your skeletons are in your ~/.vim/templates/ directory, you can put this
snippet in your vimrc file.
augroup templates
au!
" read in templates files
autocmd BufNewFile *.* silent! execute '0r ~/.vim/templates/skeleton.'.expand("<afile>:e")
augroup END
Some explanation,
BufNewFile . = each time we edit a new file
silent! execute = execute silently, no error messages if failed
0r = read file and insert content at top (0) in the new file
expand(":e") = get extension of current filename
see also http://vim.wikia.com/wiki/Use_eval_to_create_dynamic_templates
*fixed missing dot in file path
Create a templates subdirectory in your ~/.vim folder
$ mkdir -p ~/.vim/templates
Create a new file in subdirectory called R.skeleton and put in the header and/or other stuff you want to automagically load upon creating a new ".R " file.
$ vim ~/.vim/templates/R.skeleton
Then, add the following to your ~/.vimrc file, which may have been suggested in a way by "guest"
autocmd BufNewFile * silent! 0r $HOME/.vim/templates/%:e.skeleton
Have a look at my github repository for some more details and other options.
It's just a trick I used to use .
It's cheap but If you ain't know nothing about vim and it's commands it's easy to handle.
make a directory like this :
~/.vim/templates/barney.cpp
and as you konw barney.cpp should be your template code .
then add a function like ForUncleBarney() to end of your .vimrc file located in ~/.vimrc
it should be like
function ForBarneyStinson()
:read ~/.vim/templates/barney.cpp
endfunction
then just use this command in vim
:call ForBarneyStinson()
then you see your template
as an example I already have two templates for .cpp files
:call ForBarney()
:call ACM()
sorry said too much,
Coding's awesome ! :)
Also take a look at https://github.com/aperezdc/vim-template.git.
I use it and have contributed some patches to it and would argue its relatively full featured.
What about using the snipmate plugin? See here
There exist many template-file expanders -- you'll also find there explanations on how to implement a rudimentary template-file expander.
For my part, I'm maintaining the fork of muTemplate. For a simple start, just drop a {ft}.template file into {rtp}/template/. If you want to use any (viml) variable or expression, just do. You can even put vim code (and now even functions) into the template-file if you wish. Several smart decisions are already implemented for C++ and vim files.