Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
his PR changes completely the `NbBlock` type that is at the basis of Nimib and makes it easier to create custom blocks. A block will now be created using `newNbBlock` template (in `nimib / blocks`, exported) where we assign a `command` to the block (e.g. `"nbText", "nCode", "nbSource"`) and in order for rendering to be correct, `partials` and a sequence of `renderProc`s need to be defined associated to the above command. "Native" blocks and custom blocks are defined in the same way, the only difference is that for native blocks the block is defined in `src/nimib.nim` and the `partial`s and `renderProc`s are defined in `src/nimib/render` while in custom blocks they will likely be defined next to one other. along with the above changes there are a few welcome add-ons: - a better logging of what happens while running blocks - some tests, sorely needed since ptest was (rightfully) removed - a new partial `main` some other accidental or not so welcome changes: - `sugar` is now exported _(accidental)_ - `nb: NbDoc` is mutated when rendered _(unwelcome, will be changed later)_ - cannot use both Html and Md backend at the same time _(unwelcome, will be changed later)_ this feature will be the main highlight of next release (0.3) but in order to merge this PR some stuff needed for release is left out. Among stuff left out: - `nbFile` is likely broken, should be fixed and tested inside Nimib (and examples should be added) - documentation has not improved and it should - I need to check that (some) projects depending on nimib are not broken (e.g. nimibook, scinim, ...) after that a release of 0.3 should be in order. Release name will be **Block Maker**. During work on this release I have also identified next milestone for 0.4: better handling of render backends (release name backendMaker). In particular: > a big next change would be to use a json data in NbBlock instead of context and generate context during save. In this way you could go back to use multiple render backends at once, document could be made not mutable during save, ... ---- commits * new newBlock (with test) * code is stripped as default * imporve tests * add dev notes (to be removed at the end) * moved templates outside of nbInit * update dev notes * preliminaries to change rendering of block * newNbBlock refactored (and renamed) * nbNormalize * add note \c == \r and \l == \n * change name to tests * add new nbText, nbCode with tests * only log output if there is output * use always check * new renderBlock working with (minimal) test * nim r hello works! πΎ * mostaccio ok * numerical ok * nolan ok * pythno ok * remove ptest * general cleanup * update nbImage to refactored blocks * minimal plan to just merge * cheatsheet fixed * update nimble docs * markdown backend + index * update nimble docs and rerun * more cleanup and remove NbKind * finalize notes * remove refactor notes
- Loading branch information