~artemis/cap

09181ac8ca694b9dbc5298200d5930f29c2b42e1 — Artemis 9 months ago 81a0964
removed includesource filter
3 files changed, 6 insertions(+), 44 deletions(-)

M builder.go
M loader.go
M types.go
M builder.go => builder.go +1 -7
@@ 38,13 38,7 @@ func Build(root string, args *Args) (*Config, error) {
	index := domain.NewIndex()

	// 3. Loading the file tree into memory
	mainSection, err := ListFiles(root, index, &FileListOpts{
		IncludeSource: map[string]IncludeSource{
			"none":   IncludeNone,
			"gemini": IncludeOnlyGemini,
			"all":    IncludeAll,
		}[cfg.IncludeSource],
	})
	mainSection, err := ListFiles(root, index)
	if err != nil {
		return cfg, fmt.Errorf("couldn't load files from the Capsule\n%v", err)
	}

M loader.go => loader.go +5 -18
@@ 56,7 56,7 @@ func ListAssets(root string) ([]*domain.ContentFile, error) {
}

// ListFiles walks through the capsule, ignoring hidden files (dotfiles), loads and tags every subsection, file, page, media, etc.
func ListFiles(root string, idx *domain.Index, opts *FileListOpts) (domain.Section, error) {
func ListFiles(root string, idx *domain.Index) (domain.Section, error) {
	absoluteRoot, _ := filepath.Abs(root)
	relativeToRoot, _ := filepath.Rel(absoluteRoot, absoluteRoot)
	res := domain.Section{


@@ 180,23 180,10 @@ func ListFiles(root string, idx *domain.Index, opts *FileListOpts) (domain.Secti
				}
			}

			// If we should also copy the original files (for gemini, and ...)
			if ext == ".gmi" &&
				(opts.IncludeSource == IncludeOnlyGemini || opts.IncludeSource == IncludeAll) {
				currentSection.Files = append(currentSection.Files, &domain.ContentFile{
					Path:         path,
					RelativePath: relativeToRoot,
				})
			}

			// (... for "all source files", including markdown)
			if util.Includes(ext, ".html", ".md") &&
				opts.IncludeSource == IncludeAll {
				currentSection.Files = append(currentSection.Files, &domain.ContentFile{
					Path:         path,
					RelativePath: relativeToRoot,
				})
			}
			currentSection.Files = append(currentSection.Files, &domain.ContentFile{
				Path:         path,
				RelativePath: relativeToRoot,
			})

			return nil
		}

M types.go => types.go +0 -19
@@ 17,24 17,6 @@ const (
	TemplatesFolder = ".templates"
)

// IncludeSource is a flag to determine if we want to ignore all source files, include only gemini source files (default), or include all source files.
type IncludeSource int

const (
	// IncludeOnlyGemini will only copy over files ending with the .gmi prefix into the build folder alongside their HTML counterpart.
	IncludeOnlyGemini = iota
	// IncludeAll will copy over all source files alongside their rendered counterpart.
	IncludeAll
	// IncludeNone will copy no source file.
	IncludeNone
)

// FileListOpts
// TODO: Remove and only use the central Config struct
type FileListOpts struct {
	IncludeSource IncludeSource
}

// FsBuilder contains the state of the capsule builder objects.
type FsBuilder struct {
	InputPath     string


@@ 80,7 62,6 @@ type PostBuildConfig struct {
type Config struct {
	Capsule           CapsuleConfig
	Thumbnails        OptimizationParameters
	IncludeSource     string          `toml:"include_source" validate:"omitempty,oneof=none gemini all"`
	PostBuildCommands []string        `toml:"post_build_commands"`
	PostBuild         PostBuildConfig `toml:"post_build"`
	FoldersToIgnore   []string        `toml:"ignore"`