aboutsummaryrefslogtreecommitdiff
path: root/md.bqn
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-20 14:54:19 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-20 15:08:52 -0400
commiteecbb6875af7dcc40d016eae596bf508e9a3ae57 (patch)
tree43048e0ac505e3b7927f2342a4ff374b37479428 /md.bqn
parente52d50ed594dd5626523ca7931315e47bde8c9d1 (diff)
Don't print assignment results when auto-running code
Diffstat (limited to 'md.bqn')
-rw-r--r--md.bqn21
1 files changed, 14 insertions, 7 deletions
diff --git a/md.bqn b/md.bqn
index bda35610..55a5b236 100644
--- a/md.bqn
+++ b/md.bqn
@@ -130,8 +130,15 @@ Markdown ← {filename𝕊𝕩:
# If every line is indented by at least 4 additional spaces, we will
# execute each one and insert the results.
addRslt ← ∧´ ' ' = ∾ 4 (⌊⟜≠ ↑ ⊢)¨ 𝕩
+ # Don't show assignment results by default
+ ShowRslt ← {
+ depth ← +` "(){}⟨⟩" (⊣(≠⊸>ׯ1⋆2|⊢)⊐) 𝕩
+ 𝕩 /˜↩ ¬ ∨`⌾⌽ (0=depth) ∧ 𝕩∊"⋄," # Just the last statement
+ g ← 𝕩∊"←↩"
+ (⊑g⊐1) (<⟜(≠g))◶⟨1,¬(" "∾∾idChars)∧´∘∊˜↑⟩ 𝕩
+ }
r‿ri ← addRslt◶(2⥊<⟨⟩)‿{
- ⟨ (⥊∾⟜lf⎉1)∘⍕∘CodeExec⍟(0<≠)¨ 𝕩
+ ⟨ (ShowRslt ⊣◶⟨"",(⥊∾⟜lf⎉1)∘⍕∘⊢⟩ CodeExec)⍟(0<≠)¨ 𝕩
1 -˜ +` 1 + ≠¨ 𝕩 ⟩ # Don't forget the trailing newline
} 𝕩
@@ -383,13 +390,13 @@ TestSections ← {
################################
# Syntax highlighting
+idChars ← ⟨
+ •d∾"¯.π∞"
+ ' '+⌾•UCS•a
+ •a
+ "_"
+⟩
GetHighlights ← {
- idChars ← ⟨
- •d∾"¯.π∞"
- ' '+⌾•UCS•a
- •a
- "_"
- ⟩
classes‿chars ← <˘ ⍉ 2⊸(÷˜⟜≠∾⊣)⊸⥊⟨
0 , " "∾•UCS 9‿10
"Value" , ¯1⊏˘5‿2⥊"𝕨𝕩𝕗𝕘𝕤"