You are not logged in.

#1 2014-10-04 00:15:19

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Wikicurses - Python-based Curses UI for MediaWiki wikis

I forked cliwiki to make some improvements, and the result is a simple curses UI for accessing MediaWiki wikis.

Features

- Curses UI
- Basic Vi-like key bindings including ex commands
- Table of contents to skip through article
- Enter page name as a parameter or open page through search box
- Basic support for bookmarks
- Supports multiple wikis (including the Arch Linux wiki)
- Zsh completion
- Basic support for editing pages
- Browse links on page with :links and :iwlinks for inter-wiki links
- Go back and forward in history

Github
AUR Package
AUR git Package

Last edited by ids1024 (2015-04-13 23:11:53)


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#2 2014-10-11 21:31:53

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

I have added support for other MediaWiki-powered wikis, such as the Arch Wiki:

wikicurses --wiki https://wiki.archlinux.org/api.php Dwm

"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#3 2014-10-12 01:18:42

Awebb
Member
Registered: 2010-05-06
Posts: 6,617

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Oh, that's nice! I'll use it for a while and get back at you if I find anything.

Offline

#4 2014-10-12 04:51:26

vik_k
Member
From: Pune, India
Registered: 2009-07-12
Posts: 227
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Awesome sir... will check it out and let you know.


"First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack." ~ George Carrette

Offline

#5 2014-10-12 10:42:59

null
Member
Registered: 2009-05-06
Posts: 398

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Looks nice so far.

wikicurses.conf(5) says:

SYNOPSIS
       /etc/wikicurses.conf

       ~/.conf/wikicurses/config

But the second should be ~/.config/wikicurses/config

Last edited by null (2014-10-12 10:43:13)

Offline

#6 2014-10-12 14:57:13

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

null wrote:

Looks nice so far.

wikicurses.conf(5) says:

SYNOPSIS
       /etc/wikicurses.conf

       ~/.conf/wikicurses/config

But the second should be ~/.config/wikicurses/config

I've fixed that now.
Edit: I also fixed some incorrect spellings.

Last edited by ids1024 (2014-10-12 15:05:12)


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#7 2014-10-26 03:59:20

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Update: Wikicurses now supports editing pages.

I have added the command ":edit", which opens the page in $EDITOR (defaulting to vim), asks for a commit message, and uploads it. To use this feature, username and password must be added to the section of the configuration file for the wiki to be edited.

Edit: Feature requests are welcome.

Last edited by ids1024 (2014-10-26 15:03:03)


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#8 2014-12-31 01:37:12

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

I have released version 1.0 and created a wikicurses package in the AUR.

Also, I have added the ability to go back and forward in history (i.e. a back button), a :links command to browse the internal links on a page, and an :iwlinks command to browse interwiki links. Various other minor or less user facing changes have been made since my last post.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#9 2015-02-22 18:22:47

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Version 1.1 with bug fixes and some small features:
https://github.com/ids1024/wikicurses/releases/tag/v1.1


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#10 2015-02-22 21:38:31

hagabaka
Member
Registered: 2010-12-15
Posts: 34

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Is there a way to search within a page, like / in less or vim?

Offline

#11 2015-02-22 21:56:09

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Search functionality is on the todo list but is not yet possible.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#12 2015-02-22 23:43:18

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

@hagabaka I have just pushed rudimentary search functionality to the git repository.  It is incomplete, but could be useful.  Use it with the / key just like in vi.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#13 2015-03-13 23:23:57

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Released version 1.2.  The main addition is the search feature, though it is somewhat limited.

https://github.com/ids1024/wikicurses/releases/tag/v1.2


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#14 2015-03-16 04:49:32

cedeel
Member
From: ~
Registered: 2009-08-25
Posts: 176
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Nice project. Any plans to add colour options in the config?

Having different colours for titles and links could be neat

Offline

#15 2015-03-16 22:21:03

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

cedeel wrote:

Nice project. Any plans to add colour options in the config?

Having different colours for titles and links could be neat

Good idea.  I have added it to TODO and will implement it when I have time.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#16 2015-04-07 20:49:32

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

I have added support for custom colors to the customcolors branch. I still have to add support for colorizing various other things, and to consider if there is a better way to configure the colors than what I have set up.

Other than colors, I have also added a :langs command to see a page in different languages, as well as some bug fixes and other small changes.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#17 2015-04-13 20:33:27

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 762

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Nice! Added a short note on the wiki (of course feel free to modify as you think).

The usability is already pretty high, there is just one thing that struck me: the spacing of the blocks on the page is IMHO wrong. Consider the following example (from the Beginners' guide):

Connect automatically to known networks
 Warning: This method cannot be used with explicitely enabled profiles, i.e. through netctl enable profile.
Install wpa_actiond, which is required for netctl-auto:

# pacman -S wpa_actiond
Enable the netctl-auto service, which will connect to known networks and gracefully handle roaming and disconnects:

# systemctl enable netctl-auto@interface_name.service
 Tip: netctl also provides netctl-ifplugd, which can be used to handle wired profiles in conjunction with netctl-auto.

Here, the first line is the section title and it appears as bright white, underlined in the terminal, but the rest appears quite unreadable. The code lines starting with '#' blend with the text followed, there is a blank line before but not after the code line. Also the Warning and Tip notes, which can be identified by <div> tags in the HTML, could be spaced from the surrounding text to make them more outstanding.

I'd suggest to try to detect the blocks the page is made of and insert a (single) blank line between them to make the result more readable. The code (inside <pre> tags) could also be indented. It may be hard to implement consistently for various wikis, but I think it's worth a try. What do you say?

I'll surely take a look at the code when I find some time, I could potentially make use of it to implement some interactive features planned for wiki-scripts.

Offline

#18 2015-04-13 23:02:34

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

lahwaacz wrote:

Also the Warning and Tip notes, which can be identified by <div> tags in the HTML, could be spaced from the surrounding text to make them more outstanding.

Obviously that can't be done do every <div> tag, since modern html code has divs everywhere. I guess the solution would be to parse the style attribute and  add padding when padding is included. It might be possible to also respect the css border and add a border around it as well. I think that will work, and it will probably be useful for some other wikis as well.

I'd suggest to try to detect the blocks the page is made of and insert a (single) blank line between them to make the result more readable. The code (inside <pre> tags) could also be indented. It may be hard to implement consistently for various wikis, but I think it's worth a try. What do you say?

The code currently adds a blank line after </p> tags. I can make it do the same for other block-level elements like <pre>. As for indenting <pre> tags, do you know if that would cause issues with other wikis?

Edit: Indenting/padding certain blocks of text will require some somewhat complicated changes to how text is displayed in wikicurses. Not to say I won't do that, but for now I have just made <pre> tags green (by default, colors are customizable). Not perfect, but the code stands out well.

Last edited by ids1024 (2015-04-13 23:56:38)


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#19 2015-04-18 22:31:10

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Wikicurses now by default adds 3 spaces of padding to <pre> tags.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#20 2015-04-25 20:14:22

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

With the latest commit, the Warning and Tip boxes have borders and are padded.


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#21 2015-06-07 17:28:30

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

I see I never got around to releasing the last changes, so I just released 1.3.

https://github.com/ids1024/wikicurses/releases/tag/v1.3


"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#22 2016-02-03 00:16:22

rbnb_bnbr
Member
Registered: 2016-02-03
Posts: 2

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

Wikicurses is really neat - Thank you ids102!

I'd like to save the output to text instead of displaying it. I've tried piping it to tee with no luck. I came across instructions on how to output a man page to text:

man wikicurses | col -bx > output.txt

This doesn't work either. Is there any way pipe the output to a file? If this is not possible from a curses application like this, do you plan on adding a "print" type function? My goal is to script a list of ~50 wikipedia articles and save them for offline terminal reading.

Kind of like this but not on such a large scale - http://www.evanjones.ca/software/wikipedia2text.html

Offline

#23 2016-02-03 00:38:38

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

It could be good to add such a feature, but it would lose the formatting, such as boldfacing, color, underline, centering, etc. You can use a python script and import the module directly to get the unformatted text.

from wikicurses.wiki import Wiki

wiki = Wiki.fromPageUrl('http://en.wikipedia.org')
article = wiki.search('Linux')
print(''.join(i[1] for i in article.content))

"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/

https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024

Offline

#24 2016-02-03 01:33:39

rbnb_bnbr
Member
Registered: 2016-02-03
Posts: 2

Re: Wikicurses - Python-based Curses UI for MediaWiki wikis

That works great. Thanks!

Offline

Board footer

Powered by FluxBB