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

Pretty-print JAAL #6

Open
atilante opened this issue Jun 17, 2022 · 0 comments
Open

Pretty-print JAAL #6

atilante opened this issue Jun 17, 2022 · 0 comments
Labels
UI user interface & usability

Comments

@atilante
Copy link

Extra: implement a functionality which pretty-prints JAAL data.

Purpose: the developer can see the JAAL data structure more easily. The complexity of the actual, machine-generated JAAL data can be inspected.

What we want: an output similar to the manually-written JAAL test datas, such as jaal-dijkstra-student.json.

Requirements:

  • monospace font
  • indentation: 2 spaces
  • 80 characters per line
  • SVG data only as string: SVG (%d bytes), where %d is the length of the SVG code in bytes.

Note: there might be JSON pretty-printing libraries already. Also see JSON.stringify.

This could be just logged into the browser console.

Nice to have, not required:

  • a modal window or box with scrollbars which shows the JAAL data
  • JSON syntax highlighting
  • rule: if a JSON entry is an array which has no nested objects and it fits on the current line after indentation, print it on a single line.

Example:

            {
              "id": "edge3", 
              "node": ["nodeB", "nodeE"], 
              "tag": "4", 
              "style": "unselected"
            },

The node entry is on a single line.

@atilante atilante added the UI user interface & usability label Jun 17, 2022
Meratyn added a commit to Meratyn/jsav-exercise-player that referenced this issue Jun 22, 2022
Fulfil Aalto-LeTech#6

`package.json`: add `fracturedjsonjs` package as dependency
`dijkstraPE-research.html`: Remove unused checkbox + button scaffolding.
`player.js`: adapt the JAAL modal popup to directly display the JAAL dump.
Give the modal a z-index higher than the edge labels (700).
JSON.stringify to replace the svg dumps with data size.
Use `fracturedjsonjs`'s `formatter` to give the condensed JSON print.
maxInLineLength restricts how objcets/arrays are serialised. max of 40
gives in-line arrays, but objects still expanded. Max of 50 gives
inline arrays and `node` list in `dataStructures` as single-line.
Default of 80 gives inconsistent `edge` list in `dataStructures`, as the
single-character id number, node numbers and tag is 80 long.
It needs to be set either longer or shorter.
Meratyn added a commit to Meratyn/jsav-exercise-player that referenced this issue Jun 23, 2022
Fulfil Aalto-LeTech#6

`package.json`: add `fracturedjsonjs` package as dependency
`dijkstraPE-research.html`: Remove unused checkbox + button scaffolding.
`player.js`: adapt the JAAL modal popup to directly display the JAAL dump.
Give the modal a z-index higher than the edge labels (700).
JSON.stringify to replace the svg dumps with data size.
Use `fracturedjsonjs`'s `formatter` to give the condensed JSON print.
maxInLineLength restricts how objcets/arrays are serialised. max of 40
gives in-line arrays, but objects still expanded. Max of 50 gives
inline arrays and `node` list in `dataStructures` as single-line.
Default of 80 gives inconsistent `edge` list in `dataStructures`, as the
single-character id number, node numbers and tag is 80 long.
It needs to be set either longer or shorter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI user interface & usability
Projects
None yet
Development

No branches or pull requests

1 participant