Skip to content

Commit

Permalink
Update dir path used to compute blog, training, books pages
Browse files Browse the repository at this point in the history
  • Loading branch information
javamind committed Mar 1, 2023
1 parent 568a65b commit e9b414d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions extension/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Options {
path?: string;
modeDev?: boolean;
metadata?: Metadata;
dirNames: Array<string>;
}

export interface HandlebarsTemplate {
Expand Down
17 changes: 13 additions & 4 deletions extension/read-asciidoctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,20 @@ export function extReadAsciidoc(options: Options): Transform {
const filename = file.path.substring(file.path.lastIndexOf("/") + 1, file.path.lastIndexOf("."));

let dir = '';
if (file.path.lastIndexOf("blog/") > 0) {
dir = file.path.substring(file.path.lastIndexOf("blog/") + "blog/".length, file.path.lastIndexOf("/"));
if(options.dirNames && options.dirNames.length > 0) {
options.dirNames.forEach(dirname => {
if (file.path.lastIndexOf(dirname) > 0) {
dir = file.path.substring(file.path.lastIndexOf(dirname) + dirname.length, file.path.lastIndexOf("/"));
}
})
}
if (file.path.lastIndexOf("training/") > 0) {
dir = file.path.substring(file.path.lastIndexOf("training/") + "training/".length, file.path.lastIndexOf("/"));
else {
if (file.path.lastIndexOf("blog/") > 0) {
dir = file.path.substring(file.path.lastIndexOf("blog/") + "blog/".length, file.path.lastIndexOf("/"));
}
if (file.path.lastIndexOf("training/") > 0) {
dir = file.path.substring(file.path.lastIndexOf("training/") + "training/".length, file.path.lastIndexOf("/"));
}
}

const indexData: IndexBlogData = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "devmind-website",
"version": "2.1.11",
"version": "2.1.12",
"description": "Gulp extensions to generate a website with blog pages written in asciidoc",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e9b414d

Please sign in to comment.