Skip to content

Commit 7b3b46b

Browse files
committed
Three single quotes are replaced by a double quote
1 parent fee613b commit 7b3b46b

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ ClojureCalc
22
====================
33
ClojureCalc is a wrapper for clojure on libre office and possibly open office.
44
It's highly experimental.
5-
To install use [ClojureCalc.oxt](https://github.com/beothorn/ClojureCalc/releases/download/0.1.0/ClojureCalc.oxt)
5+
To install use [ClojureCalc.oxt](https://github.com/beothorn/ClojureCalc/releases/download/1.0.0/ClojureCalc.oxt)
66

77
Usage
88
====================
99

1010
=clj( string with a clojure expression )
1111
=cljcol( cell range to convert to a clojure collection )
1212

13+
Note: Three single quotes are replaced by a double quote
14+
1315
![screenshot](http://i.imgur.com/ydWloye.png "Example")
1416

1517
Examples
@@ -33,6 +35,6 @@ sum of two cells
3335

3436
escaping double quotes
3537
<pre><code>
36-
=clj("(str "&CHAR(34)&"foo"&CHAR(34)&")")
38+
=clj("(str '''foo''')")
3739
</code></pre>
3840

registry/data/org/openoffice/Office/CalcAddins.xcu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<node oor:name="Parameters">
2222
<node oor:name="exp" oor:op="replace">
2323
<prop oor:name="DisplayName">
24-
<value xml:lang="en">A clojure expression to be evaluated</value>
24+
<value xml:lang="en">A clojure expression to be evaluated, ''' (three single quotes) are replaced by a double quote </value>
2525
</prop>
2626
<prop oor:name="Description">
2727
<value/>

src/com/github/beothorn/clojurecalc/ClojureCalcImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.sun.star.lib.uno.helper.WeakBase;
88
import com.sun.star.registry.XRegistryKey;
99
import com.sun.star.uno.XComponentContext;
10-
import com.sun.star.table.XCellRange;
1110

1211
public class ClojureCalcImpl extends WeakBase implements XServiceInfo, XLocalizable, XClojureCalc{
1312

src/com/github/beothorn/clojurecalc/ClojureInterpreter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ private static String getLine(final String[] line) {
3232
return result;
3333
}
3434

35-
public static String runClojure(String exp){
36-
if(exp.equals("")) return "";
35+
public static String runClojure(String clojureExpression){
36+
if(clojureExpression.equals("")) return "";
37+
String exp = clojureExpression.replaceAll("'''", "\"");
3738
String result;
3839
ClassLoader previous = Thread.currentThread().getContextClassLoader();
3940
final ClassLoader parentClassLoader = ClojureCalcImpl.class.getClassLoader();

src/description.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--Created with Apache OpenOffice API plug-in for NetBeans Version 2.0.6.000205-->
33
<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
4-
<version value="0.1.0"/>
4+
<version value="1.0.0"/>
55
<identifier value="com.github.beothorn.clojurecalc.ClojureCalc"/>
66
</description>

test/com/github/beothorn/clojurecalc/ClojureInterpreterTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public void testExp(){
1010
runAndAssert("(+ 1 2)", "3");
1111
runAndAssert("(map #(* % 2) [1 2 3])", "[2 4 6]");
1212
runAndAssert("[ [ 2 4 6 ] ]", "[[2 4 6]]");
13+
runAndAssert("(str '''foo''')", "foo");
1314
}
1415

1516
public void testCellsToMatrix(){

0 commit comments

Comments
 (0)