Coverage for bookbuilderpy/constants.py: 100%

54 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-07-17 23:15 +0000

1"""The basic preprocessor command strings.""" 

2 

3from typing import Final 

4 

5#: the command for loading the input data 

6#: \rel.inputpath} 

7CMD_INPUT: Final[str] = "rel.input" 

8 

9#: a relative code input to be included as a listing: 

10#: \rel.code{label}{caption}{path}{lines}{labels}{args} 

11#: label: the label of the listing 

12#: caption: the caption of the listing 

13#: path: the relative path fragment to resolve 

14#: lines: the lines of the code to keep, or empty to keep all 

15#: labels: the labels for selecting code pieces, or empty to keep all 

16#: args: any additional arguments to pass to the code renderer 

17CMD_RELATIVE_CODE: Final[str] = "rel.code" 

18 

19#: an absolute code input to be included as a listing: 

20#: \abs.code{label}{caption}{path}{lines}{labels}{args} 

21#: label: the label of the listing 

22#: caption: the caption of the listing 

23#: path: the absolute path fragment to resolve 

24#: lines: the lines of the code to keep, or empty to keep all 

25#: labels: the labels for selecting code pieces, or empty to keep all 

26#: args: any additional arguments to pass to the code renderer 

27CMD_ABSOLUTE_CODE: Final[str] = "abs.code" 

28 

29#: a git code include: 

30#: \git.code{repo}{label}{caption}{path}{lines}{labels}{args} 

31#: repo: the repository ID to use 

32#: label: the label of the listing 

33#: caption: the caption of the listing 

34#: path: the relative path fragment to resolve 

35#: lines: the lines of the code to keep, or empty to keep all 

36#: labels: the labels for selecting code pieces, or empty to keep all 

37#: args: any additional arguments to pass to the code renderer 

38CMD_GIT_CODE: Final[str] = "git.code" 

39 

40#: a relative figure reference 

41#: \rel.figure{label}{caption}{path}{args} 

42CMD_RELATIVE_FIGURE: Final[str] = "rel.figure" 

43 

44#: an absolute figure reference 

45#: \abs.figure{label}{caption}{path}{args} 

46CMD_ABSOLUTE_FIGURE: Final[str] = "abs.figure" 

47 

48#: an command for formatting definitions 

49#: \definition{type}{label}{body} 

50CMD_DEFINITION: Final[str] = "definition" 

51 

52#: reference a definition 

53#: \def.ref{label} 

54CMD_DEF_REF: Final[str] = "def.ref" 

55 

56#: the meta data id for the current date 

57META_DATE: Final[str] = "date" 

58#: the meta data id for the current date and time 

59META_DATE_TIME: Final[str] = "time" 

60#: the meta data id for the current year 

61META_YEAR: Final[str] = "year" 

62#: the id of the language in which the project is currently built 

63# This property can either be set explicitly or is computed from the current 

64# language id. If the property is not set and there is not language id, then 

65# this defaults to "en". 

66META_LANG: Final[str] = "lang" 

67#: the locale of the current build language 

68# This property can either be set explicitly or it is computed from the 

69# current language id. If the language id is a prefix for well-known locales, 

70# the locale is expanded (e.g., "zh" -> "zh_CN", "en" -> "en_US"). If not, 

71# then the language id is used as locale. If the language id is not specified, 

72# then "en_US" is used. 

73META_LOCALE: Final[str] = "locale" 

74 

75#: obtain a meta data element 

76#: \meta{id} 

77CMD_GET_META: Final[str] = "meta" 

78 

79#: obtain information about a repository 

80#: \repo{repo-id}{info-id} 

81CMD_GET_REPO: Final[str] = "repo" 

82 

83#: The key for the repository list 

84META_REPOS: Final[str] = "repos" 

85#: The key for the repository ID 

86META_REPO_ID: Final[str] = "id" 

87#: The key for the repository url 

88META_REPO_URL: Final[str] = "url" 

89#: the languages 

90META_LANGS: Final[str] = "langs" 

91#: the language id 

92META_LANG_ID: Final[str] = META_REPO_ID 

93#: the language name 

94META_LANG_NAME: Final[str] = "name" 

95#: The name of the current language. 

96META_CUR_LANG_NAME: Final[str] = f"{META_LANG}.{META_LANG_NAME}" 

97 

98#: the key for the repository name 

99META_REPO_INFO_NAME: Final[str] = "repo.name" 

100#: the key for the repository 

101META_REPO_INFO_URL: Final[str] = "repo.url" 

102#: the key for the repository commit 

103META_REPO_INFO_COMMIT: Final[str] = "repo.commit" 

104#: the key for the repository date 

105META_REPO_INFO_DATE: Final[str] = "repo.date" 

106 

107#: A meta-data property identifying the website template markdown file. 

108# The website body markdown *can* contain a tag of the form 

109# '<div id="files">...</div>'. 

110# If it does, then this tag an all contents within will be replaced with 

111# an automatically generated list of files, relative links to files, and 

112# file sizes. 

113META_WEBSITE_BODY: Final[str] = "website_body" 

114#: The begin of the tag to be replaced. 

115WEBSITE_BODY_TAG_1: Final[str] = '<div id="files">' 

116#: The end of the tag to be replaced. 

117WEBSITE_BODY_TAG_2: Final[str] = "</div>" 

118#: A meta-data property identifying the HTML website wrapper file. 

119# If this file contains the string "{body}" somewhere, then we will load 

120# the markdown data identified by the "website_body" attribute, compile 

121# it, and replace the tag "{body}" with it. 

122META_WEBSITE_OUTER: Final[str] = "website_outer" 

123#: The outer tag of the website to be replaced with the body. 

124WEBSITE_OUTER_TAG: Final[str] = "{body}" 

125#: A meta-data property identifying the title of a book. 

126META_TITLE: Final[str] = "title" 

127#: A meta-data property identifying the author of a book. 

128META_AUTHOR: Final[str] = "author" 

129 

130#: the Python programming language 

131LANG_PYTHON: Final[str] = "python" 

132 

133#: the undefined programming language 

134LANG_UNDEFINED: str | None = None 

135 

136#: the pandoc markdown format 

137PANDOC_FORMAT_MARKDOWN: Final[str] = "markdown" 

138#: the pandoc latex format 

139PANDOC_FORMAT_LATEX: Final[str] = "latex" 

140#: the pandoc html5 format 

141PANDOC_FORMAT_HTML5: Final[str] = "html5" 

142#: the pandoc epub format 

143PANDOC_FORMAT_EPUB: Final[str] = "epub3" 

144#: the pandoc latex template 

145PANDOC_TEMPLATE_LATEX: Final[str] = "template.latex" 

146#: the pandoc html template 

147PANDOC_TEMPLATE_HTML5: Final[str] = "template.html" 

148#: the pandoc epub template 

149PANDOC_TEMPLATE_EPUB: Final[str] = "template.epub" 

150#: the csl template 

151PANDOC_CSL: Final[str] = "csl" 

152#: the pandoc bibliography key 

153PANDOC_BIBLIOGRAPHY: Final[str] = "bibliography" 

154 

155#: The argument to the language list in the download files. 

156WEBSITE_LANGS_UL_ARG: Final[str] = ' class="langs"' 

157#: The argument to the language list item in the download files. 

158WEBSITE_LANGS_LI_ARG: Final[str] = ' class="oneLang"' 

159#: The argument to the language name item in the download files. 

160WEBSITE_LANGS_NAME_SPAN_ARG: Final[str] = ' class="oneLangName"' 

161#: The argument to the single language file download list. 

162WEBSITE_DOWNLOAD_UL_ARG: Final[str] = ' class="downloads"' 

163#: The argument to the single file download entry. 

164WEBSITE_DOWNLOAD_LI_ARG: Final[str] = ' class="download"' 

165#: The argument to the single file span entry. 

166WEBSITE_DOWNLOAD_DOWNLOAD_SPAN_ARG: Final[str] = ' class="downloadFile"' 

167#: The argument to the single file name span entry. 

168WEBSITE_DOWNLOAD_FILE_A_ARG: Final[str] = ' class="downloadFileName"' 

169#: The argument to the single file size span entry. 

170WEBSITE_DOWNLOAD_SIZE_SPAN_ARG: Final[str] = ' class="downloadFileSize"' 

171#: The argument to the single file description entry. 

172WEBSITE_DOWNLOAD_FILE_DESC_SPAN_ARG: Final[str] = ' class="downloadFileDesc"'