Doxygen equivalent for Mathematica? - documentation-generation

How do you put additional information into a Mathematica package file, like
parameter specification
doctests/example usage?
Up to now, I only found the ::usage string and some information on how to write documentation notebooks. I am looking for an option to generate these documentation notebooks from introspecting package files.

I don't know that there is any mechanism such as doxygen built into mathematica. If you want to embed a documentation notebook into your package I would proceed as follows
Write up the documentation notebook
Embed the notebook as a character string in your package
Write a help function that, when called, crates a file, writes out the notebook and uses front end manipulations to open it
You might be able to skip the creation of the external notebook by using Notebook[] instead of a character string for storing the documentation notebook inside your package file.
Integrating with Mathematica's own Help system is a bit more difficult (as the link you gave explains). Of course, you could still have the package write and move the appropriate files into place when the package loads.

Related

Need inline_macro example and help about file location

I like to add additional macros to asciidoctor for these types:
path:[some path value]
label:[some label text]
replace:[some value to become replaced by the user]
screen:[something the users sees on screen]
I mainly want to have it rendering some CSS classes while rendering to HTML5. I found several sources on how to write a macro for asciidoctor, but I do not get the point. Where to place or insert the ruby code and classes I write? Here is an example page I found: https://docs.asciidoctor.org/asciidoctor/latest/extensions/inline-macro-processor/
But I found no simple step-by-step information about where to place that?
Can someone tell me:
In which file(s) shall I add my macro code?
How to enable this in general for asciidoctor (so I can simply call it without the need to put it into the comandline call. Or do I have to register the macro in the call all the time?
I installed asciidoctor on Ubuntu 20.04 using apt-get install asciidoctor. Seems it works so far. But I found no files for the predefined macros btn, kbd and menu.
I'm a little lost here... Any help is appreciated.
PS. I know the syntax [.label]#some label text# to place CSS classes, but I want to have it generic and also usable for PDF generation later.
After many different tries and research I finally found it to be easy. Just point asciidoctor to the file you want to include by using the -r comandline parameter:
asciidoctor -r ~/tools/asciidoctor_patch/include_asciidoc.rb
Sadly, the whole asciidoctor documentation names this parameter only "require" and does not even mention this to be used for extensions. I also found no source that mentions the use of -r for including the macros.

Has anyone used COPASI via commandline?

I am trying to run COPASI in commandline but there is very little documentation.
I have downloaded and unzipped binary, I am not sure how to proceed in order to do something as simple as import an SBML file?
Here is all the documentation I found:
http://copasi.org/Support/User_Manual/Model_Creation/Commandline_Version_and_Commandline_Options/
It doesn't say which command do I use to call COPASI?
The command line version of COPASI is CopasiSE, which you can install besides the GUI CopasiUI via any source here http://copasi.org/Download/.
For example, see https://github.com/ICB-DCM/solverstudy/blob/master/Bash_Scripts/install_copasi.sh, in which case the executable resides in a local folder.
Regarding usage, I am not sure whether extensive API documentation is available. It probably won't help much, but here's how we wrapped it in a study via Python to call an underlying CPS model file https://github.com/ICB-DCM/solverstudy/blob/master/Python_Scripts/simulation_wrapper_copasi.py#L77.

How to Change Package Directory in SWI-Prolog

I am attempting to install a package (sldnfdraw) in SWI-Prolog, but I cannot find a way to specify an installation directory (ie where I want it to be installed).
The documentation seems to indicate one can choose the package directory, but I haven't had luck in doing so. Admittedly, I am fairly new to Prolog and may be overlooking something obvious. Nonetheless, I have searched for answers in all the usual places (Stack Overflow, documentation) with no luck.
I attempted to install the package sldnfdraw by calling pack_install(sldnfdraw). This would have created a directory at $HOME/lib/swipl/pack. I then attempted various incarnations of pack_install(sldnfdraw, $PREF_DIR). where $PREF_DIR is the absolute path of the directory where I wanted the package to be installed. The documentation referenced some way of passing options to functions, but it did not specify a method for doing so. Given the limited resources available on Prolog (and this specific implementation) I find myself at a dead end. Hopefully someone can point me in the right direction.
The function for specifying the installation directory is package_directory/1. In order to use this in conjunction with pack_install/2, I needed to enclose it in brackets. Therefore the query to install package sldnfdraw into directory $PREF_DIR looks like
pack_install(sldfndraw, [package_directory($PREF_DIR)]).

Exploring GO packages

Is any way to explore the GO packages?
In java, I have using "javap java.lang.String" command for viewing the method inside of the class. Something like this, Is any command is their in GO language ?
I have search the same in google. I didn't get expected result.
Go code is distributed with source and documentation tooling so you just need to search for sources in $GOROOT/src directory or use godoc tool or simply go to http://golang.org/pkg/ for standard library or https://godoc.org/ for many other libraries.
On command line run godoc <pkg name>, example godoc encoding/json.
By the way, you can also get Java library sources so using javap for this is definitely not the shortest path. It also have documentation available online https://docs.oracle.com/javase/8/docs/api/

Is there a Scala version of .irbrc or another way to define some default libraries for REPL use?

I've written a little library that uses implicits to add functionality that one only needs when using the REPL in Scala. Ruby has libraries like this - for things like pretty printing, firing up text editors (like the interactive_editor gem which invokes Vim from irb - see this post), debuggers and the like. The library I am trying to write adds some methods to java.lang.Class and java.lang.reflect classes using the 'pimp my library' implicit conversion process to help you go and find documentation (initially, with Google, then later possibly with a JavaDoc/ScalaDoc viewer, and maybe the StackOverflow API eventually!). It's an itch-scratching library: I spend so much time copying and pasting classnames into Google that I figured I may as well automate the process.
It is the sort of functionality that developers will want to add to their system for use only in the REPL - they shouldn't really be adding it to projects (partly because it may not be something that their fellow developers want, but also because if you are doing some exploratory development, it may be with just a Scala REPL that's not being invoked by an IDE or build tool).
In my case, I want to include a few classes and set up some implicits - include a .jar on the CLASSPATH and import it, basically.
In Ruby, this is the sort of thing that you'd add to your .irbrc file. Other REPLs have similar ways of setting options and importing libraries.
Is there a similar file or way of doing this for the Scala REPL?
On the command line, you can use the -i option to load a file while starting the REPL:
scala -cp mystuff.jar -i mydefs.scala
Ofcourse you could wrap this in a shell script or batch file and run that instead of the normal scala command.
(I'm using Scala 2.8.0 RC3).
Not sure if this is what you are looking for, but if you put any jars in your SCALA_HOME\lib directory. Then those jars will be available for import in the REPL (using the import keyword).
EDIT: The most convenient option as of now is by setting the CLASSPATH environment variable. Any jars referenced in the CLASSPATH variable are also available for import in the REPL.
Quick answer probably not what you are looking for, but what about typing
:load path/to/some/scala/script/file.scala
in the console?
:load will read in a scala file and execute it as a script.
Another option is to use sbt set up your dependencies and execute the console command.
The final option I can think of is to set the classpath on the command line manually and point it to the jars / class file folders that you want the jvm to know about.
Let me know if any of this interests you and I can provide more details if needed.

Resources