def test_set_out_put_extension(self): extension = file_mover.get_file_suffix_for( self.file_converter._conversion_settings.export_format) self.assertEqual('.md', extension, 'failed to select correct md extension') self.file_converter._conversion_settings = ConversionSettings() self.file_converter._conversion_settings.set_quick_setting('html') extension = file_mover.get_file_suffix_for( self.file_converter._conversion_settings.export_format) self.assertEqual('.html', extension, 'failed to select correct html extension')
def get_clean_file_name(self): target_suffix = file_mover.get_file_suffix_for( self.processing_options.export_format) dirty_name = f'{self.contents}{target_suffix}' clean_filename = helper_functions.generate_clean_filename( dirty_name, self.processing_options.filename_options) return clean_filename
def check_nsx_attachment_links(self): if not config.yanom_globals.is_silent: print(f"Analysing note page links") notes_to_check = self.generate_file_list( file_mover.get_file_suffix_for( self.conversion_settings.export_format), self.conversion_settings.export_folder_absolute) if not config.yanom_globals.is_silent: with alive_bar(len(notes_to_check), bar='blocks') as bar: for note in notes_to_check: self._nsx_attachment_checks(note, notes_to_check, bar) return for note in notes_to_check: self._nsx_attachment_checks(note, notes_to_check)
def test_post_process_content(self): self.file_converter._conversion_settings.markdown_conversion_input = 'gfm' self.file_converter._converted_content = '<head><title>-</title></head><p><a href="a_folder/test_md_file.md">md file</a></p>' self.file_converter._metadata_processor._metadata = { 'title': 'My Title' } self.file_converter._conversion_settings.export_format = 'html' self.file_converter._output_extension = file_mover.get_file_suffix_for( self.file_converter._conversion_settings.export_format) self.file_converter._file = Path('a_folder/file.html') self.file_converter.post_process_content() self.assertEqual( '<head><title>My Title</title><meta title="My Title"/></head><p><a href="a_folder/test_md_file.html">md file</a></p>', self.file_converter._post_processed_content, 'title and meta data inserted incorrectly', )
def test_get_output_file_extension_for(export_format, expected): result = file_mover.get_file_suffix_for(export_format) assert result == expected