Skip to content

Commit f046948

Browse files
committed
remove relativize helper and register stub in prefix; fix URLs for sample page in preview
1 parent a8c3c1c commit f046948

File tree

3 files changed

+11
-30
lines changed

3 files changed

+11
-30
lines changed

gulp.d/tasks/build-preview-pages.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function registerPartials (src) {
8282
}
8383

8484
function registerHelpers (src) {
85+
handlebars.registerHelper('relativize', relativize)
8586
handlebars.registerHelper('resolvePage', resolvePage)
8687
handlebars.registerHelper('resolvePageURL', resolvePageURL)
8788
return vfs.src('helpers/*.js', { base: src, cwd: src }).pipe(
@@ -116,6 +117,10 @@ function copyImages (src, dest) {
116117
.pipe(map((file, enc, next) => next()))
117118
}
118119

120+
function relativize (url) {
121+
return url ? (url.charAt() === '#' ? url : url.slice(1)) : '#'
122+
}
123+
119124
function resolvePage (spec, context = {}) {
120125
if (spec) return { pub: { url: resolvePageURL(spec) } }
121126
}

preview-src/ui-model.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ antoraVersion: '3.0.0'
22
site:
33
url: http://localhost:5252
44
title: Brand Docs
5-
homeUrl: &home_url /xyz/5.2/index.html
5+
homeUrl: &home_url /index.html
66
components:
77
- name: abc
88
title: Project ABC
@@ -72,7 +72,7 @@ page:
7272
url: '#'
7373
urlType: fragment
7474
- content: Brand’s Hardware & Software Requirements
75-
url: /xyz/5.2/index.html
75+
url: /index.html
7676
urlType: internal
7777
versions:
7878
- version: '6.0'
@@ -96,13 +96,13 @@ page:
9696
urlType: fragment
9797
items:
9898
- content: Brand’s Hardware & Software Requirements
99-
url: /xyz/5.2/index.html
99+
url: /index.html
100100
urlType: internal
101101
- content: Cu Solet
102-
url: '/xyz/5.2/index.html#cu-solet'
102+
url: '/index.html#cu-solet'
103103
urlType: internal
104104
- content: English + 中文
105-
url: '/xyz/5.2/index.html#english+中文'
105+
url: '/index.html#english+中文'
106106
urlType: internal
107107
- content: Liber Recusabo
108108
url: '#liber-recusabo'
@@ -116,5 +116,5 @@ page:
116116
url: '#'
117117
urlType: fragment
118118
- content: Some Code
119-
url: '/xyz/5.2/index.html#some-code'
119+
url: '/index.html#some-code'
120120
urlType: internal

src/helpers/relativize.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)