Skip to content

Commit

Permalink
3.8.0 feat(mapjs): Add basic mapjs integration
Browse files Browse the repository at this point in the history
- `src/pandoc-argmap.lua`: Update to convert argmap to mapjs format.
- `mapjs-example/src/start.js`:
  - Requires map.json dynamically.
  - `init()` takes map.json path: as second argument, or from container.
- [README.md](../README.md):
  - Add info about generating html containing mapjs format.
    - Add `docs/mapjs-in-html-example.png`.
    - Explain `convertTo="mapjs"` functionality.
  - Fix code formatting for latex code block examples.
  - Fix argmap code block examples to display relevant attributes.
- Add references in various places to mapjs .json Data Format.
- `scripts/`:
  - `bash_aliases_argmap.sh`:
    - Add new functions:
      - `md2hf`:
        - Generates index.html from template, mup.json with webpack.
        - Fix bug with template parameter using relative path.
        - BUG #21: Hangs when calling `argmh` when browser already open.
      - `chrome-mini`: Utility function.
    - Update md2htm() to use custom mapjs html5 template.
    - Remove unnecessary calls to webpack.
  - `tests.sh`:
    - Use init file variables instead of own.
    - Fix test #6 to use newer html function.
- `Input/`:
  - `Example1_ClearlyFalse_WhiteSwan_simplified.md`:
    - Use two code snippets, one for png output and one for mapjs.
    - Add meta-data for use in template.
- `.vscode/launch.json`:
  - Add `cat X | argmap2mup` profile.
  - Fix html output profile.
  - Update pandoc test to use my own example files.
  • Loading branch information
s6mike committed Aug 12, 2022
1 parent 69a9d82 commit fde1fa5
Show file tree
Hide file tree
Showing 10 changed files with 491 additions and 153 deletions.
35 changes: 31 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lua-local",
"request": "launch",
"name": "Lua Local: cat example | argmap2mup",
"program": {
// "command": "cat examples/example.yml | ${workspaceFolder}/${config:lua.debug.settings.argmap.src.folder}/argmap2mup.lua",
"command": "cat",
},
"args": [
"${workspaceFolder}/examples/example.yml",
"|",
"${workspaceFolder}/${config:lua.debug.settings.argmap.src.folder}/argmap2mup.lua",
],
"env": {
"PATH": "${config:lua.debug.settings.env.path}",
"LUA_PATH": "${config:lua.debug.settings.path}",
"LUA_CPATH": "${config:lua.debug.settings.cpath}",
// "PATH": "${env:PATH}",
// "LUA_PATH": "${workspaceFolder}/src/?.lua;${workspaceFolder}/src/?/init.lua;${workspaceFolder}/lua_modules/share/lua/5.3/?.lua;${workspaceFolder}/lua_modules/share/lua/5.3/?/init.lua;/opt/miniconda3/envs/argumend/share/lua/5.3/?.lua;/opt/miniconda3/envs/argumend/share/lua/5.3/?/init.lua;/opt/miniconda3/envs/argumend/share/lua/5.3/lua_modules/share/lua/5.3/?.lua;/opt/miniconda3/envs/argumend/share/lua/5.3/lua_modules/share/lua/5.3/?/init.lua;/opt/miniconda3/envs/argumend/lib/lua/5.3/?.lua;/opt/miniconda3/envs/argumend/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua;/home/s6mike/.luarocks/share/lua/5.3/?.lua;/home/s6mike/.luarocks/share/lua/5.3/?/init.lua",
// "LUA_CPATH": "${workspaceFolder}/lua_modules/lib/lua/5.3/?.so;/opt/miniconda3/envs/argumend/lib/lua/5.3/?.so;/opt/miniconda3/envs/argumend/share/lua/5.3/lua_modules/lib/lua/5.3/?.so;/opt/miniconda3/envs/argumend/lib/lua/5.3/loadall.so;./?.so;/home/s6mike/.luarocks/lib/lua/5.3/?.so",
// "PATH": "$WORKSPACE/lua_modules/bin:/home/s6mike/.luarocks/bin:/home/s6mike/bin:/opt/miniconda3/envs/argumend/bin:/opt/miniconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games",
},
"stopOnEntry": true,
},
{
"type": "lua-local",
"request": "launch",
Expand All @@ -27,7 +51,7 @@
// "LUA_CPATH": "${workspaceFolder}/lua_modules/lib/lua/5.3/?.so;/opt/miniconda3/envs/argumend/lib/lua/5.3/?.so;/opt/miniconda3/envs/argumend/share/lua/5.3/lua_modules/lib/lua/5.3/?.so;/opt/miniconda3/envs/argumend/lib/lua/5.3/loadall.so;./?.so;/home/s6mike/.luarocks/lib/lua/5.3/?.so",
// "PATH": "$WORKSPACE/lua_modules/bin:/home/s6mike/.luarocks/bin:/home/s6mike/bin:/opt/miniconda3/envs/argumend/bin:/opt/miniconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games",
},
"stopOnEntry": false,
"stopOnEntry": true,
},
{
"type": "lua-local",
Expand Down Expand Up @@ -79,18 +103,21 @@
"command": "pandoc",
},
"args": [
"examples/example.md",
"--template ${workspaceFolder}/pandoc-templates/mapjs/mapjs-main-html5.html",
"${workspaceFolder}/Input/Example1_ClearlyFalse_WhiteSwan_simplified.md",
"-o",
"Output/example.html",
"${workspaceFolder}/mapjs-example/index.html",
"--lua-filter pandoc-argmap.lua",
"--data-dir=${config:lua.debug.settings.system_root}/share/pandoc",
"--metadata=mapjs-output-js:${workspaceFolder}/mapjs-example/site/main.js",
"--metadata=css:mapjs-default-styles.css",
],
"env": {
"PATH": "${config:lua.debug.settings.env.path}",
"LUA_PATH": "${config:lua.debug.settings.path}",
"LUA_CPATH": "${config:lua.debug.settings.cpath}",
},
"stopOnEntry": false,
"stopOnEntry": true,
},
{
"type": "lua-local",
Expand Down
30 changes: 24 additions & 6 deletions Input/Example1_ClearlyFalse_WhiteSwan_simplified.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
---
title: Example 1 - All swans are white.
template: pandoc-templates/mapjs/mapjs-main-html5.html
# TODO: These might be better in a defaults file:
# https://workflowy.com/#/ee624e71f40c
# css: test/mapjs-default-styles.css
# mapjs-output-js: test/bundle.js
# lua-filter: "$WORKSPACE/src/pandoc-argmap.lua"
# data-dir: "$PANDOC_DATA_DIR"
argmaps: true
---

This is a simplified version of the White Swan argument.
This is a simplified version of the White Swan argument:

``` {.argmap name="Example 1: All swans are white."}
All swans are white.:
```{#argmap1 .argmap .yml name="Example 1: All swans are white."}
"All swans are white.":
r1:
Every swan I've ever seen is white.: []
These swans are representative of all swans.: []
"Every swan I've ever seen is white.": []
"These swans are representative of all swans.": []
o2:
Not all swans are white.: []
"Not all swans are white.": []
```

And here it is in mapjs format:

```{#argmap1 .argmap .yml name="Example 1: All swans are white." convertTo="mapjs"}
"All swans are white.":
r1:
"Every swan I've ever seen is white.": []
"These swans are representative of all swans.": []
o2:
"Not all swans are white.": []
```
Loading

0 comments on commit fde1fa5

Please sign in to comment.