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

Scriptable output format #297

Closed
wolkenschieber opened this Issue Aug 19, 2016 · 21 comments

Comments

Projects
None yet
3 participants
@wolkenschieber

wolkenschieber commented Aug 19, 2016

QOwnNotes is a great tool for managing notes. For me one application scenario is, writing code review remarks in a note. After the review is done, I convert the markdown file to wiki syntax and post the result in some media wiki artikle. The conversion is done using Pandoc.

Is it possible to automate this conversion process using a script?

@pbek pbek added the question label Aug 19, 2016

@pbek

This comment has been minimized.

Owner

pbek commented Aug 19, 2016

Thank you for your kind words.
You could call an external command every time a note was stored.
There is an example here: https://github.com/pbek/QOwnNotes/blob/develop/doc/scripting/execute-command-after-note-update.qml

Does that answer your question?

@wolkenschieber

This comment has been minimized.

wolkenschieber commented Aug 19, 2016

Kind of. But actucally I want some button for this task. When the button is pressed the conversion should be done, and afterward an editor should be opened.
On save could do the conversion, but I'd still have to find the file and open it.

Thanks for your reply.

@Maboroshy

This comment has been minimized.

Contributor

Maboroshy commented Aug 19, 2016

You can write a small shell script and bind it to a keyboard shortcut with external tools.

@pbek

This comment has been minimized.

Owner

pbek commented Aug 19, 2016

Scriptable buttons / menu entries would be nice, I'll have to look more into that...

@wolkenschieber

This comment has been minimized.

wolkenschieber commented Aug 19, 2016

That would be great. Another idea is to integrate the pandoc library. Then you could export to numerous formats.

@pbek

This comment has been minimized.

Owner

pbek commented Aug 19, 2016

It would need to run on Linux, OS X and Windows, with no further dependencies. And sadly, to my knowledge, that's not the case.

@wolkenschieber

This comment has been minimized.

wolkenschieber commented Aug 19, 2016

That's a shame. Pandoc seems to be available for all three platforms. The binaries are easy to find, but the library isn't. I also found it only as a package in the ubuntu repository.

Nevertheless a scriptable button would rock.

@pbek

This comment has been minimized.

Owner

pbek commented Aug 19, 2016

Pandoc is written in Haskell. ;)

@pbek pbek added enhancement and removed question labels Aug 20, 2016

@pbek

This comment has been minimized.

Owner

pbek commented Aug 21, 2016

There will be custom actions in v16.08.16!

@pbek pbek added this to the 16.08.16 milestone Aug 21, 2016

@pbek

This comment has been minimized.

Owner

pbek commented Aug 21, 2016

16.08.16

  • you are now able to define custom actions that will be shown as menu
    entry in the scripting menu and optionally in the toolbar as button
    • there is an example for opening the current note with KWrite
      and to create a new note with a custom text at
      custom-actions.qml
    • there is a small documentation about the function
      registerCustomAction and other functions in the
      scripting documentation
    • you can also assign shortcuts for your custom actions in the
      shortcut settings
  • added new methods to the scripting engine
    • you can now also get the full file path of the current note
      with script.currentNote().fullNoteFilePath
    • you can now register a custom action with script.registerCustomAction()
    • you can now create a new note with script.createNote()
    • you can now access the clipboard with script.clipboard()
    • take a look at the scripting documentation
      for more information
  • there now is a new example to create a note from a 5pm email with a
    custom action at
    note-from-5pm-mail.qml

@wolkenschieber, you should now be able to create a qml script to launch your pandoc export! Could you please be so kind and report your experiences.

@pbek

This comment has been minimized.

Owner

pbek commented Aug 21, 2016

16.08.16 is now released...

@wolkenschieber

This comment has been minimized.

wolkenschieber commented Aug 21, 2016

Wow. Great to hear, that the feature is now available. I'll write my conversion script and report back.

@Maboroshy

This comment has been minimized.

Contributor

Maboroshy commented Aug 21, 2016

Looks like you've made another leap in app functionality. Getting current note path is the most interesting for me. Looks like I need getting it work with "on save" action somehow. Or better "on open".

I remember when this app was when I first joined this hub. Seeing it developing so fast is great. It has twice more github stars now.

I've tested kwrite example so far and it works good. How to assign icon to a toolbar button?

@pbek

This comment has been minimized.

Owner

pbek commented Aug 21, 2016

@wolkenschieber, great, thank you!

@pbek

This comment has been minimized.

Owner

pbek commented Aug 21, 2016

@Maboroshy, since you are posting so many feature requests there's no other way than the app being improved! ;)

How to assign icon to a toolbar button?

It would be no problem to add a parameter to assign a freedesktop theme icon, but of course that would only work under Linux.

@pbek pbek closed this Aug 21, 2016

@pbek

This comment has been minimized.

Owner

pbek commented Aug 22, 2016

16.08.17

@wolkenschieber

This comment has been minimized.

wolkenschieber commented Aug 22, 2016

@pbek, The implemenation of the button was really easy. The api is straightforward and the examples cover many use cases.
For the conversion button, I basically just changed some parameters from the examples:
Button doing the MediaWiki conversion

@pbek

This comment has been minimized.

Owner

pbek commented Aug 22, 2016

@wolkenschieber, great job!

@pbek pbek modified the milestones: 16.08.17, 16.08.16 Aug 22, 2016

@pbek

This comment has been minimized.

Owner

pbek commented Aug 22, 2016

There now is a new release, could you please test it and report if the new features work for you?

@wolkenschieber

This comment has been minimized.

wolkenschieber commented Aug 22, 2016

I've just received 16.08.17. The feature works nicely. I can also set a custom button!

@pbek

This comment has been minimized.

Owner

pbek commented Aug 22, 2016

Great, thank you for testing!

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