def processing_options() -> ProcessingOptions: embed_these_document_types = ['md', 'pdf'] embed_these_image_types = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg'] embed_these_audio_types = [ 'mp3', 'webm', 'wav', 'm4a', 'ogg', '3gp', 'flac' ] embed_these_video_types = ['mp4', 'webm', 'ogv'] embed_files = EmbeddedFileTypes(embed_these_document_types, embed_these_image_types, embed_these_audio_types, embed_these_video_types) filename_options = helper_functions.FileNameOptions( max_length=255, allow_unicode=True, allow_uppercase=True, allow_non_alphanumeric=True, allow_spaces=False, space_replacement='-') export_format = 'obsidian' unrecognised_tag_format = 'html' return ProcessingOptions( embed_files, export_format, unrecognised_tag_format, filename_options, )
class ConversionSettings: # simulating conversion settings object from YANOM export_format: str = field(default='obsidian') conversion_input: str = field(default='nimbus') split_tags: bool = field(default=True) source: Path = Path('/Users/kevindurston/nimbus/source') target: Path = Path('/Users/kevindurston/nimbus/target') attachment_folder_name: str = 'assets' front_matter_format: str = 'yaml' # options yaml, toml, json, none, text # front_matter_format: str = 'toml' # options yaml, toml, json, none, text # front_matter_format: str = 'json' # options yaml, toml, json, none, text # front_matter_format: str = 'text' # options yaml, toml, json, none, text # front_matter_format: str = 'none' # options yaml, toml, json, none, text tag_prefix = '#' keep_nimbus_row_and_column_headers = False embed_these_document_types = ['md', 'pdf'] embed_these_image_types = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg'] embed_these_audio_types = [ 'mp3', 'webm', 'wav', 'm4a', 'ogg', '3gp', 'flac' ] embed_these_video_types = ['mp4', 'webm', 'ogv'] embed_files = EmbeddedFileTypes(embed_these_document_types, embed_these_image_types, embed_these_audio_types, embed_these_video_types) unrecognised_tag_format = 'html' # options html = as html tag, none = ignore, text = string content of tag filename_options = helper_functions.FileNameOptions( max_length=255, allow_unicode=True, allow_uppercase=True, allow_non_alphanumeric=True, allow_spaces=False, space_replacement='-')
def filename_options(self): return helper_functions.FileNameOptions( self.max_file_or_directory_name_length, self.allow_unicode_in_filenames, self.allow_uppercase_in_filenames, self.allow_non_alphanumeric_in_filenames, self.allow_spaces_in_filenames, self.filename_spaces_replaced_by)
def test_clean_path_parts(): filename_options = helper_functions.FileNameOptions(max_length=64, allow_unicode=True, allow_uppercase=True, allow_non_alphanumeric=True, allow_spaces=False, space_replacement='-') result = helper_functions.clean_path_parts(filename_options, ['hello hello', '']) assert result == ['hello-hello', '']
def test_change_html_tags_invalid_old_tags(): result = helper_functions.change_html_tags('<g>', '</g>', '<div>', '</div>', '<div><p>hello world</p></div>') assert result == '<div><p>hello world</p></div>' def test_find_working_directory_when_frozen(): current_dir, message = helper_functions.find_working_directory(True) assert 'Running in a application bundle' in message @pytest.mark.parametrize( 'value, filename_options, expected', [ ("file", helper_functions.FileNameOptions(64, False, True, True, False, '-'), "file"), ("file.txt", helper_functions.FileNameOptions(64, False, True, True, False, '-'), "file.txt"), ("_file.txt-", helper_functions.FileNameOptions(64, False, True, True, False, '-'), "file.txt"), ("-file.txt_", helper_functions.FileNameOptions(64, False, True, True, False, '-'), "file.txt"), (" file.txt ", helper_functions.FileNameOptions(64, False, True, True, False, '-'), "file.txt"), ("f¥le.txt", helper_functions.FileNameOptions(64, False, True, True, False, '-'),