Home
Author Manual
Builder Manual
Development
Overview
fpm::Config
fpm::Document
fpm::Error
fpm::File
fpm::Font
fpm::Package
fpm::render
fpm::Result
fpm::StaticFile

fpm::Package

fpm::Package struct keeps track of a single fpm package.

Source Code

#[derive(Debug, Clone)]
pub struct Package {
    pub name: String,
    pub versioned: bool,
    pub translation_of: Box<Option<Package>>,
    pub translations: Vec<Package>,
    pub language: Option<String>,
    pub about: Option<String>,
    pub zip: Option<String>,
    pub download_base_url: Option<String>,
    pub translation_status_summary: Option<fpm::translation::TranslationStatusSummary>,
    pub canonical_url: Option<String>,
    pub dependencies: Vec<fpm::Dependency>,
    pub auto_import: Vec<fpm::AutoImport>,
    pub fpm_path: Option<camino::Utf8PathBuf>,
    pub ignored_paths: Vec<String>,
    pub fonts: Vec<fpm::Font>,
    pub import_auto_imports_from_original: bool,
    pub groups: std::collections::BTreeMap<String, crate::user_group::UserGroup>,
    pub sitemap: Option<fpm::sitemap::Sitemap>,
    pub sitemap_temp: Option<fpm::sitemap::SitemapTemp>,
    pub favicon: Option<String>,
}

Package Properties

name
name stores name of the package. E.g. fifthtry/doc-site and abrark.

versioned
The versioned stores the boolean value storing of the fpm package is versioned or not.

dependencies
dependencies keeps track of direct dependencies of a given package. This too should be moved to fpm::Package to support recursive dependencies etc.

auto_import
auto_import keeps track of the global auto imports in the package.

fpm_path
fpm_path contains the fpm package root. This value is found in FPM.ftd or FPM.manifest.ftd file.

ignored_path
ignored_path keeps track of files that are to be ignored by fpm build, fpm sync etc.

fonts
fonts keeps track of the fonts used by the package. Note that this too is kind of bad design, we will move fonts to fpm::Package struct soon.

groups
groups contains all the user-groups defined in the package.

sitemap
sitemap stores the structure of the package. The structure includes sections, subsections and table of content (toc). This automatically converts the documents in package into the corresponding to structure.

favicon

Optional path for favicon icon to be used.

By default if any file favicon.* is present in package and favicon is not specified in FPM.ftd, that file will be used.

If more than one favicon.* file is present, we will use them in following priority: .ico > .svg > .png > .jpg

download_base_url
download_base_url is base url from where package data has to download. We have to pass it also as command line parameter --download-base-url for main package, if FPM.ftd does not exists.

Package Functions

fpm::Package::generate_canonical_url()
FPM.ftd file can contain canonical-url key in fpm.package declaration. If this key is present this function returns the canonical-url, else it returns empty string.

pub fn fpm::Package::generate_canonical_url(&self, id: &str) -> String
id is the identifier of the document for which we want the canonical-url. id is appended to canonical-url found in FPM.ftd file.