def validate_config_value(self): # type: () -> None # <package> lang attribute, dc:language if not self.app.config.epub_language: logger.warning(__('conf value "epub_language" (or "language") ' 'should not be empty for EPUB3')) # <package> unique-identifier attribute if not xmlname_checker().match(self.app.config.epub_uid): logger.warning(__('conf value "epub_uid" should be XML NAME for EPUB3')) # dc:title if not self.app.config.epub_title: logger.warning(__('conf value "epub_title" (or "html_title") ' 'should not be empty for EPUB3')) # dc:creator if not self.app.config.epub_author: logger.warning(__('conf value "epub_author" should not be empty for EPUB3')) # dc:contributor if not self.app.config.epub_contributor: logger.warning(__('conf value "epub_contributor" should not be empty for EPUB3')) # dc:description if not self.app.config.epub_description: logger.warning(__('conf value "epub_description" should not be empty for EPUB3')) # dc:publisher if not self.app.config.epub_publisher: logger.warning(__('conf value "epub_publisher" should not be empty for EPUB3')) # dc:rights if not self.app.config.epub_copyright: logger.warning(__('conf value "epub_copyright" (or "copyright")' 'should not be empty for EPUB3')) # dc:identifier if not self.app.config.epub_identifier: logger.warning(__('conf value "epub_identifier" should not be empty for EPUB3')) # meta ibooks:version if not self.app.config.version: logger.warning(__('conf value "version" should not be empty for EPUB3'))
def test_xmlname_check(): checker = xmlname_checker() assert checker.match('id-pub') assert checker.match('webpage') assert not checker.match('1bfda21')