Skip to content

Commit 7a1a31a

Browse files
authored
Merge pull request #529 from lambdalisue/imp-doc
Add docs for `fern#fri#to#*`, `fern#fri#from#*` functions
2 parents c02752d + bef23b8 commit 7a1a31a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

doc/fern-develop.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,38 @@ fern#fri#encode({str}[, {pattern}])
110110
fern#fri#decode({str})
111111
Decode percent-encoding from the {str}.
112112

113+
*fern#fri#to#path()*
114+
fern#fri#to#path({fri})
115+
Convert a FRI instance to a path.
116+
It returns a decoded "path" attribute with a leading "/".
117+
118+
*fern#fri#to#filepath()*
119+
fern#fri#to#filepath({fri})
120+
Convert a FRI instance of "file://" protocol to a file path.
121+
It returns a slash separated path on Linux/Unix and a backslash
122+
separated path on Windows.
123+
>
124+
" How to get a file path from a fern buffer name.
125+
let l:bufname = 'fern://file:///Users/alisue/wk/hello%252520world$'
126+
let l:fri1 = fern#fri#parse(l:bufname)
127+
let l:fri2 = fern#fri#parse(l:fri1.path)
128+
echo fern#fri#to#filepath(l:fri2)
129+
<
130+
*fern#fri#from#path()*
131+
fern#fri#from#path({path})
132+
Convert an absolute path to a FRI instance of "file://" protocol.
133+
It returns a FRI instance with "scheme" set to "file" and
134+
"path" set to the {path}.
135+
136+
It assumes that the {path} is slash separated absolute path. Use
137+
|fern#fri#from#filepath()| instead when the {path} is a file path.
138+
139+
*fern#fri#from#filepath()*
140+
fern#fri#from#filepath({path})
141+
Convert an absolute file path to a FRI instance of "file://" protocol.
142+
It returns a FRI instance with "scheme" set to "file" and
143+
"path" set to the slash separated {path}. The {path} is converted to
144+
a slash separated path.
113145

114146
=============================================================================
115147
NODE *fern-develop-node*

0 commit comments

Comments
 (0)