File tree Expand file tree Collapse file tree 6 files changed +37
-5
lines changed
registry/data/org/openoffice/Office
com/github/beothorn/clojurecalc Expand file tree Collapse file tree 6 files changed +37
-5
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,18 @@ Combine the power of clojure with all the LibreOffice calc features!!!
4
4
5
5
ClojureCalc is a wrapper for clojure 1.6 on libre office and possibly open office.
6
6
7
- To install use [ ClojureCalc.oxt] ( https://github.com/beothorn/ClojureCalc/releases/download/1.0 .0/ClojureCalc.oxt )
7
+ To install use [ ClojureCalc.oxt] ( https://github.com/beothorn/ClojureCalc/releases/download/1.1 .0/ClojureCalc.oxt )
8
8
9
9
Usage
10
10
====================
11
11
12
+ =c( string with a clojure function, without wrapping parenthesis )
12
13
=clj( string with a clojure expression )
13
14
=cljcol( cell range to convert to a clojure collection )
14
15
15
16
Note: Three single quotes are replaced by a double quote
16
17
17
- ![ screenshot] ( http://i.imgur.com/93UZ7qq .png " Really cool example ")
18
+ ![ screenshot] ( http://i.imgur.com/ePwRK5O .png " Really cool example ")
18
19
19
20
Examples
20
21
====================
Original file line number Diff line number Diff line change 29
29
</node >
30
30
</node >
31
31
</node >
32
+ <node oor : name =" c" oor : op =" replace" >
33
+ <prop oor : name =" DisplayName" >
34
+ <value xml : lang =" en" >c</value >
35
+ </prop >
36
+ <prop oor : name =" Description" >
37
+ Evaluates a clojure expression, automatically wraps the expression with parenthesis
38
+ <value />
39
+ </prop >
40
+ <prop oor : name =" Category" >
41
+ <value >Add-In</value >
42
+ </prop >
43
+ <prop oor : name =" CompatibilityName" >
44
+ <value />
45
+ </prop >
46
+ <node oor : name =" Parameters" >
47
+ <node oor : name =" exp" oor : op =" replace" >
48
+ <prop oor : name =" DisplayName" >
49
+ <value xml : lang =" en" >A clojure expression to be evaluated, ''' (three single quotes) are replaced by a double quote </value >
50
+ </prop >
51
+ <prop oor : name =" Description" >
52
+ <value />
53
+ </prop >
54
+ </node >
55
+ </node >
56
+ </node >
32
57
<node oor : name =" cljcol" oor : op =" replace" >
33
58
<prop oor : name =" DisplayName" >
34
59
<value xml : lang =" en" >cljcol</value >
Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ public String clj(String exp)
78
78
return ClojureInterpreter .runClojure (exp );
79
79
}
80
80
81
+ public String c (String exp )
82
+ {
83
+ if (exp .trim ().equals ("" )) return "" ;
84
+ return ClojureInterpreter .runClojure ("(" +exp +")" );
85
+ }
86
+
81
87
public String cljcol (String [][] cells ){
82
88
return ClojureInterpreter .toClojureCollection (cells );
83
89
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ private static String getLine(final String[] line) {
33
33
}
34
34
35
35
public static String runClojure (String clojureExpression ){
36
- if (clojureExpression .equals ("" )) return "" ;
36
+ if (clojureExpression .trim (). equals ("" )) return "" ;
37
37
String exp = clojureExpression .replaceAll ("'''" , "\" " );
38
38
String result ;
39
39
ClassLoader previous = Thread .currentThread ().getContextClassLoader ();
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ module com { module github { module beothorn { module clojurecalc {
21
21
[optional] interface ::com::sun::star::lang::XLocalizable;
22
22
23
23
string clj([in] string exp);
24
-
24
+ string c([in] string exp);
25
25
string cljcol([in] sequence< sequence< string > > cells);
26
26
};
27
27
}; }; }; };
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
2
<!-- Created with Apache OpenOffice API plug-in for NetBeans Version 2.0.6.000205-->
3
3
<description xmlns =" http://openoffice.org/extensions/description/2006" xmlns : xlink =" http://www.w3.org/1999/xlink" >
4
- <version value =" 1.0 .0" />
4
+ <version value =" 1.1 .0" />
5
5
<identifier value =" com.github.beothorn.clojurecalc.ClojureCalc" />
6
6
</description >
You can’t perform that action at this time.
0 commit comments