...
This commit is contained in:
@@ -114,7 +114,7 @@ pub mut:
|
||||
ignore []string // list of directory names to ignore
|
||||
}
|
||||
|
||||
fn (mut a Atlas) scan(args ScanArgs) ! {
|
||||
pub fn (mut a Atlas) scan(args ScanArgs) ! {
|
||||
mut path := pathlib.get_dir(path: args.path)!
|
||||
mut ignore := args.ignore.clone()
|
||||
ignore = ignore.map(it.to_lower())
|
||||
|
||||
@@ -302,6 +302,11 @@ fn (mut c Collection) init_git_info() ! {
|
||||
mut gs := gittools.new()!
|
||||
mut p := c.path()!
|
||||
mut location := gs.gitlocation_from_path(p.path)!
|
||||
|
||||
r := os.execute_opt('cd ${p.path} && git branch --show-current')!
|
||||
|
||||
location.branch_or_tag = r.output.trim_space()
|
||||
|
||||
c.git_url = location.web_url()!
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ pub fn (mut c Collection) export(args CollectionExportArgs) ! {
|
||||
content := page.content(include: args.include)!
|
||||
|
||||
// NEW: Process cross-collection links
|
||||
processed_content := process_cross_collection_links(content, c, mut col_dir, c.atlas)!
|
||||
processed_content := page.process_cross_collection_links(mut col_dir)!
|
||||
|
||||
mut dest_file := pathlib.get_file(path: '${col_dir.path}/${page.name}.md', create: true)!
|
||||
dest_file.write(processed_content)!
|
||||
@@ -91,25 +91,6 @@ pub fn (mut c Collection) export(args CollectionExportArgs) ! {
|
||||
json_file.write(meta)!
|
||||
}
|
||||
|
||||
// Export images
|
||||
if c.images.len > 0 {
|
||||
img_dir := pathlib.get_dir(
|
||||
path: '${col_dir.path}/img'
|
||||
create: true
|
||||
)!
|
||||
|
||||
for _, mut img in c.images {
|
||||
dest_path := '${img_dir.path}/${img.file_name()}'
|
||||
img.path.copy(dest: dest_path)!
|
||||
|
||||
if args.redis {
|
||||
mut context := base.context()!
|
||||
mut redis := context.redis()!
|
||||
redis.hset('atlas:${c.name}', img.file_name(), img.path.path)!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Export files
|
||||
if c.files.len > 0 {
|
||||
files_dir := pathlib.get_dir(
|
||||
@@ -119,12 +100,13 @@ pub fn (mut c Collection) export(args CollectionExportArgs) ! {
|
||||
|
||||
for _, mut file in c.files {
|
||||
dest_path := '${files_dir.path}/${file.file_name()}'
|
||||
file.path.copy(dest: dest_path)!
|
||||
mut p2 := file.path()!
|
||||
p2.copy(dest: col_dir.path)!
|
||||
|
||||
if args.redis {
|
||||
mut context := base.context()!
|
||||
mut redis := context.redis()!
|
||||
redis.hset('atlas:${c.name}', file.file_name(), file.path.path)!
|
||||
redis.hset('atlas:${c.name}', file.file_name(), file.path()!.path)!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,12 @@ fn (mut p Page) process_cross_collection_links(mut export_dir pathlib.Path) !str
|
||||
panic('need to do for files too')
|
||||
}
|
||||
|
||||
for mut link in links.reverse() {
|
||||
if link.status != . {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
atlas_instance.scan(path: path, ignore: ignore)!
|
||||
action.done = true
|
||||
|
||||
atlas_set(atlas_instance)
|
||||
set(atlas_instance)
|
||||
}
|
||||
|
||||
// Process export actions - export collections to destination
|
||||
|
||||
Reference in New Issue
Block a user