770d7a772e17ecce8e01711e1daed1a1aa3c3a73 — Oliver Vartiainen 6 months ago d640698
Improve syntax highlighting for Lua on /see
3 files changed, 12 insertions(+), 10 deletions(-)

M fennel-highlight
M fennel.css
M see.fnl
M fennel-highlight => fennel-highlight +1 -1
@@ 1,1 1,1 @@
Subproject commit 40579dab8a56a66b38ce7b8427f9aad7522a5805
Subproject commit c8f38e652c2c73fa50acb4ae93eb6797f761e419

M fennel.css => fennel.css +3 -3
@@ 157,9 157,9 @@ tt, pre, code, kbd, textarea { font-family: "Fira Mono", Inconsolata, monospace;
#see-fennel .editor pre .number,
#see-fennel .editor pre .nil,
#see-fennel .editor pre .boolean { color: #8e9144; }
#see-fennel .editor pre .symbol.special-symbol,
#see-fennel .editor pre .symbol.macro-symbol,
#see-fennel .editor pre .symbol.global-symbol { color: #448f22; font-weight: bold; }
#see-fennel .editor pre .symbol.special,
#see-fennel .editor pre .symbol.macro,
#see-fennel .editor pre .symbol.global { color: #448f22; font-weight: bold; }

#see-fennel button, #see-fennel select {
    margin: 0.5em;

M see.fnl => see.fnl +8 -6
@@ 52,9 52,10 @@
(local fennel-syntax (require :syntax-table))

(fn highlight-fennel []
  (let [highlight (require :highlight)]
    (set fennel-highlighted.innerHTML
         (highlight.for-html fennel-syntax fennel-source.value))))
  (let [highlight (require :highlight)
        highlighted-source-tags (highlight.fennel->html fennel-syntax fennel-source.value)
        highlighted-source (table.concat highlighted-source-tags)]
    (set fennel-highlighted.innerHTML highlighted-source)))

(local lua-syntax (collect [k v (pairs fennel-syntax)]
                    (if v.global? (values k v))))

@@ 65,9 66,10 @@
  (tset lua-syntax k {:special? true}))

(fn highlight-lua []
  (let [highlight (require :highlight)]
    (set lua-highlighted.innerHTML
         (highlight.for-html lua-syntax lua-source.value))))
  (let [highlight (require :highlight)
        highlighted-source-tags (highlight.lua->html fennel-syntax lua-source.value)
        highlighted-source (table.concat highlighted-source-tags)]
    (set lua-highlighted.innerHTML highlighted-source)))

;; initial run, since there could be something left in the textarea
;; after a page refresh