Skip to content

Commit

Permalink
Merge branch 'fix-timestamp' into pr-fix-timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
akosbalasko authored Apr 11, 2024
2 parents 09f2dc5 + 6cde9ae commit e65b2fa
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 40 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# [6.12.0](https://github.com/akosbalasko/yarle/compare/v6.11.1...v6.12.0) (2024-04-11)


### Features

* Add option to force POSIX path for link to original HTML file ([28a225b](https://github.com/akosbalasko/yarle/commit/28a225b597016b2305889f08c06dc89f0da8a6e3)), closes [#610](https://github.com/akosbalasko/yarle/issues/610)

## [6.11.1](https://github.com/akosbalasko/yarle/compare/v6.11.0...v6.11.1) (2024-04-11)


### Bug Fixes

* loading webclips settings in config ([#625](https://github.com/akosbalasko/yarle/issues/625)) ([71785c7](https://github.com/akosbalasko/yarle/commit/71785c76f7bf71e758f83678b575d6ab6dc316f9))

# [6.11.0](https://github.com/akosbalasko/yarle/compare/v6.10.1...v6.11.0) (2024-03-13)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ To configure Yarle, you must create a config file. By default it looks like this
"isZettelkastenNeeded": false,
"useZettelIdAsFilename": false,
"plainTextNotesOnly": false,
"skipWebClips": false,
"skipWebClips": true,
"useHashTags": true,
"outputFormat": "StandardMD",
"taskOutputFormat": "StandardMD",
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"encryptionPasswords": [],
"skipUpdateTime": false,
"skipSourceUrl": false,
"skipWebClips": false,
"skipWebClips": true,
"skipTags": false,
"useHashTags": true,
"outputFormat": "ObsidianMD",
Expand Down
2 changes: 1 addition & 1 deletion config.tana.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"encryptionPasswords": [],
"skipUpdateTime": false,
"skipSourceUrl": false,
"skipWebClips": false,
"skipWebClips": true,
"skipTags": false,
"useHashTags": false,
"outputFormat": "Tana Internal Format",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yarle-evernote-to-md",
"version": "6.11.0",
"version": "6.12.0",
"description": "Yet Another Rope Ladder from Evernote",
"keywords": [
"evernote",
Expand Down
1 change: 1 addition & 0 deletions src/YarleOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface YarleOptions {
currentTemplate?: string;
outputDir?: string;
keepOriginalHtml?: boolean;
posixHtmlPath?: boolean;
isMetadataNeeded?: boolean;
isNotebookNameNeeded?: boolean;
isZettelkastenNeeded?: boolean;
Expand Down
26 changes: 20 additions & 6 deletions src/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,31 @@ <h5 class="info-text">General </h5>
<option value="true">Yes</option>
<option value="false" selected>No</option>
</select>
</div>
</div>

<div class="form-group">
<label for="posixHtmlPath" class="pure-checkbox">
POSIX HTML Path
<br>
<div style='font-size: 12px;'>
<i>(Use forward slashes in path to original HTML, even on Windows)</i>
</div>
</label>
<select class="form-control configurationItem" name="posixHtmlPath" id="posixHtmlPath">
<option value="true">Yes</option>
<option value="false" selected>No</option>
</select>
</div>

<div class="form-group">
<!--<input type="checkbox" value="false" id='addWebClips'> -->
<label for="addWebClips" class="pure-checkbox">
<!--<input type="checkbox" value="false" id='skipWebClips'> -->
<label for="skipWebClips" class="pure-checkbox">
Convert webclips
<br><div style='font-size: 12px;'><i>(Convert webclips too)</i></div>
</label>
<select class="form-control configurationItem" name="addWebClips" id="addWebClips">
<option value="true">Yes</option>
<option value="false" selected>No</option>
<select class="form-control configurationItem" name="skipWebClips" id="skipWebClips">
<option value="false">Yes</option>
<option value="true" selected>No</option>
</select>
</div>

Expand Down
11 changes: 4 additions & 7 deletions src/ui/settingsMapper.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { ImageSizeFormat } from 'image-size-format';
import { CharacterMap } from './../CharacterMap';
import { YarleOptions } from './../YarleOptions';
const store = require ('./store');
import { OutputFormat } from './../output-format';
import { TaskOutputFormat } from './../task-output-format';
import { SearchAndReplace } from 'models';

const store = require ('./store');
enum DefaultRootType {
array = 'array',
object = 'object'
Expand All @@ -30,12 +31,7 @@ export const mapSettingsToYarleOptions = (): YarleOptions => {
isZettelkastenNeeded: store.get('isZettelkastenNeeded') as boolean,
useZettelIdAsFilename: store.get('useZettelIdAsFilename') as boolean,
plainTextNotesOnly: store.get('plainTextNotesOnly') as boolean,
skipLocation: !(store.get('addLocation') as boolean),
skipCreationTime: !(store.get('addCreationTime') as boolean),
skipUpdateTime: !(store.get('addUpdateTime') as boolean),
skipSourceUrl: !(store.get('addSourceUrl') as boolean),
skipWebClips: !(store.get('addWebClips') as boolean),
skipTags: !(store.get('addTags') as boolean),
skipWebClips: (store.get('skipWebClips') as boolean),
useHashTags: store.get('useHashTags') as boolean,
outputFormat: store.get('outputFormat') as OutputFormat,
obsidianTaskTag: store.get('obsidianTaskTag') as string,
Expand All @@ -44,6 +40,7 @@ export const mapSettingsToYarleOptions = (): YarleOptions => {
keepMDCharactersOfENNotes: store.get('keepMDCharactersOfENNotes') as boolean,
monospaceIsCodeBlock: store.get('monospaceIsCodeBlock') as boolean,
keepOriginalHtml: store.get('keepOriginalHtml') as boolean,
posixHtmlPath: store.get('posixHtmlPath') as boolean,
currentTemplate: store.get('currentTemplate') as string,
resourcesDir: store.get('resourcesDir') as string,
trimStartingTabs: store.get('trimStartingTabs') as boolean,
Expand Down
16 changes: 6 additions & 10 deletions src/ui/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ const Store = require('electron-store');

const { OutputFormat } = require('../output-format');
const schema = {
keepOriginalHtml: {
type: 'boolean',
default: true,
},
keepOriginalHtml: {
type: 'boolean',
default: true,
},
posixHtmlPath: { type: 'boolean', default: false },
enexSources: {},
// templateFile: {type: 'string'},
outputDir: {type: 'string'},
Expand All @@ -15,12 +16,7 @@ const schema = {
isZettelkastenNeeded: { type: 'boolean', default: false },
useZettelIdAsFilename: { type: 'boolean', default: false},
plainTextNotesOnly: { type: 'boolean', default: false },
addLocation: { type: 'boolean', default: false },
addCreationTime: { type: 'boolean', default: false },
addUpdateTime: { type: 'boolean', default: false },
addSourceUrl: { type: 'boolean', default: false },
addWebClips: { type: 'boolean', default: false },
addTags: { type: 'boolean', default: false },
skipWebClips: { type: 'boolean', default: true },
useHashTags: { type: 'boolean', default: false },
outputFormat: {type: 'string', default: OutputFormat.ObsidianMD},
obsidianTaskTag: { type: 'string' },
Expand Down
17 changes: 10 additions & 7 deletions src/utils/folder-utils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import fsExtra from 'fs-extra';
import fs from 'fs';
import * as path from 'path';
import fsExtra from 'fs-extra';
import * as path from 'path';

import { Path } from '../paths';
import { yarleOptions } from '../yarle';

import { getNoteFileName, getNoteName, getUniqueId, normalizeFilenameString } from './filename-utils';
import { loggerInfo } from './loggerInfo';
import { OutputFormat } from './../output-format';
import { RuntimePropertiesSingleton } from './../runtime-properties';
import { EvernoteNoteData } from '../models';
import { loggerInfo } from './loggerInfo';

export const paths: Path = {};
const MAX_PATH = 249;
Expand Down Expand Up @@ -47,7 +47,7 @@ const getFilePath = (dstPath: string, note: EvernoteNoteData, extension: string)
const fileName = getNoteFileName(dstPath, note, extension);
const fullFilePath = `${dstPath}${path.sep}${normalizeFilenameString(fileName)}`;

return fullFilePath.length <  MAX_PATH ? fullFilePath : truncateFilePath(note, fileName, fullFilePath);
return fullFilePath.length < MAX_PATH ? fullFilePath : truncateFilePath(note, fileName, fullFilePath);
};

export const getMdFilePath = (note: EvernoteNoteData): string => {
Expand All @@ -63,8 +63,11 @@ export const getHtmlFilePath = (note: EvernoteNoteData): string => {

export const getHtmlFileLink = (note: EvernoteNoteData): string => {
const filePath = getHtmlFilePath(note);

return `.${filePath.slice(paths.resourcePath.lastIndexOf(path.sep))}`;
const relativePath = `.${filePath.slice(paths.resourcePath.lastIndexOf(path.sep))}`;
if (yarleOptions.posixHtmlPath && path.sep !== path.posix.sep) {
return relativePath.split(path.sep).join(path.posix.sep);
}
return relativePath;
};

const clearDistDir = (dstPath: string): void => {
Expand Down Expand Up @@ -154,7 +157,7 @@ export const setPaths = (enexSource: string): void => {
}

fsExtra.mkdirsSync(paths.mdPath);
if ((!yarleOptions.haveEnexLevelResources && !yarleOptions.haveGlobalResources) ||
if ((!yarleOptions.haveEnexLevelResources && !yarleOptions.haveGlobalResources) ||
yarleOptions.outputFormat === OutputFormat.LogSeqMD) {
fsExtra.mkdirsSync(paths.resourcePath);
}
Expand Down
7 changes: 4 additions & 3 deletions src/yarle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ export const defaultYarleOptions: YarleOptions = {
enexSources: ['notebook.enex'],
outputDir: './mdNotes',
keepOriginalHtml: false,
posixHtmlPath: false,
isMetadataNeeded: false,
isNotebookNameNeeded: false,
isZettelkastenNeeded: false,
useZettelIdAsFilename: false,
plainTextNotesOnly: false,
skipWebClips: false,
skipWebClips: true,
useHashTags: true,
trimStartingTabs: false,
convertPlainHtmlNewlines: false,
Expand Down Expand Up @@ -134,7 +135,7 @@ export const parseStream = async (options: YarleOptions, enexSource: string): Pr
loggerInfo(`Notes processed: ${noteNumber}\n\n`);
}
noteAttributes = null;

const runtimeProps = RuntimePropertiesSingleton.getInstance();
const currentNotePath = runtimeProps.getCurrentNotePath();
if (currentNotePath) {
Expand All @@ -151,7 +152,7 @@ export const parseStream = async (options: YarleOptions, enexSource: string): Pr
updatedContent = language.tagProcess(fileContent, sortedTasks, taskPlaceholder, updatedContent)

fs.writeFileSync(currentNotePath, updatedContent);

}
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/yarle-special-cases.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ dateFormat: undefined,
});
it('Enex file with images using data urls', async () => {
const options: YarleOptions = {
dateFormat: undefined,
dateFormat: undefined,
enexSources: [`${testDataFolder}test-image-dataUrl.enex`],
outputDir: 'out',
isMetadataNeeded: true,
Expand Down

0 comments on commit e65b2fa

Please sign in to comment.