Commit f821d5e7 authored by Dan Allen's avatar Dan Allen

follow-up to #48 finish aligning variable names w/ architecture

- rename fragmentsdir to partialsdir
- rename fragment family to partial
- rename samplesdir to examplesdir
- rename sample family to example
- rename vfileCatalog to catalog
- rename vfiles to files
parent 49c3d6f5
Pipeline #14765625 passed with stages
in 3 minutes and 28 seconds
:attachmentsdir: {moduledir}/assets/attachments
:fragmentsdir: {moduledir}/documents/_fragments
:exampesdir: {moduledir}/examples
:imagesdir: {moduledir}/assets/images
:samplesdir: {moduledir}/samples
:partialsdir: {moduledir}/documents/_partials
......@@ -32,4 +32,4 @@ You'll then find out how to set it up and run it.
== Pipeline steps
include::{fragmentsdir}/pipeline-steps-list.adoc[]
include::{partialsdir}/pipeline-steps-list.adoc[]
:attachmentsdir: {moduledir}/assets/attachments
:fragmentsdir: {moduledir}/documents/_fragments
:examplesdir: {moduledir}/examples
:imagesdir: {moduledir}/assets/images
:samplesdir: {moduledir}/samples
:partialsdir: {moduledir}/documents/_partials
:attachmentsdir: {moduledir}/assets/attachments
:fragmentsdir: {moduledir}/documents/_fragments
:examplesdir: {moduledir}/examples
:imagesdir: {moduledir}/assets/images
:samplesdir: {moduledir}/samples
:partialsdir: {moduledir}/documents/_partials
......@@ -27,11 +27,11 @@ It will not be accurate until Antora is officially released.
== Playbook Repository
include::{fragmentsdir}/playbook-project-summary.adoc[]
include::{partialsdir}/playbook-project-summary.adoc[]
== site.yml
include::{fragmentsdir}/playbook-summary.adoc[]
include::{partialsdir}/playbook-summary.adoc[]
////
There's one playbook preconfigured in this project.
......
......@@ -12,7 +12,7 @@ endif::[]
*This page is for people joining a documentation project that already uses Antora.*
include::{fragmentsdir}/playbook-project-summary.adoc[]
include::{partialsdir}/playbook-project-summary.adoc[]
Before you can run Antora on your own machine, you'll need to fetch the playbook project for your site and initialize it
//The Antora pipeline is controlled by a playbook which is hosted in a playbook project.
......
......@@ -163,7 +163,7 @@ function readComponentDesc (files) {
async function loadGitFiles (repository, branch, repo) {
const tree = await getGitTree(repository, branch, repo.startPath)
const entries = await getGitEntries(tree)
const vfiles = entries.map(async (entry) => {
const files = entries.map(async (entry) => {
const blob = await entry.getBlob()
const contents = blob.content()
const stat = new fs.Stats({})
......@@ -171,7 +171,7 @@ async function loadGitFiles (repository, branch, repo) {
stat.size = contents.length
return new File({ path: entry.path(), contents, stat })
})
return Promise.all(vfiles)
return Promise.all(files)
}
async function getGitTree (repository, branch, startPath) {
......@@ -196,12 +196,11 @@ function getGitEntries (tree, onEntry) {
async function loadLocalFiles (repo) {
const basePath = path.join(repo.url, repo.startPath || '.')
const vfileStream = vfs.src('**/*.*', {
return streamToArray(vfs.src('**/*.*', {
base: basePath,
cwd: basePath,
dot: false,
})
return streamToArray(vfileStream)
}))
}
function assignFileProperties (file, url, branch, startPath = '/') {
......
......@@ -130,7 +130,7 @@ Each virtual file object should include the following properties:
* `component`
* `version`
* `module`
* `family` (attachment, example, fragment, image, navigation, or page)
* `family` (attachment, example, partial, image, navigation, or page)
* `topics`
* `moduleRootPath`
* `basename`
......
......@@ -80,7 +80,7 @@ function partitionSrc (file, pathSegments, nav) {
if (pathSegments[2] === 'documents') {
if (pathSegments[3] === '_partials') {
// QUESTION should this be partial-page instead?
file.src.family = 'fragment'
file.src.family = 'partial'
// start from 4 (after /modules/foo/documents/_partials) end at -1 (before filename.ext)
file.src.subpath = pathSegments.slice(4, -1).join('/')
} else if (file.src.mediaType === 'text/asciidoc' && file.src.basename !== '_attributes.adoc') {
......
......@@ -71,7 +71,7 @@ describe('classifyContent()', () => {
component: 'the-component',
version: 'v1.2.3',
module: 'ROOT',
family: 'fragment',
family: 'partial',
subpath: '',
moduleRootPath: '../..',
})
......
......@@ -105,7 +105,7 @@ If the target page cannot be resolved, a warning should be emitted.
=== Include processor
The target of all include directives should be resolved from the content catalog.
An include target must point to a file local to the current module, either in the `fragment` family or the `example` family.
An include target must point to a file local to the current module, either in the `partial` family or the `example` family.
For example:
include::{partialsdir}/partial.adoc[]
......
......@@ -4,10 +4,10 @@ const path = require('path')
const convertAsciiDocString = require('./asciidoctor')
const samplesdir = '$samples$'
const fragmentsdir = '$fragments$'
const examplesdir = '$examples$'
const partialsdir = '$partials$'
module.exports = async function convertDocument (file, playbookAsciidoctor, vfileCatalog) {
module.exports = async function convertDocument (file, customAttributes, catalog) {
const options = {
safe: 'safe',
attributes: Object.assign(
......@@ -19,7 +19,7 @@ module.exports = async function convertDocument (file, playbookAsciidoctor, vfil
idseparator: '-',
icons: 'font',
},
playbookAsciidoctor,
customAttributes,
{
// fixed attributes
docname: file.src.stem,
......@@ -28,8 +28,8 @@ module.exports = async function convertDocument (file, playbookAsciidoctor, vfil
'env-site': '',
imagesdir: file.out.moduleRootPath + '/_images',
attachmentsdir: file.out.moduleRootPath + '/_attachments',
samplesdir,
fragmentsdir,
examplesdir,
partialsdir,
}
),
}
......@@ -37,8 +37,8 @@ module.exports = async function convertDocument (file, playbookAsciidoctor, vfil
const { attributes, htmlContents } = convertAsciiDocString(
file.contents.toString(),
options,
(doc, target) => readInclude(file, vfileCatalog, target),
(refId, text) => transformXref(file, refId, text, vfileCatalog)
(doc, target) => readInclude(file, catalog, target),
(refId, text) => transformXref(file, refId, text, catalog)
)
file.contents = htmlContents
......@@ -47,7 +47,7 @@ module.exports = async function convertDocument (file, playbookAsciidoctor, vfil
return Promise.resolve()
}
function readInclude (file, vfileCatalog, target) {
function readInclude (file, catalog, target) {
const [targetFamily, ...targetPath] = target.split('/').filter((a) => a !== '')
const findOptions = {
......@@ -60,17 +60,17 @@ function readInclude (file, vfileCatalog, target) {
const include = { file: target, path: file.src.basename }
if (targetFamily === samplesdir) {
findOptions.family = 'sample'
} else if (targetFamily === fragmentsdir) {
findOptions.family = 'fragment'
if (targetFamily === examplesdir) {
findOptions.family = 'example'
} else if (targetFamily === partialsdir) {
findOptions.family = 'partial'
} else {
// TODO log "Bad include"
include.contents = `+include::${target}[]+`
return include
}
const includeFile = vfileCatalog.getById(findOptions)
const includeFile = catalog.getById(findOptions)
if (includeFile == null) {
// TODO log "Unknown include"
include.contents = `+include::${target}[]+`
......@@ -81,7 +81,7 @@ function readInclude (file, vfileCatalog, target) {
return include
}
function transformXref (file, xref, title, vfileCatalog) {
function transformXref (file, xref, title, catalog) {
const xrefSrc = getSourceFromXref(xref)
if (xrefSrc == null) {
......@@ -89,7 +89,7 @@ function transformXref (file, xref, title, vfileCatalog) {
return `<a href="#">${xref}</a>`
}
const xrefFile = vfileCatalog.getById({
const xrefFile = catalog.getById({
component: xrefSrc.component || file.src.component,
version: xrefSrc.version || file.src.version,
module: xrefSrc.module || file.src.module,
......
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