ind

package
v0.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CategoryNews is the name of the news category[*].
	CategoryNews = "news"

	NewsBlockDateFormat  = "02.01.2006"
	EmptyCategoryContent = "There are no articles in this category at the moment."
)
View Source
const (
	ErrCategoryIsNotFound             = "category is not found: %v"
	ErrNewsCategoryIsASpecialCategory = "news category is a special category"
	ErrArticleIsDamaged               = "article is damaged: %v"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Indexer

type Indexer struct {
	CLA      *cla.CommandLineArguments
	Settings *settings.Settings
}

func NewIndexer

func NewIndexer() (indexer *Indexer, err error)

func (*Indexer) CreateCategoryFolders

func (i *Indexer) CreateCategoryFolders() (err error)

CreateCategoryFolders creates category[*] folders if necessary.

func (*Indexer) CreateIndexForCategory

func (i *Indexer) CreateIndexForCategory(category string, files models.SortedFiles) (err error)

CreateIndexForCategory creates an index file for a single category[*].

func (*Indexer) CreateIndexForNewsCategory

func (i *Indexer) CreateIndexForNewsCategory(files models.SortedFiles) (err error)

CreateIndexForNewsCategory creates an index file for the news category[*].

func (*Indexer) GetAllSortedFiles

func (i *Indexer) GetAllSortedFiles() (sortedFiles models.SortedFiles, err error)

GetAllSortedFiles gets all the files from all the categories[*] and sorts them.

func (*Indexer) GetArticleDateTime

func (i *Indexer) GetArticleDateTime(filePath string) (dateTime time.Time, err error)

GetArticleDateTime extracts the DateTime from an article's file.

func (*Indexer) GetDateTimeFromFolder

func (i *Indexer) GetDateTimeFromFolder(folderPath string) (unsortedFiles models.SortedFiles, err error)

GetDateTimeFromFolder gets the DateTime from all the files in the specified folder, including its sub-folders. A returned array's items have two fields: date-time and a file path relative to the JSON data folder.

func (*Indexer) GetLongNewsBlock

func (i *Indexer) GetLongNewsBlock(fileRelPath string) (block string, err error)

GetLongNewsBlock gets the text of a long news block from an article. Long news block consists of icon, title and description. fileRelPath is a path relative to the JSON data folder.

func (*Indexer) GetShortNewsBlock

func (i *Indexer) GetShortNewsBlock(fileRelPath string) (block string, err error)

GetShortNewsBlock gets the text of a short news block from an article. Short news block consists of date and title. fileRelPath is a path relative to the JSON data folder.

func (*Indexer) GetSortedFilesForCategory

func (i *Indexer) GetSortedFilesForCategory(category string) (sortedFiles models.SortedFiles, err error)

GetSortedFilesForCategory gets all files from a single category[*] and sorts them. The 'category' parameter is the category's path.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL