New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting issues #170

Closed
Maboroshy opened this Issue May 16, 2016 · 10 comments

Comments

Projects
None yet
2 participants
@Maboroshy
Contributor

Maboroshy commented May 16, 2016

I've been writing about using absolute link script and tried the absolute-media-links.qml example in 16.05.13. Made sure it's enabled and validated but got no change on image insert behaviour.

Getting file://media/########.jpg relative links on image drag'n'drop and with insert image dialog. Scripting log is empty. Where should I start debugging?

@pbek pbek added the question label May 16, 2016

@pbek

This comment has been minimized.

Owner

pbek commented May 16, 2016

so you did insert a new media file to a note after the script was added?
you could start with outputting stuff with script.log()

@pbek

This comment has been minimized.

Owner

pbek commented May 17, 2016

to ease your pain of debugging...

in 16.05.14:

  • there are several new features in the log dialog
    • you can now select different log types you want to log:
      debug, info, warning, critical, fatal, status and scripting
      (for Issue #170)
    • the adding of log entries to the text area was improved to handle many
      log entries
    • the log text area will now only scroll automatically to the bottom if
      it was scrolled to the bottom before the log entry was added
    • you can search for text in the text area with Ctrl + F
    • there is a new button to clear the log

you should then be able to see all error messages, also critical errors in your script you were only able to see on the CLI

@Maboroshy

This comment has been minimized.

Contributor

Maboroshy commented May 17, 2016

Thanks for that update. I hope to try debugging on weekend. I've decided to complete at least one thing and that would be an article draft. I want to get it ready before the weekend.
Your development speed is so fast i can't keep up the pace. :)

@Maboroshy

This comment has been minimized.

Contributor

Maboroshy commented May 18, 2016

While writing about tags I tried "use-tag-names-in-filename" script example. It works but it's a little broken:

  1. While script is on changes to notes which name != header can't be saved. Log says:
    [scripting] note file name: {header}.md

  2. Script is triggered by saving only after note text change. Looks like tagging is not considered as a note change.

  3. I started tagging notes with "1" "2" "3" and putting same 1 2 3 into the note to make it save:
    a. On tag 1 script made a copy of a file "name [1]" with 1 inside but it left original "name" without 1.
    On reloading a list there now was 2 notes - "name" tagged 1 and "name [1]" without tag (sic!).
    b. I tagged both with 2 and put 2 into text. Now there's a three of them - "name" tagged 1 2, "name [1]" tagged 2, "name [1] [2]" untagged.

There must be some issue with var logic which is not hard to make right. But it looks like deleting old untagged note file isn't in the script so notes keep doubling.

By the way the distraction free mode is superb. I'm writing whole thing with it and it's very comfortable.

@pbek

This comment has been minimized.

Owner

pbek commented May 18, 2016

  1. can you please explain to me what is the expected behavior and what did happen
  2. that's right
  3. I'm not quite sure what you did and what you were expecting...
    DFM) thank you :)
@pbek

This comment has been minimized.

Owner

pbek commented May 19, 2016

Please take a look at version 16.05.16, I might have fixed some issues for you...

from the changelog:

  • assigned tags are now preserved when manually renaming a note
  • many improvements with note file renaming and preserving tags in
    conjunction with scripting and automatic filename generation has been made
    • the scripting hook handleNoteTextFileNameHook(note) now needs to return
      a filename without file-extension
@Maboroshy

This comment has been minimized.

Contributor

Maboroshy commented May 19, 2016

Can't install from AUR. Checksum doesn't match.

@pbek

This comment has been minimized.

Owner

pbek commented May 19, 2016

Thank you for reporting. For some reasons the checksum wasn't set. Please try again.

@Maboroshy

This comment has been minimized.

Contributor

Maboroshy commented May 21, 2016

Tried example tag script with the newest version.

  1. Solved.
  2. Still there, but looks like it's by design.
  3. No file doubling, just file renaming which is great. But .md goes to note name resulting .md.md note files.
 // at a proper file extension
        fileName += ".md";

is not necessary anymore. Disabled it and all ok.

But the script still impose headline = note name while it's off in app due to

// set the first line of the note as base for the file name
        if (noteLines.length > 0) {
            // you maybe also want to exclude some disallowed characters here
            fileName = noteLines[0];
        }

I'll try playing with it.

@pbek

This comment has been minimized.

Owner

pbek commented May 21, 2016

  1. great
  2. tagging will not trigger a file name change because it doesn't alter the note file
  3. as stated in my comment above, the change log and in the code of the script it now needs to return a filename without file-extension, the reason is because tag references are stored without suffixes. the default file-extension for notes will be assumed

@pbek pbek closed this May 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment