Commit c91bc2d5 authored by Hubert SABLONNIERE's avatar Hubert SABLONNIERE

refactor resolveOut to make path construction more legible

parent 1cb6f79f
......@@ -113,25 +113,25 @@ function resolveOut (src, htmlExtensionStyle = 'default') {
const extname = src.extname === '.adoc' ? '.html' : src.extname
let basename = src.stem + extname
const subpathSegments = src.subpath.split('/').filter((a) => a !== '')
let indexifyPathSegment = ''
if (src.family === 'page' && src.stem !== 'index' && htmlExtensionStyle === 'indexify') {
basename = 'index.html'
subpathSegments.push(src.stem)
indexifyPathSegment = src.stem
}
let familyPathSegment = ''
if (src.family === 'image') {
subpathSegments.unshift('_images')
familyPathSegment = '_images'
}
if (src.family === 'attachment') {
subpathSegments.unshift('_attachments')
familyPathSegment = '_attachments'
}
const dirname = path.join(...['/', src.component, version, module, ...subpathSegments])
const moduleDirname = path.join(...['/', src.component, version, module])
const modulePath = path.join('/', src.component, version, module)
const dirname = path.join(modulePath, familyPathSegment, src.subpath, indexifyPathSegment)
const outputPath = path.join(dirname, basename)
const moduleRootPath = path.relative(dirname, moduleDirname) || '.'
const moduleRootPath = path.relative(dirname, modulePath) || '.'
const rootPath = path.relative(dirname, '/') || '.'
return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment