Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new release] printbox (3 packages) (0.7) #24668

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

c-cube
Copy link
Contributor

@c-cube c-cube commented Oct 24, 2023

Allows to print nested boxes, lists, arrays, tables in several formats

CHANGES:

0.7

  • move to 4.08 as lower bound

  • preformatted text style instead of global setting

  • PrintBox_html:

    • Optionally wrap text with the <pre> HTML element
    • Output text consistently as <span>, not <div>
    • Use <details><summary> for collapsible trees
  • fix: Tree connectors touching frames (Tree connectors touching frames c-cube/printbox#26)

0.6.1

  • compat with dune 3

0.6

  • move text rendering into a new printbox-text library
  • Changing visuals for hlines and vlines connections, and tree structure
    using unicode characters for box borders

0.5

  • reenable mdx for tests
  • custom classes/attributes for html translation in PrintBox_html
  • add link case
  • examples: add lambda.ml

0.4

  • remove <p> in rendering text to html
  • add grid_map_l and v_record
  • add another test

0.3

  • improve code readability in text rendering

  • add align and center

  • add basic styling for text (ansi codes/html styles)

  • add printbox_unicode for setting up proper unicode printing

  • add grid_l, grid_text_l, and record helpers

  • use a more accurate length estimate for unicode, add test

  • remove mdx as a test dep

  • fix rendering bugs related to align right, and padding

0.2

  • make the box type opaque, with a view function

  • require OCaml 4.03

  • add PrintBox_text.pp

  • expose a few new functions to build boxes

  • change Text type, work on string slices when rendering

  • automatic testing using dune and mdx

  • migrate to dune and opam 2

0.1

initial release

CHANGES:

## 0.7

- move to 4.08 as lower bound
- `preformatted` text style instead of global setting
- PrintBox_html:
  * Optionally wrap text with the `<pre>` HTML element
  * Output text consistently as `<span>`, not `<div>`
  * Use `<details><summary>` for collapsible trees

- fix: Tree connectors touching frames (c-cube/printbox#26)

## 0.6.1

- compat with dune 3

## 0.6

- move text rendering into a new printbox-text library
- Changing visuals for hlines and vlines connections, and tree structure
  using unicode characters for box borders

## 0.5

- reenable mdx for tests
- custom classes/attributes for html translation in `PrintBox_html`
- add `link` case
- examples: add lambda.ml

## 0.4

- remove `<p>` in rendering text to html
- add `grid_map_l` and `v_record`
- add another test

## 0.3

- improve code readability in text rendering
- add `align` and `center`
- add basic styling for text (ansi codes/html styles)
- add `printbox_unicode` for setting up proper unicode printing
- add `grid_l`, `grid_text_l`, and `record` helpers

- use a more accurate length estimate for unicode, add test
- remove mdx as a test dep
- fix rendering bugs related to align right, and padding

## 0.2

- make the box type opaque, with a view function
- require OCaml 4.03

- add `PrintBox_text.pp`
- expose a few new functions to build boxes
- change `Text` type, work on string slices when rendering

- automatic testing using dune and mdx
- migrate to dune and opam 2

## 0.1

initial release
@c-cube
Copy link
Contributor Author

c-cube commented Oct 24, 2023

damn, there's a test (the mdx one, on the readme) that truly belongs to two distinct packages (printbox-text and printbox-html). What should I do?

@mseri
Copy link
Member

mseri commented Oct 25, 2023

#=== ERROR while compiling printbox-text.0.7 ==================================#
# context              2.2.0~alpha3~dev | linux/x86_64 | ocaml-base-compiler.4.08.1 | pinned(https://github.com/c-cube/printbox/releases/download/v0.7/printbox-0.7.tbz)
# path                 ~/.opam/4.08/.opam-switch/build/printbox-text.0.7
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune runtest -p printbox-text -j 255
# exit-code            1
# env-file             ~/.opam/log/printbox-text-8-0ea0d5.env
# output-file          ~/.opam/log/printbox-text-8-0ea0d5.out
### output ###
# File "README.md", line 1, characters 0-0:
# /usr/bin/git --no-pager diff --no-index --color=always -u _build/default/README.md _build/default/README.md.corrected
# diff --git a/_build/default/README.md b/_build/default/README.md.corrected
# index 549a936..7493c6e 100644
# --- a/_build/default/README.md
# +++ b/_build/default/README.md.corrected
# @@ -256,10 +256,10 @@ an alternative solution where trees are printed in HTML using the
#  
#  ```ocaml
#  # #require "printbox-html";;
# +No such package: printbox-html
#  # print_endline PrintBox_html.(to_string
#    ~config:Config.(tree_summary true default)
#      B.(tree (text "0")[text "1"; tree (text "ω") [text "ω²"]]));;
# -<div><details><summary><span class="">0</span></summary><ul><li><span class="">1</span></li><li><details><summary><span class="">ω</span></summary><ul><li><span class="">ω²</span></li></ul></details></li></ul></details></div>
# -
# -- : unit = ()
# +Line 1, characters 15-28:
# +Error: Unbound module PrintBox_html
#  `

@c-cube
Copy link
Contributor Author

c-cube commented Oct 25, 2023

yes, this is my problem. The test naturally belongs to both libraries but this will try to run it with only one of the two.

@c-cube
Copy link
Contributor Author

c-cube commented Oct 25, 2023

Some kind of weird breakage of toplevel printers on 5.0?

Cannot find type Topdirs.printer_type_new.

@mseri
Copy link
Member

mseri commented Oct 25, 2023

I was perhaps expecting a failure in 5.1, where this happened:


* #11745, #12358: Debugger and toplevels: embed printer types rather than
  reading their representations from topdirs.cmi at runtime.
  This change also removes the ocamlmktop initialization module introduced
  in #11382 which was no longer useful.
  This change breaks toplevel scripts relying on the visibility of `Topdirs`
  in the initial toplevel environment without loading `topfind`.
  Since the opam default `.ocamlinit` file loads `topfind`, it is expected
  that only scripts run with `ocaml -noinit` are affected.
  For those scripts, accessing `Topdirs` now requires the `compiler-libs`
  directory to be added to the toplevel search path with
#directory "+compiler-libs";;
as was already the case for the other modules in the toplevel interface
library.
(Sébastien Hinderer, review by Florian Angeletti, Nicolás Ojeda Bär and
Gabriel Scherer)
```

@mseri
Copy link
Member

mseri commented Oct 25, 2023

Can it be due to topdirs only being available with +compiler-libs in 5.0?

@c-cube
Copy link
Contributor Author

c-cube commented Oct 25, 2023 via email

@lukstafi
Copy link
Contributor

Thanks for doing the review! Maybe I can help tomorrow.

Some kind of weird breakage of toplevel printers on 5.0?

This is maybe a known issue, or at least related to: realworldocaml/mdx#410

@mseri
Copy link
Member

mseri commented Oct 26, 2023

Thanks a lot, then I suggest to merge this. The test issue will disappear once we move to test 5.1 and 5.2

@mseri mseri merged commit 42d1736 into ocaml:master Oct 26, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants