Skip to content

Commit cda29b8

Browse files
authored
Merge pull request #14 from pdeffebach/configure_docs
rename tablemwe to mwetable
2 parents d4fd156 + 97115a8 commit cda29b8

File tree

5 files changed

+59
-59
lines changed

5 files changed

+59
-59
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ This will remove whitespace and standardize headers for tabular data:
4040
cliptable(;normalizenames=true)
4141
```
4242

43-
## `tablemwe` and `arraymwe` for Minimum Working Examples
43+
## `mwetable` and `mwearray` for Minimum Working Examples
4444

4545
ClipData also generates code to make it easy to copy and paste data to a script. This is ideal for slowly transitioning a complicated Excel workbook to a more reproducible Julia script.
4646

47-
- `tablemwe()` will create copy-and-pasteable code to construct a Julia table from the clipboard.
48-
- `tablemwe(data)` will do the same from an existing Julia object.
47+
- `mwetable()` will create copy-and-pasteable code to construct a Julia table from the clipboard.
48+
- `mwetable(data)` will do the same from an existing Julia object.
4949

50-
You can also create Minimum Working Examples with arrays through the function `arraymwe`.
50+
You can also create Minimum Working Examples with arrays through the function `mwearray`.
5151

5252

docs/src/api/api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ cliparray
99
```
1010

1111
```@docs
12-
tablemwe
12+
mwetable
1313
```
1414

1515
```@docs
16-
arraymwe
16+
mwearray
1717
```
1818

1919
```@docs
20-
@tablemwe
20+
@mwetable
2121
```
2222

2323
```@docs
24-
@arraymwe
24+
@mwearray
2525
```
2626

docs/src/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ This will remove whitespace and standardize headers for tabular data:
4646
cliptable(;normalizenames=true)
4747
```
4848

49-
## `tablemwe` and `arraymwe` for creating Minimum Working Examples (MWEs)
49+
## `mwetable` and `mwearray` for creating Minimum Working Examples (MWEs)
5050

51-
ClipData also makes it easy to take data from a the clipboard or a Julia session and enter it directly int a script with the functions `tablemwe` and `arraymwe`, as well as the corresponding macros `@tablemwe` and `@arraymwe`.
51+
ClipData also makes it easy to take data from a the clipboard or a Julia session and enter it directly int a script with the functions `mwetable` and `mwearray`, as well as the corresponding macros `@mwetable` and `@mwearray`.
5252

5353
### Example
5454

55-
Say you have an existing data frame with the population of cities on the West Coast of the USA, and you want to share this data with someone without sending an Excel file. `tablemwe` allows you to create reproducible code on the fly.
55+
Say you have an existing data frame with the population of cities on the West Coast of the USA, and you want to share this data with someone without sending an Excel file. `mwetable` allows you to create reproducible code on the fly.
5656

5757
```julia
5858
julia> west_coast_cities
@@ -66,7 +66,7 @@ julia> west_coast_cities
6666
4 │ Los Angeles 3967000
6767
5 │ San Diego 1410000
6868

69-
julia> @tablemwe west_coast_cities
69+
julia> @mwetable west_coast_cities
7070
west_coast_cities = """
7171
City,Population
7272
Portland,645291
@@ -79,4 +79,4 @@ San Diego,1410000
7979

8080
!!! note
8181

82-
`tablemwe` always returns a `CSV.File` object, but this can be easily converted into whatever table type you are working with.
82+
`mwetable` always returns a `CSV.File` object, but this can be easily converted into whatever table type you are working with.

src/ClipData.jl

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using CSV, Tables
44

55
using InteractiveUtils: clipboard
66

7-
export cliptable, cliparray, tablemwe, arraymwe, @tablemwe, @arraymwe
7+
export cliptable, cliparray, mwetable, mwearray, @mwetable, @mwearray
88

99
"""
1010
cliptable(; kwargs...)
@@ -162,7 +162,7 @@ function cliparray(t::AbstractVecOrMat; returnstring = false, delim='\t',
162162
end
163163

164164
"""
165-
tablemwe(; name="df")
165+
mwetable(; name="df")
166166
167167
Create a Minimum Working Example (MWE) using
168168
the clipboard. `tablmwe` prints out a multi-line
@@ -180,7 +180,7 @@ julia> \"\"\"
180180
100 200
181181
\"\"\" |> clipboard
182182
183-
julia> tablemwe()
183+
julia> mwetable()
184184
df = \"\"\"
185185
a,b
186186
1,2
@@ -189,13 +189,13 @@ a,b
189189
```
190190
191191
"""
192-
function tablemwe(; returnstring=false, name="df")
192+
function mwetable(; returnstring=false, name="df")
193193
t = cliptable()
194-
tablemwe(t, returnstring=returnstring, name=name)
194+
mwetable(t, returnstring=returnstring, name=name)
195195
end
196196

197197
"""
198-
tablemwe(t; name="df")
198+
mwetable(t; name="df")
199199
200200
Create a Minimum Working Example (MWE) from
201201
an existing Tables.jl-compatible object.
@@ -211,7 +211,7 @@ The object is assigned the name given by
211211
julia> t = (a = [1, 2, 3], b = [100, 200, 300])
212212
(a = [1, 2, 3], b = [100, 200, 300])
213213
214-
julia> tablemwe(t)
214+
julia> mwetable(t)
215215
df = \"\"\"
216216
a,b
217217
1,100
@@ -220,7 +220,7 @@ a,b
220220
\"\"\" |> IOBuffer |> CSV.File
221221
```
222222
"""
223-
function tablemwe(t; returnstring=false, name="df")
223+
function mwetable(t; returnstring=false, name="df")
224224
main_io = IOBuffer()
225225
table_io = IOBuffer()
226226

@@ -245,13 +245,13 @@ $name = \"\"\"
245245
end
246246
end
247247

248-
function tablemwe_helper(t::Symbol)
248+
function mwetable_helper(t::Symbol)
249249
t_name = QuoteNode(t)
250-
:(tablemwe($t, name = $t_name))
250+
:(mwetable($t, name = $t_name))
251251
end
252252

253253
"""
254-
@tablemwe(t)
254+
@mwetable(t)
255255
256256
Create a Minimum Working Example (MWE) from
257257
an existing Tables.jl-compatible object.
@@ -267,7 +267,7 @@ same as the name of the input object.
267267
julia> my_special_table = (a = [1, 2, 3], b = [100, 200, 300])
268268
(a = [1, 2, 3], b = [100, 200, 300])
269269
270-
julia> @tablemwe my_special_table
270+
julia> @mwetable my_special_table
271271
my_special_table = \"\"\"
272272
a,b
273273
1,100
@@ -276,15 +276,15 @@ a,b
276276
\"\"\" |> IOBuffer |> CSV.File
277277
```
278278
"""
279-
macro tablemwe(t)
280-
esc(tablemwe_helper(t))
279+
macro mwetable(t)
280+
esc(mwetable_helper(t))
281281
end
282282

283283
"""
284-
arraymwe(; name=:X)
284+
mwearray(; name=:X)
285285
286286
Create a Minimum Working Example (MWE) from
287-
the clipboard to create an array. `arraymwe`
287+
the clipboard to create an array. `mwearray`
288288
returns the a multi-line string with the
289289
code necessary to read the string stored in
290290
clipboard as a `Vector` or `Matrix`.
@@ -297,24 +297,24 @@ julia> \"\"\"
297297
3 4
298298
\"\"\" |> clipboard
299299
300-
julia> arraymwe()
300+
julia> mwearray()
301301
X = \"\"\"
302302
1,2
303303
3,4
304304
\"\"\" |> IOBuffer |> CSV.File |> Tables.matrix
305305
```
306306
"""
307-
function arraymwe(; returnstring=false, name=nothing)
307+
function mwearray(; returnstring=false, name=nothing)
308308
t = cliparray()
309309
name= t isa AbstractVector ? :x : :X
310-
arraymwe(t, returnstring=returnstring, name=name)
310+
mwearray(t, returnstring=returnstring, name=name)
311311
end
312312

313313
"""
314-
arraymwe(t::AbstractMatrix; name=:X)
314+
mwearray(t::AbstractMatrix; name=:X)
315315
316316
Create a Minimum Working Example (MWE) from
317-
a `Matrix`. `arraymwe`
317+
a `Matrix`. `mwearray`
318318
returns the a multi-line string with the
319319
code necessary to recreate `t`.
320320
@@ -326,14 +326,14 @@ julia> X = [1 2; 3 4]
326326
1 2
327327
3 4
328328
329-
julia> arraymwe(X)
329+
julia> mwearray(X)
330330
X = \"\"\"
331331
1,2
332332
3,4
333333
\"\"\" |> IOBuffer |> CSV.File |> Tables.matrix
334334
```
335335
"""
336-
function arraymwe(t::AbstractMatrix; returnstring=false, name=:X)
336+
function mwearray(t::AbstractMatrix; returnstring=false, name=:X)
337337
main_io = IOBuffer()
338338
array_io = IOBuffer()
339339

@@ -359,17 +359,17 @@ $name = \"\"\"
359359
end
360360

361361
"""
362-
arraymwe(t::AbstractVector; name=:x)
362+
mwearray(t::AbstractVector; name=:x)
363363
364364
Create a Minimum Working Example (MWE) from
365-
a `Vector`. `arraymwe`
365+
a `Vector`. `mwearray`
366366
returns the a multi-line string with the
367367
code necessary to recreate `t`.
368368
369369
# Example
370370
371371
```julia-repl
372-
julia> arraymwe(x; name=:x)
372+
julia> mwearray(x; name=:x)
373373
x = \"\"\"
374374
1
375375
2
@@ -378,7 +378,7 @@ x = \"\"\"
378378
\"\"\" |> IOBuffer |> CSV.File |> Tables.matrix |> vec
379379
```
380380
"""
381-
function arraymwe(t::AbstractVector; returnstring=false, name=:x)
381+
function mwearray(t::AbstractVector; returnstring=false, name=:x)
382382
main_io = IOBuffer()
383383
array_io = IOBuffer()
384384

@@ -405,13 +405,13 @@ $name = \"\"\"
405405
end
406406
end
407407

408-
function arraymwe_helper(t::Symbol)
408+
function mwearray_helper(t::Symbol)
409409
t_name = QuoteNode(t)
410-
:(arraymwe($t, name=$t_name))
410+
:(mwearray($t, name=$t_name))
411411
end
412412

413413
"""
414-
@arraymwe(t)
414+
@mwearray(t)
415415
416416
Create a Minimum Working Example (MWE)
417417
from a `Vector` or `Matrix` with the same
@@ -425,15 +425,15 @@ julia> my_special_matrix = [1 2; 3 4]
425425
1 2
426426
3 4
427427
428-
julia> @arraymwe my_special_matrix
428+
julia> @mwearray my_special_matrix
429429
my_special_matrix = \"\"\"
430430
1,2
431431
3,4
432432
\"\"\" |> IOBuffer |> CSV.File |> Tables.matrix
433433
```
434434
"""
435-
macro arraymwe(t)
436-
esc(arraymwe_helper(t))
435+
macro mwearray(t)
436+
esc(mwearray_helper(t))
437437
end
438438

439439
end

test/runtests.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ end
6464
@test cliparray() == [1, 2, 3, 4]
6565
end
6666

67-
@testset "tablemwe" begin
67+
@testset "mwetable" begin
6868
"""
6969
a b
7070
1 2
7171
3 4
7272
""" |> clipboard
7373

74-
s = tablemwe(; returnstring=true)
74+
s = mwetable(; returnstring=true)
7575
s_correct =
7676
"""
7777
df = \"\"\"
@@ -84,18 +84,18 @@ a,b
8484

8585

8686
t = (a = [1, 3], b = [2, 4])
87-
s = tablemwe(t; returnstring = true)
87+
s = mwetable(t; returnstring = true)
8888

8989
@test s == s_correct
9090
end
9191

92-
@testset "arraymwe" begin
92+
@testset "mwearray" begin
9393
"""
9494
1 2
9595
3 4
9696
""" |> clipboard
9797

98-
s = arraymwe(; returnstring=true)
98+
s = mwearray(; returnstring=true)
9999
s_correct =
100100
"""
101101
X = \"\"\"
@@ -107,7 +107,7 @@ X = \"\"\"
107107

108108

109109
t = [1 2; 3 4]
110-
s = arraymwe(t; returnstring = true)
110+
s = mwearray(t; returnstring = true)
111111

112112
@test s == s_correct
113113

@@ -118,7 +118,7 @@ X = \"\"\"
118118
4
119119
""" |> clipboard
120120

121-
s = arraymwe(; returnstring=true)
121+
s = mwearray(; returnstring=true)
122122

123123
s_correct =
124124
"""
@@ -133,30 +133,30 @@ x = \"\"\"
133133

134134
x = [1, 2, 3, 4]
135135

136-
s = arraymwe(x; returnstring=true)
136+
s = mwearray(x; returnstring=true)
137137
@test s == s_correct
138138
end
139139

140-
@testset "@tablemwe" begin
140+
@testset "@mwetable" begin
141141
# Can't think of a way to test. Just check
142142
# for errors.
143143

144144
mytable = (a = [1, 2], b = [3, 4])
145145

146-
@tablemwe mytable
146+
@mwetable mytable
147147
end
148148

149-
@testset "@arraymwe" begin
149+
@testset "@mwearray" begin
150150
# Can't think of a way to test. Just check
151151
# for errors.
152152

153153
myarray = [1 2; 3 4]
154154

155-
@arraymwe myarray
155+
@mwearray myarray
156156

157157
myvector = [1, 2, 3, 4]
158158

159-
@arraymwe myvector
159+
@mwearray myvector
160160
end
161161

162162

0 commit comments

Comments
 (0)