| 1 |
Websourcebrowser |
|---|
| 2 |
================ |
|---|
| 3 |
|
|---|
| 4 |
Introduction |
|---|
| 5 |
------------ |
|---|
| 6 |
|
|---|
| 7 |
Websourcebrowser_ makes it easy to visually scan trees of source code. |
|---|
| 8 |
In particular, you can view the directory tree and the source code of |
|---|
| 9 |
a file side by side, so you can quickly change to a different file. |
|---|
| 10 |
|
|---|
| 11 |
Some features of Websourcebrowser: |
|---|
| 12 |
|
|---|
| 13 |
- Platform-independent, any web browser can be used to view the |
|---|
| 14 |
source code |
|---|
| 15 |
|
|---|
| 16 |
- Includes a small webserver, so the source code and the browser to |
|---|
| 17 |
view it can be on different computers |
|---|
| 18 |
|
|---|
| 19 |
- By default, they are on the same computer :-) |
|---|
| 20 |
|
|---|
| 21 |
- If Pygments_ is installed on the server side, which may be the local |
|---|
| 22 |
computer, source code is automatically highlighted |
|---|
| 23 |
|
|---|
| 24 |
- Image files supported by the browser are displayed |
|---|
| 25 |
|
|---|
| 26 |
- Binary files are displayed as hexdumps |
|---|
| 27 |
|
|---|
| 28 |
- Written in portable Python_ |
|---|
| 29 |
|
|---|
| 30 |
You can use Websourcebrowser by starting the script |
|---|
| 31 |
``websourcebrowser`` and pointing your web browser to the address |
|---|
| 32 |
``http://localhost:8000/``. |
|---|
| 33 |
|
|---|
| 34 |
.. _Websourcebrowser: http://websourcebrowser.sschwarzer.net |
|---|
| 35 |
.. _Python: http://www.python.org |
|---|
| 36 |
.. _Pygments: http://pygments.org |
|---|
| 37 |
|
|---|
| 38 |
Documentation |
|---|
| 39 |
------------- |
|---|
| 40 |
|
|---|
| 41 |
There's not much documentation for Websourcebrowser yet. However, once |
|---|
| 42 |
you started the program and typed the displayed URL into the address |
|---|
| 43 |
line of a web browser, the program should be easy to use after |
|---|
| 44 |
experimenting a bit with it. |
|---|
| 45 |
|
|---|
| 46 |
There are two environment variables which influence Websourcebrowser. |
|---|
| 47 |
``WSB_IGNORE`` can contain a whitespace-separated list of wildcards |
|---|
| 48 |
which are used as ignore patterns. *My* list is usually:: |
|---|
| 49 |
|
|---|
| 50 |
*.pyc *.pyo */.svn *.svn/* */.hg */.hg/* *.swp |
|---|
| 51 |
|
|---|
| 52 |
which ignores Python bytecode files, version control files from |
|---|
| 53 |
Subversion_ and Mercurial_, and Vim_ swap files. |
|---|
| 54 |
|
|---|
| 55 |
To get help for the command line options, invoke the installed program |
|---|
| 56 |
with the ``help`` option:: |
|---|
| 57 |
|
|---|
| 58 |
$ wsbrowser --help |
|---|
| 59 |
|
|---|
| 60 |
where ``$`` is a shell prompt. Probably, the most useful options are |
|---|
| 61 |
``--root`` and ``--line-numbers``. Ignore patterns given via the |
|---|
| 62 |
command line option ``--ignore-pattern`` are *added* to those from the |
|---|
| 63 |
environment variable ``WSB_IGNORE``. (Note that you can't use a |
|---|
| 64 |
whitespace-separated list with ``--ignore-pattern`` but instead use |
|---|
| 65 |
the option multiple times.) |
|---|
| 66 |
|
|---|
| 67 |
.. _Subversion: http://subversion.tigris.org |
|---|
| 68 |
.. _Mercurial: http://www.selenic.com/mercurial |
|---|
| 69 |
.. _Vim: http://www.vim.org |
|---|
| 70 |
|
|---|
| 71 |
Prerequisites |
|---|
| 72 |
------------- |
|---|
| 73 |
|
|---|
| 74 |
Websourcebrowser requires only Python_, version 2.3 or later. It's |
|---|
| 75 |
recommended though not strictly necessary to also install Pygments_ |
|---|
| 76 |
to get syntax highlighting. |
|---|
| 77 |
|
|---|
| 78 |
Using Websourcebrowser without installation |
|---|
| 79 |
------------------------------------------- |
|---|
| 80 |
|
|---|
| 81 |
Though it's recommended, you don't *have to* install Websourcebrowser. |
|---|
| 82 |
Instead you can get away with extracting the source archive (see |
|---|
| 83 |
below) and adding the extracted directory to the ``PYTHONPATH`` |
|---|
| 84 |
environment variable. For example, if the directory is |
|---|
| 85 |
``/home/me/downloads/websourcebrowser-0.2``, add that to |
|---|
| 86 |
``PYTHONPATH``. |
|---|
| 87 |
|
|---|
| 88 |
Installation |
|---|
| 89 |
------------ |
|---|
| 90 |
|
|---|
| 91 |
You install Websourcebrowser like most Python packages. |
|---|
| 92 |
|
|---|
| 93 |
- *If you have an older version of Websourcebrowser installed, delete |
|---|
| 94 |
it or move it somewhere else, so that it doesn't conflict with the |
|---|
| 95 |
new version!* |
|---|
| 96 |
|
|---|
| 97 |
- Extract the downloaded archive. Under Unix/Linux, you usually do |
|---|
| 98 |
this from the shell prompt:: |
|---|
| 99 |
|
|---|
| 100 |
$ tar xzf websourcebrowser-0.1.tar.gz |
|---|
| 101 |
|
|---|
| 102 |
- Change to the directory:: |
|---|
| 103 |
|
|---|
| 104 |
$ cd websourcebrowser-0.1 |
|---|
| 105 |
|
|---|
| 106 |
- Become root:: |
|---|
| 107 |
|
|---|
| 108 |
$ su - |
|---|
| 109 |
|
|---|
| 110 |
The shell prompt changes to ``#``. |
|---|
| 111 |
|
|---|
| 112 |
- To install Websourcebrowser system-wide, type:: |
|---|
| 113 |
|
|---|
| 114 |
# python setup.py install |
|---|
| 115 |
|
|---|
| 116 |
Otherwise, consult the `distutils documentation`_ on how to install |
|---|
| 117 |
Python packages into another directory. |
|---|
| 118 |
|
|---|
| 119 |
.. _`distutils documentation`: http://docs.python.org/inst/alt-install-windows.html |
|---|
| 120 |
|
|---|
| 121 |
License |
|---|
| 122 |
------- |
|---|
| 123 |
|
|---|
| 124 |
Websourcebrowser is Open Source Software, distributed under the |
|---|
| 125 |
MIT license. |
|---|
| 126 |
|
|---|
| 127 |
Author |
|---|
| 128 |
------ |
|---|
| 129 |
|
|---|
| 130 |
The author of Websourcebrowser is Stefan Schwarzer |
|---|
| 131 |
<sschwarzer@sschwarzer.net> . I'm thankful for feedback! :-) |
|---|
| 132 |
|
|---|