Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ $ foliant src backup --config alternative_config.yml

Also you may specify the root directory of your Foliant project by using the `--path` option. If not specified, current directory will be used.

## Partial build

To use the partial build features (added in foliant 1.0.14), add `partial_build.yml` file, with the following structure:

```yml
project_name:
- src/file_1.md
- src/dir/file_2.md
```

## RepoLink Preprocessor

This preprocessor allows to add into each Markdown source a hyperlink to the related file in Git repository. Applying of the preprocessor to subprojects allows to get links to separate repositories from different pages of a single site (e.g. generated with MkDocs).
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.0.17

- Added the ability to transfer a list of files via `partial_build.yml`.

# 1.0.16

- Added a preprocessor for merging the includes maps
Expand Down
16 changes: 15 additions & 1 deletion foliant/config/from.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
``https://github.com/foliant-docs/docs.git#master``.
'''

from yaml import add_constructor, load, Loader, BaseLoader
from yaml import add_constructor, load, Loader, BaseLoader, safe_load
from shutil import copytree, move, rmtree
from os import chdir, getcwd
from pathlib import Path
Expand Down Expand Up @@ -255,6 +255,19 @@ def _build_subproject(self, subproject_cached_dir_path: Path) -> str:
break

source_cwd = getcwd()
partial_build = []
_partial_build_config = Path(source_cwd + "/partial_build.yml")
if _partial_build_config.exists():
with open(_partial_build_config, 'r', encoding='utf-8') as file:
yaml_data = safe_load(file)
dir_name = subproject_cached_dir_path.name
if dir_name in yaml_data:
partial_build = yaml_data[dir_name]
else:
self.logger.debug(f'Subproject partial build list not found: {_partial_build_config}')

self.logger.debug(f'Subproject partial build list: {partial_build}')

chdir(subproject_cached_dir_path)

subproject_debug_mode = True if self.logger.getEffectiveLevel() == DEBUG else False
Expand All @@ -269,6 +282,7 @@ def _build_subproject(self, subproject_cached_dir_path: Path) -> str:
logs_dir=logs_dir_path,
quiet=self.quiet,
keep_tmp=True,
only_partial=','.join(partial_build),
debug=subproject_debug_mode
)

Expand Down