How do I use any of the "CommonMark" modules to pass options to the commonmark library? - raku

I need help getting a clue. I think my paltry experience compiling C code is a roadblock to understanding how to use some of the Raku modules for using the interface to the CommonMark C library to convert markdown to HTML.
Problem:
I'm on a mac with the cmark library installed with homebrew. I'm using the CommonMark module. It works, but if I have embedded html in my markdown, I get:
<!-- raw HTML omitted -->
in the output. AFAICT, CommonMark has an option for turning this on or off: https://github.com/commonmark/cmark/blob/8a023286198a7e408398e282f293e3b0baebb644/src/html.c#L171
The CommonMark module does not appear to allow me to pass argument to the cmark library. This module seems to: https://raku.land/github:JJ/cmark::Simple
However, I can't really make heads or tails of the documentation because I don't understand how to interface with the cmark library. And I'm not even sure if this module will work on a mac. This module seems to assume it should be installed on debian.
Can someone please clue me in?

Related

Definition mx.binding.utils.BindingUtils could not be found similar couple of imports not loading

I got chance to migrate Flex application to Apache Royale, able to run helloworld applications. started migrating Application, getting couple of exceptions. bellow is the one.
we are using the
AdobeSpelling.swc
AlivePDF.swc
Cairngorm.swc
flexmdi.swc
FlexUnit.swc
spcairngorm.swc
these '.swc' libraries.
how can i import these or is any similar libraries in royale compatible files.
i found asconfig.json file - external-library-path - but i am compiling my application with maven pom.xml.
Please help me, basic migrations
Error Log:
Warning: Definition com.model.ModelLocator could not be found.
import com.model.ModelLocator;
Warning: Definition com.util.customComponents.CustomMenuBarEvent could
not be found.
import com.util.customComponents.CustomMenuBarEvent;
There is two path which you can go in case of migrating.
Emulation Components. However there is a chance that some of
the components wasn't added to emulation so you may get exceptions
and this would be the place where you can add them and make pull
requests to Royale. Those components allows you in best case
successfully build your application without changing drastically UI
part, but you may won't see anything on the screen or it may be
messed, cause there wasn't volunteer who could work on displaying
better them.
Another path is to distinguish your pure ActionScript code (no
dependency to Flash) from UI part - pure AS3 code should ported
without any problem - and rewrite UI from scratch using Basic module
or Jewel
All libraries which you have mention have strong dependencies to Flash, so my recommendation is to find JS replacement for them and use it in your porting. There is also PureMVC which is working pretty good with Royale - it's has been tested in several applications already.

What is the proper way to document a CMake module?

A quick Google search (...actually many rather extensive Google searches) have not been able to explain how to properly document a CMake module.
What I'm looking for is a way to document custom CMake modules so that they work with the cmake --help-module <module_name> command. Is there any standard way of doing this? Can anyone point me to some good examples? The documentation process seems oddly.... not well documented. Haha.
How are modules that work with cmake --help-module documented?
Any help is appreciated.
Quote from an email response I got from Brad King (member of the CMake Developers email list):
There is no way to do this. The only reason --help-module exists
at all is because prior to 3.0 the documentation was generated by
the CMake binary itself, and people were used to the option being
available. It is only for builtin modules and only available for
legacy reasons, and may one day go away in favor of the man pages
and html docs.
The online docs, like those at https://cmake.org/cmake/help/v3.14
do publish a /objects.inv to support intersphinx:
http://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
This was done on request of some users so I haven't looked into how
that works, but one should be able to use sphinx to generate one's
own documentation and still cross-reference CMake's online docs.
If you get that working we'd welcome a MR to add docs describing how,
perhaps in
https://gitlab.kitware.com/cmake/cmake/blob/master/Help/dev/documentation.rst
It sounds like using Sphinx is the way to go.
Additional info:
How does Sphinx know to go parse that ".cmake" file? Does Sphinx recognize the "cmake-module" keyword in a special way and know what to do with it?
it’s from a Sphinx module that you can find the in the CMake sources Utilities/Sphinx/cmake.py. Or you can install this file using pip:
pip install sphinxcontrib-moderncmakedomain
When configuring Sphinx, you have to name the extensions to use in Sphinx's configuration file (conf.py) and add the name of the extension (sphinxcontrib.moderncmakedomain) to the extensions array.
Good news: You can use sphinx to document your CMake Modules, and at the same time use Doxygen to document your C++ (or other) source code.
I created an example project which shows how to use the sphinxcontrib-moderncmakedomain in combination with Sphinx and Doxygen to generate Documentation for your C++ Code AND CMake code:
https://gitlab.com/Pro1/doxygen-cmake-sphinx
It is using the sphinxcontrib-moderncmakedomain package and CMake itself to configure the sphinx conf.py and then run sphinx.
The example is heavily based on the official CMake Documentation from: https://gitlab.kitware.com/cmake/cmake/-/tree/master/Utilities/Sphinx

CMake- Difficulties building static library

So I have been trying to build libarchive for a couple of days now, following this guide and many other threads: https://github.com/libarchive/libarchive/wiki/BuildInstructions
I want a static library with LZMA, zlib and bzip2 support. I got static versions of these too (lib's)
I just cant get it to work properly. Ive used CMAKE to generate the make files for VS2010 and NMAKE. With both of these options the thing compiles just fine, but when i try to use the archive_static.lib generated, in my project I get plenty of unresolved externals. Compiling the .dll version of the library works without unresolved externals, but then it starts asking for zlib.dll, bzip2.dll etc, which i dont have and dont want to use.
I think i need to set some flags with cmake, but im not sure how to do that.
Any help is greatly appreciated.
http://www.libarchive.org/
I can't be sure if that's what happening here, but please bear in mind, that when linking binaries into a static library, its external dependencies do not necessarily get embedded into it, that means you might need to provide thet static libraries on which your program indirectly depends through libarchive, namely LZMA, zlib and bzip2 in your case, explicitly.
Furthermore there's some confusion on windows when it comes to linking static vs dynamic, for in both cases you provide a .lib file, so it is very easy to mix things up and provide the dynamicaly linked .lib, instead of the static version. If you do that, the linker may refuse to link your program (that notably happens with boost), or may link just fine and then, at the time of execution, the OS will require the respective .dll's.

TypeScript asset manager

I use node.js connect/express.
Does anyone know an assets manager that supports on the fly compilation and minification of TypeScript source code?
Any idea how to call the compiler programmatically?
I've been using connect-assets which is build on top of Snockets. Shouldn't be that hard to implement once I figure how to compile a .ts resource.
From reading through the tsc.js code, it looks like there's a TypeScript.TypeScriptCompiler(outfile, errout, new TypeScript.NullLogger(), this.compilationSettings); function you could hook into. The code is on Codeplex, under an Apache license, and it's modular. Since TypeScript can be compiled to target CommonJS modules, it should be fairly straightforward to hack it into express.
Not a complete answer yet, but I found this project: which exposes the TypeScript compiler.
https://bitbucket.org/nxt/node-typescript-wrapper

Where to place a shared utility module in OCaml?

I have a file Tools.ml which contains some common utility functions I write myself. Under .../Code/ I have several folders which each contains a project. My question is where I should place this Tools.ml such that all the folders and files under .../Code/ could share this module by Open Tools.
Hope my question is clear... Does anyone have a good solution?
Edit1: Following #gasche's answer, I have written tools.ml as follows:
module Tools =
struct
let a_function = ...
...
end
Then I compiled it, and done ocamlfind install tools META tools.cmo tools.cmx tools.ml as suggested, which looks going well. Then I have written test.ml as follows:
open Tools
let f = Tools.a_function
then I compiled it with ocamlc test.ml -o test, then I got an error:
File "test.ml", line 1, characters 0-1:
Error: Error while linking test.cmo:
Reference to undefined global `Tools'
Could anyone tell me what happened?
You could package it as an independent library, install it with other OCaml libraries, and access to it, from your project, as a library.
A very simple way to do this is to write a META file for ocamlfind. Create a directory somewhere you're comfortable to hold you "personal library" project. Suppose you have tools.ml and tools.mli, and your code depends on some findlib package (eg. unix and bigarray). You META would look like this:
name="tools"
description="personal collection of utilities"
version="0.1"
requires="unix,bigarray"
archive(byte)="tools.cmo"
archive(native)="tools.cmx"
Once you have written this META file, it is easy to ask ocamlfind to "install" the library (and remove it if you want to), and use it in your other projects. To install, the syntax is ocamlfind install <name> <meta-file> <file1> <file2> ... where <file1>, <file2>.. are the file you wish to see included in the installation directory. You must at least have tools.cmi tools.cmo (and tools.o and tools.cmx for native compilation), but it is good practice to also have tools.mli for example (and, if you want to provide the code, tools.ml).
ocamlfind install tools META tools.cmi tools.cmo tools.o tools.cmx tools.mli
(Of course tools.cmo etc. have to exist, that is you must install after you have compiled your package. If you have used ocamlbuild, they are likely to be in a _build subdirectory, so ocamlfind install ... _build/tools.cmo ....)
From your numerous projects, you can use your library easily, either using the ocamlfind toold directly if this is what you already do to compile your programs
ocamlfind ocamlc -package tools ....
or through the facilities provided by ocamlbuild for example, adding package(tools) to your tags.
To reinstall your library if you made a change to it and want it accessible from your projects
ocamlfind remove tools
ocamlfind install tools META ...
You could also handle all this through oasis, which is a layer on top of ocamlfind/ocamlbuild to automate this process. I'm not familiar enough with oasis to give such examples off the top of my head, but it should be equally simple for such a restricted case (one-file library), and scale better if you wish later to extend your library (eg. it can also handle documentation generation, pre-compilation configuration...).