-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFormat.DocExpand.pq
31 lines (28 loc) · 1.28 KB
/
Format.DocExpand.pq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
let
/*
sugar to make it easier to embed powerquery as a string literal
It replaces '␞' with double quotes '"'
input : List.SelectBySuffix( { {␞2␞, ␞d␞}, {␞3␞, ␞h␞} }, ␞h␞)
output: List.SelectBySuffix( { {"2", "d"}, {"3", "h"} }, "h")
*/
Format.DocExpand.Type = type function ( source as text )
as text meta [
Documentation.Name = "Format.DocExpand",
Documentation.LongDescription = Text.Combine({
"A helper function to generate help strings without crazy escaping.",
"",
"Input:",
"",
"<code> = DocExpand( ""List.SelectBySuffix( { {␞2␞, ␞d␞}, {␞3␞, ␞h␞} }, ␞h␞)"" )</code>",
"",
"Output:",
"",
"<code> = 'List.SelectBySuffix( { {""2"", ""d""}, {""3"", ""h""} }, ""h"")""'</code>",
"",
"returns type <code>text</code>"
}, "#(cr,lf)<br>")
],
Format.DocExpand.Func = (source as text) as text =>
Text.Replace( source, "␞", "#(0022)" )
in
Value.ReplaceType( Format.DocExpand.Func, Format.DocExpand.Type )