Skip to content

Commit

Permalink
v0.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Bataev committed Mar 14, 2021
1 parent 031dba9 commit 746a364
Show file tree
Hide file tree
Showing 9 changed files with 462 additions and 440 deletions.
16 changes: 13 additions & 3 deletions core/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ func formatVectorVertically(v *Vector, w io.Writer, indent int) int {
var defRegex *regexp.Regexp = regexp.MustCompile("^def.*$")
var ifRegex *regexp.Regexp = regexp.MustCompile("^if(-.+)?$")
var whenRegex *regexp.Regexp = regexp.MustCompile("^when(-.+)?$")
var doIndentRegex *regexp.Regexp = regexp.MustCompile("^(do|try|finally|go|alt!|alt!!)$")
var bodyIndentRegexes []*regexp.Regexp = []*regexp.Regexp{
regexp.MustCompile("^(bound-fn|if|if-not|case|cond|cond->|cond->>|as->|go|condp|when|while|when-not|when-first|do|future|thread)$"),
regexp.MustCompile("^(bound-fn|if|if-not|case|cond|cond->|cond->>|as->|condp|when|while|when-not|when-first|do|future|thread)$"),
regexp.MustCompile("^(comment|doto|locking|proxy|with-[^\\s]*|reify)$"),
regexp.MustCompile("^(defprotocol|extend|extend-protocol|extend-type|try|catch|finally|let|letfn|binding|loop|for|go-loop|alt!|alt!!)$"),
regexp.MustCompile("^(defprotocol|extend|extend-protocol|extend-type|catch|let|letfn|binding|loop|for|go-loop)$"),
regexp.MustCompile("^(doseq|dotimes|when-let|if-let|defstruct|struct-map|defmethod|testing|are|deftest|context|use-fixtures)$"),
regexp.MustCompile("^(POST|GET|PUT|DELETE)"),
regexp.MustCompile("^(handler-case|handle|dotrace|deftrace|match)$"),
Expand All @@ -129,6 +130,15 @@ func isOneAndBodyExpr(obj Object) bool {
}
}

func isDoIndent(obj Object) bool {
switch s := obj.(type) {
case Symbol:
return doIndentRegex.MatchString(*s.name)
default:
return false
}
}

func isBodyIndent(obj Object) bool {
switch s := obj.(type) {
case Symbol:
Expand Down Expand Up @@ -238,7 +248,7 @@ func formatSeqEx(seq Seq, w io.Writer, indent int, formatAsDef bool) int {
prevObj = seq.First()
seq = seq.Rest()
}
} else if obj.Equals(SYMBOLS.do) || obj.Equals(SYMBOLS.try) || obj.Equals(SYMBOLS.finally) {
} else if isDoIndent(obj) {
if !seq.IsEmpty() && !isNewLine(obj, seq.First()) {
restIndent = i + 1
}
Expand Down
2 changes: 1 addition & 1 deletion core/procs.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
PRINT_IF_NOT_NIL
)

const VERSION = "v0.15.7"
const VERSION = "v0.16.0"

const (
CLJ Dialect = iota
Expand Down
10 changes: 8 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ <h2>Index of <a href="#joker-std-ns">Namespaces</a></h2>
<a href="#joker.json">joker.json</a>
</li>
<li>
<a href="#joker.math">joker.math</a>
<a href="#joker.markdown">joker.markdown</a>
</li>
<li>
<a href="#joker.markdown">joker.markdown</a>
<a href="#joker.math">joker.math</a>
</li>
<li>
<a href="#joker.os">joker.os</a>
Expand Down Expand Up @@ -484,6 +484,12 @@ <h3 class="ns" id="joker.json">joker.json</h3>
<p class="var-docstr">Implements encoding and decoding of JSON as defined in RFC 4627.</p>
<a href="joker.json.html">details</a>
</li>
<li>
<h3 class="ns" id="joker.markdown">joker.markdown</h3>
<span class="var-added">v1.0</span>
<p class="var-docstr">Implements GitHub Flavored Markdown rendering.</p>
<a href="joker.markdown.html">details</a>
</li>
<li>
<h3 class="ns" id="joker.math">joker.math</h3>
<span class="var-added">v1.0</span>
Expand Down
762 changes: 381 additions & 381 deletions docs/joker.core.html

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions docs/joker.markdown.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<html>

<head>
<link rel="stylesheet" type="text/css" href="main.css">
</head>

<body>
<div class="main">
<h1>Namespace: joker.base64</h1>
<h1>Namespace: joker.markdown</h1>
<span class="var-added">v1.0</span>
<h2>Contents</h2>
<ul>
Expand All @@ -31,12 +29,12 @@ <h2 id="_summary">Summary</h2>
<h2 id="_index">Index</h2>
<ul class="index">
<li>
<a href="#convert-string">convert-string</a>
</li>
<a href="#convert-string">convert-string</a>
</li>

</ul>
<h2 id="_constants">Constants</h2>
Constants are variables with <tt>:const true</tt> in their metadata. Joker currently does not recognize them as
special; as such, it allows redefining them or their values.
Constants are variables with <tt>:const true</tt> in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.
<ul>
(None.)
</ul>
Expand All @@ -47,15 +45,18 @@ <h2 id="_variables">Variables</h2>
<h2 id="_functions">Functions, Macros, and Special Forms</h2>
<ul>
<li>
<h3 class="Function" id="convert-string">convert-string</h3>
<span class="var-kind Function">Function</span>
<span class="var-added">v1.0</span>
<pre class="var-usage"><div><code>(convert-string s)</code></div></pre>
<p class="var-docstr">Returns the HTML rendering of Markdown string s.</p>
</li>
<h3 class="Function" id="convert-string">convert-string</h3>
<span class="var-kind Function">Function</span>
<span class="var-added">v1.0</span>
<pre class="var-usage"><div><code>(convert-string s)</code></div>
</pre>
<p class="var-docstr">Returns the HTML rendering of Markdown string s</p>


</li>

</ul>
</div>
</body>
<script src="main.js"></script>

</html>
</html>
6 changes: 5 additions & 1 deletion docs/joker.string.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ <h3 class="Function" id="split">split</h3>
<pre class="var-usage"><div><code>(split s sep)</code></div>
<div><code>(split s sep n)</code></div>
</pre>
<p class="var-docstr">Splits string on a string or regular expression. Returns vector of the splits.</p>
<p class="var-docstr">Splits string on a string or regular expression. Returns vector of the splits.<br>
<br>
No more than n elements will be returned in the vector; the last element will<br>
be the unsplit remainder. If n is &lt;= 0, no limit is in effect (all substrings<br>
are returned in the vector).</p>


</li>
Expand Down
Loading

0 comments on commit 746a364

Please sign in to comment.