File tree Expand file tree Collapse file tree 2 files changed +3
-15
lines changed Expand file tree Collapse file tree 2 files changed +3
-15
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,8 @@ import type {
4
4
NotMemberError ,
5
5
Page ,
6
6
} from "../deps/scrapbox.ts" ;
7
- import {
8
- cookie ,
9
- encodeTitle ,
10
- makeCustomError ,
11
- tryToErrorLike ,
12
- } from "./utils.ts" ;
7
+ import { cookie , makeCustomError , tryToErrorLike } from "./utils.ts" ;
8
+ import { encodeTitleURI } from "../title.ts" ;
13
9
import type { Result } from "./utils.ts" ;
14
10
15
11
/** Options for `getPage()` */
@@ -34,7 +30,7 @@ export async function getPage(
34
30
>
35
31
> {
36
32
const path = `https://scrapbox.io/api/pages/${ project } /${
37
- encodeTitle ( title )
33
+ encodeTitleURI ( title )
38
34
} ?followRename=${ options ?. followRename ?? true } `;
39
35
40
36
const res = await fetch (
Original file line number Diff line number Diff line change @@ -56,11 +56,3 @@ export function makeCustomError(name: string, message: string) {
56
56
error . message = message ;
57
57
return error ;
58
58
}
59
-
60
- export const toTitleLc = ( title : string ) =>
61
- title . toLowerCase ( ) . replaceAll ( " " , "_" ) ;
62
- export const encodeTitle = ( title : string ) =>
63
- title . replaceAll ( " " , "_" ) . replace (
64
- / [ / ? # \{ } ^ | < > ] / g,
65
- ( char ) => encodeURIComponent ( char ) ,
66
- ) ;
You can’t perform that action at this time.
0 commit comments