wisp-lang / wisp

A little Clojure-like LISP in JavaScript

Home Page:https://gozala.github.io/wisp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

normalize documentation metadata for namespaces and variables

robjens opened this issue · comments

commented

May I suggest we add a additional function to wisp.string called e.g. normalize which would be defined as:

(defn normalize
  "Replace white space characters (tab, space, new line) with single space."
  [x] (if (string? x) (.replace x (RegExp. "[\\s|\\n|\\t]+" "g") " ")
        x))

And used in src/analyzer.wisp lines 217 and 694 as:

:doc (normalize doc)

This will strip/trim any excess white space from the compiled JavaScript output. Metadata strings (imho) shouldn't be hard-wrapped by compilation process. This is something created during development (design-time) but I would assume may at some point be intepreted by other viewers, not only console (and even if so, the virtual terminal emulator is perfectly fine soft-wrapping lengthy strings and since wisp isn't following strict 80 column rule anyway, tty console would still be 'borked').

commented

On second thought... this would screw forms such as:

(ns some.lib
  "Some very lengthy summary of things in this library:

   - foo 
   - bar
   - baz")

Since stupid JS doesn't do multiline strings.... I guess the current method actually is the way to go, encode the new lines as character symbols in the string as literal \n.

Meh. I guess I can close this.