Commit graph libervia-backend/frontends/src/jp/cmd_blog.py
Author SHA1 Message Date
Goffi
efbefbb276 jp (blog, event): added checkURI to some command to be able to enter a xmpp: uri as argument 2017-06-29 20:36:35 +02:00
Goffi
364130bcbe jp (pubsub, common): fixed last item edition (keep item id instead of creating a new one) 2017-06-28 20:28:24 +02:00
Goffi
2449721982 jp (blog, common): various fixes in common and blog:
- parse_args has been moved to common
    - cat_dir is converted to str on BaseEdit init, so it can be use to make str path for files manipulation
    - fixed use of EDITOR_ARGS_MAGIC when use_metadata is False
    - fixed unlink of metadata files when use_metadata is False
2017-06-27 19:38:22 +02:00
Goffi
71d61f372f jp (blog): minor typo fix 2017-06-27 17:02:10 +02:00
Goffi
6025cc4e3b jp (blog, common): added --force-item option to avoid magic and use argument as actual item id:
- creation of new item with item id has been fixed
    - --force-item allow to use url as item id, or keyword
    - pubsub_item can is now returned by getItemPath. If not None, the id is known and must be used
2017-06-27 17:00:52 +02:00
Goffi
5eda63d99e jp (blog, common): moved and improved edit code from blog:
- a new "common" module is there for code commonly used in commands
    - moved code for editing item with $EDITOR there
    - moved code to identify item to edit there
    - aforementioned fontions have been made generic
    - a class BaseEdit is now available to implement edition
    - HTTPS links are handled (only HTTP links were working before)
    - item can be use if all previous methods fail (url, keyword, file path).
2017-06-27 16:23:28 +02:00
Goffi
be9de5afc4 jp (blog): added language in managed keys 2017-06-25 09:43:04 +02:00
Goffi
6e70992c6c jp: added constant to handle ANSI code for header and subheaders 2017-04-27 00:57:04 +02:00
Goffi
8a38c20d92 jp (blog): service and node can now be specified for edit command 2017-04-16 18:00:45 +02:00
Goffi
a1def7f8f0 jp (blog): set default template and data mapping for the new template output 2017-02-21 21:01:40 +01:00
Goffi
8155bc3ee8 jp (base, blog, output(std)): fixed bad unicode handling in stdout, use of jp.disp instead of simple print 2017-02-21 21:01:40 +01:00
Goffi
bc8c6d34ca jp (blog/get): fancy output prints author, published and updated if verbosity > 1 and tags if verbosity > 2 + format published and updated 2017-02-17 00:33:55 +01:00
Goffi
bb6d71d857 jp (blog): added blog/get command:
- blog/get will retrieve and parse blog items on specified service/node and can request only one or more specific items according to ids of max value
    - it takes profit of outputs and the new extra_outputs: a default output display microblogs as key/value, a fancy one display it in a more confortable way for reading it the terminal
    - for default output, keys can be filtered using --key argument
2017-02-16 01:02:33 +01:00
Goffi
a28bb7be8f merged main branch 2016-06-24 22:41:28 +02:00
Goffi
fe8187a413 jp (blog): fixed syntax detection when extension is .txt 2016-06-24 22:32:58 +02:00
Goffi
a9aa17f2d0 jp: fixed shebang python call 2016-06-19 22:22:08 +02:00
Goffi
f600da971e jp (blog/edit): use utf-8-sig to decode content file to avoid BOM being propaged to content 2016-03-25 15:32:43 +01:00
Goffi
24be8976ef jp (blog/edit): added forgotten O_TRUNC while opening metadata file 2016-03-25 12:06:50 +01:00
Goffi
c951dea64b jp (blog/edit): do not remove files if they are not in the temporary dir hierarchy 2016-03-25 11:45:57 +01:00
Goffi
c3ae32be42 jp (blog/edit): HTTP(S) and XMPP URLs can now be directly used in blog/edit command 2016-03-24 18:38:04 +01:00
Goffi
e3623e67ef jp (blog): force deletion (without backup) when content is empty 2016-03-22 23:33:55 +01:00
Goffi
9d304eec88 jp (blog): avoid conflict error when command line tags are already present in metadata 2016-03-22 23:33:31 +01:00
Goffi
2fd6fa663c jp (blog): drafts are now put in a sub dir per profile + added a security which keep the last 10 drafts before removing them (all profiles included). 2016-03-22 22:46:05 +01:00
Goffi
2d1d286be2 core (tools): moved common to a separate package, and put data method in a data_format module 2016-03-22 22:46:04 +01:00
Goffi
9782588177 jp (blog): added "updated" to keys to keys to remove from tmp metadata 2016-03-15 16:25:42 +01:00
Goffi
7ebae7c89a jp (blog/edit): removed meta_file_path non existence check, as it is now re-used if it exists 2016-03-10 19:13:42 +01:00
Goffi
3ab15a6aee jp (blog/edit): a draft file can be directly specified 2016-03-10 18:05:37 +01:00
Goffi
27cd8412d5 plugin XEP-0060: fixed traceback if service was None 2016-03-10 17:50:17 +01:00
souliane
ce507c49da frontends (jp / blog): pass the profile to subprocess when using option --preview 2016-03-07 19:58:33 +01:00
Goffi
fe340c0135 jp (blog/preview): change watch for IN_MOVE_SELF event, needed at least for Emacs 2016-03-07 19:43:02 +01:00
Goffi
cf588d3e74 jp (blog/edit): added a confirmation message when blog item has been successfuly published 2016-03-05 20:19:40 +01:00
Goffi
f74fd5552a blog (jp/edit): added --preview option to launch a "blog preview" in parallel 2016-03-05 20:19:17 +01:00
Goffi
8839f38813 jp (blog/preview): inotify improvments:
- InotifyError are catched (can happen if file is deleted during preview for instance)
    - handle IN_DELETE_SELF event which happen when editor write content in a new file and switch to it (tested with vim)
2016-03-05 19:24:10 +01:00
Goffi
63b26aad8f jp (blog/preview): open and preview commands can be changed in sat.conf with "blog_preview_open_cmd" and "blog_preview_update_cmd" in [jp] section + don't convert syntax when content is empty 2016-03-05 19:21:35 +01:00
Goffi
49f2646315 jp (blog): fixed syntax guessing on existing files 2016-03-05 18:00:12 +01:00
Goffi
e2eb4672b0 jp (blog/preview): added inotify support, so preview can be updated each time the file is modified (actually IN_CLOSE_WRITE is used, but this may change in the future) 2016-03-05 17:59:10 +01:00
Goffi
d34f3ab948 jp (blog/preview): xhtml cleaning is now used on preview 2016-03-05 15:43:14 +01:00
Goffi
ad7e88ebf5 jp (blog): moved common method in a BlogCommon class + added "current" as an item keyword for blog/edit 2016-03-04 11:22:41 +01:00
Goffi
f9d691fd26 jp (blog/edit): metadata file is reused if it already exists 2016-03-04 10:33:28 +01:00
Goffi
7428b57ac7 jp (blog): preview command, first draft 2016-03-03 18:28:53 +01:00
souliane
a278dfc841 jp (blog): add to EDITOR_ARGS_MAGIC parameters for (x)emacs and nano 2016-03-03 17:02:23 +01:00
Goffi
5704cb4586 jp (blog/edit): editor arguments can now be specified on sat.conf, and default on are applied for known editors:
- vim and gvim will open content and metadata file in a splitted window
    - gvim use --nofork option
    - installed a workaround for shlex.split not handling unicode before Python 2.7.3
    - some fixes
2016-03-03 15:57:06 +01:00
Goffi
f993fa07df jp (blog/edit): removed content_rich from KEY_TO_REMOVE_METADATA as it is never given by backend 2016-03-02 19:53:53 +01:00
Goffi
41f19f63ec base (blog/edit): added a way to block publishing by adding "publish": "false" in metadata file 2016-03-02 19:46:01 +01:00
Goffi
272d6f84d6 jp (blog/edit): added metadata handling through a .json file (named like content temporary file, but with extension replaced by "_metadata.json"). Modification to this file before the end of edition will be taken into account. 2016-03-02 19:18:14 +01:00
Goffi
dc8f07aec4 jp (blog): edit command, first draft:
- can edit a new or existing item, by default edit a new item
    - item are selected with a shortcut, for now only "new" and "last" are handled. URI handling is planed, specially xmpp: URIs
    - file are edited using EDITOR env variable, or editor in [jp] section in sat.conf
    - current syntax is used, file extension is choosed according to syntax, to make syntax coloration and other goodies in editor available
    - if file is empty or not modified, nothing is published
    - for now, title, tags and commend desactivation are handled with optional arguments, but other are planed, and a metadata system should come soon
2016-03-01 01:54:21 +01:00
Goffi
169bc43793 jp: all commands now use the new start method and set need_loop in __init__ when needed 2016-02-29 16:52:51 +01:00
souliane
c18f64f4fb frontends (jp): onActionNew displays xmlui message if no meta_type is defined and xmlui is defined 2016-02-04 11:48:37 +01:00
souliane
0eaf531608 frontends (jp/blog), plugin blog_import: fixes:
- argparse argument with nargs > 1 and default == {} crashes when reading the user input
    - separate blog import options with a new line
    - convert DBus strings received by the backend to unicode
2016-02-04 11:44:43 +01:00
Goffi
13d24075c1 jp (blog): import now show progression + value to add to sat.conf for URLs redirection 2016-01-24 18:24:01 +01:00