Commit graph

97 commits

Author SHA1 Message Date
Michael Opdenacker
a5afbeb2a7
Merge pull request #135 from cxw42/doc-frontend
Doc comments: frontend
2020-05-26 10:11:49 +02:00
Chris White
a4150aad3f Added doc comments to Web interface (#78)
- Generate "Documented in" HTML
- resolve path to __file__: web.py finds its template directory with
  respect to __file__.  If __file__ is a symlink, resolve it.  This lets
  web.py work in a t/interact.pl session.
2020-05-25 14:32:28 -04:00
Chris White
ff99aaf60c Add tests of web.py and relevant infrastructure
- Add sanity tests of line_mark_string
- Update TestHelpers::_parseq() to handle HTML section headers as
  well as query.py section headers
- Add tests of web.py
  - Note: don't look for 200 since web.py doesn't send an HTTP Status-Line.
- In web.py, update the shebang to use env(1).  The hard-coded path
  caused test failures on Travis, which runs Python in a virtualenv.
2020-05-25 14:31:41 -04:00
Chris White
5e7cab18ca Added/updated copyright notices; whitespace fixes
No functional changes
2020-05-23 15:14:21 -04:00
Maxime Chretien
962d6fb539 web interface: Add support for Kconfig and Devicetree idents
Keep old urls compatibility by settings family to C when nothing is
given.

Add a select element to select in which file family we want to search an
ident.

Update filters to support families and to handle Kconfig idents properly.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-22 10:29:24 +02:00
Maxime Chretien
9f29697105 symlinks: Handle symlinks in the tree view
git ls-tree return file permissions and symlinks always have permission
120000
So we can use that to identify them

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-18 10:52:05 +02:00
Michael Opdenacker
9058a7a563
Merge pull request #115 from MaximeChretien/encode_url
Encode slashes in URL
2020-04-21 17:00:07 +02:00
Maxime Chretien
2815704f9f http/web.py: Follow coding style
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-04-21 16:39:51 +02:00
Maxime Chretien
9e9b158057 http/web.py: Encode slashes in URL
This allow the use of tags with slashes.
And thus fix https://github.com/bootlin/elixir/issues/106

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-04-21 16:13:02 +02:00
Maxime Chretien
ea0964a76c http/web.py: Remove broken old code
If this test succeed it clears cmd so the next test always leads to an
error 400.
And this code is not used anymore so it's better to remove it.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-04-21 11:55:30 +02:00
Christopher White
ca36e56d2a Front-end: accept (but don't use) doc comments from query()
Now that query() returns three elements instead of two, accept all three
2020-04-02 13:11:16 -04:00
Michael Opdenacker
ae6fb0dbb2 Fix syntax error
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2020-04-02 16:22:43 +02:00
Michael Opdenacker
59b45e86cc http/web.py: create /tmp/elixir-errors if non existing
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2020-04-02 16:11:14 +02:00
Michael Opdenacker
e9d970ced1 Fix handling of malformed URLs
- Otherwise, we end up with a wrong path variable
  that causes an internal server error

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2020-03-06 12:04:39 +01:00
pcworld
97ef91036a Prepend filename or identifier in HTML <title>
Display filenames and identifiers at the *beginning* of the <title>.
This way, they are better visible in modern browsers' tabs as they
usually cut off the title for space reasons.

This also fixes handling of the root path.
Examples of changed titles:
"Linux source code: (v5.5.6) - Bootlin" becomes "Linux source code (v5.5.6) - Bootlin"
"Linux source code: arch (v5.5.6) - Bootlin" becomes "arch - Linux source code (v5.5.6) - Bootlin"
"Linux source code: arch/um/Makefile (v5.5.6) - Bootlin" becomes "Makefile - arch/um/Makefile - Linux source code (v5.5.6) - Bootlin"
2020-03-01 03:58:55 +01:00
Jules Maselbas
4b9e9e9e27 Support for lighthttpd CGI
Sample config for lighthttpd rules:

server.document-root = server_root + "/elixir/http"
url.redirect = ( "^/$" => "/linux/latest/source" )
url.rewrite  = ( "^/.*/(source|ident|search)" =>  "/web.py/$1")
setenv.add-environment = ( "PYTHONIOENCODING" => "utf-8",
	"LXR_PROJ_DIR" => "/path/to/elixir-data" )
2020-01-17 15:35:44 +01:00
Michael Opdenacker
a66996d398 http/web.py: improve code readability and fix issue
- Fix issue introduced by the previous commit
  The 'project' variable could be tested even in the case
  it wasn't defined (case of an invalid URL)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-18 16:11:53 +01:00
Michael Opdenacker
952329f32b Fix http error handling
- Return "400" status when the project doesn't have a database or repo
- In case the DB is not found, properly print the corresponding
  file name in the logs

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-18 10:13:15 +01:00
Carmeli Tamir
6fcfc0ca79 Fixed path dependency in lib.py 2019-12-15 15:15:09 -05:00
Michael Opdenacker
981555f746 Add more filters
- In particular to support 'include <path>' statements
- Add some exceptions to the above filters, to exclude
  includes that could go outside of the project

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-04 08:56:30 +01:00
Michael Opdenacker
b0f3131bf0 web.py: add back missing first line
- There was a +1 offset in shown file contents
- This was caused by a bad interpretation of the
  code that was replaced by a previous commit

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-02 15:07:54 +01:00
Michael Opdenacker
8d7b8cb9da web.py: implement per-project filters
- In an efficient way: each project defines the filters
  it uses, instead of selecting filters from a long list
  of filters that takes time to load.

- See filters/linux.py for example

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-02 14:57:28 +01:00
Michael Opdenacker
db8a4d81f3 http/web.py: move filters in a separate file
- For cleaner separation of code

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-01 09:56:33 +01:00
Michael Opdenacker
0a23eecf0a http/web.py: fix handling of invalid requests
- Manage case that wasn't handled previously
- Return error 400 instead of 404

This fixes https://github.com/bootlin/elixir/issues/77

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-01 08:08:48 +01:00
Michael Opdenacker
51a6dff682 Python parentheses coding style fixes
- According to https://www.python.org/dev/peps/pep-0008/

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-01 07:01:26 +01:00
Michael Opdenacker
fee6c0b5ea web.py: simplify code and improve performance
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-11-30 07:27:26 +01:00
Michael Opdenacker
340ae68124 web.py: implement actual error logging
- cgitb.enable() was not enough to get error message details

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-11-30 06:39:45 +01:00
Michael Opdenacker
e413023bfd web.py: factorize filter code
- Start creating filter definitions and processing,
  in order to later support per project definitions

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-11-29 21:15:41 +01:00
Michael Opdenacker
a8e9064c34 web.py: add support for Kconfig source links
- And make the regexps more robust,
  anticipating some non-standard cases
  (extra spaces, spaces before, etc)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-11-27 12:29:14 +01:00
Michael Opdenacker
7a0c3131b8 web.py: add support for some DTS includes
- This allows to add hyperlinks in statements like:
  /include/ "file.dtsi"
  #include "file.dtsi"

  In this case, "file.dtsi" is in the same directory
  as the including file.

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-11-27 07:59:14 +01:00
Michael Opdenacker
4089b4f754 web.py: remove unnecessary code and add comments
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-11-09 19:24:31 +01:00
Michael Opdenacker
e9668492fb Remove unnecessary line
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-11-09 18:20:48 +01:00
Mikael Bouillot
c7a90a14cc URL-encode the query string when redirecting an ident search
Fixes #56
2019-10-08 12:52:27 +00:00
Carmeli Tamir
1a91f04927 Straightened the interface between query and web, as preparation to add a json api parallel to web 2019-10-05 00:27:52 -04:00
Carmeli Tamir
d926243164 Refactored ident query to use python objects rather than parsing REs 2019-10-02 00:01:46 -04:00
Mikael Bouillot
94caef2816 Set Pygments option to keep leading blank lines
Fixes #33
2019-09-25 08:14:04 +00:00
Michael Opdenacker
2d526f7709 web.py: add minor comments
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-09-23 15:47:41 +02:00
Michael Opdenacker
0eea6aa35f Add a message banner and hyperlink to the header
- This allows to make some announcements

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-03-21 07:36:31 +01:00
Michael Opdenacker
7f5187ad4e Capitalize project names in page titles
Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
2018-03-29 06:36:20 +02:00
Michael Opdenacker
4cb3150119 Improve page titles
For more useful information in seach engine results.
Essentially, we highlight:
- That the page is about source code for the current project
- Pages that are about an identifier
- The revision tag being considered (otherwise the page
  has the same title for 2 different tags)

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
2018-03-29 06:28:52 +02:00
Michael Opdenacker
b321480ab9 Sort projects by name
- This impacts the drop down menu allowing to choose projects.
  As the list of supported projects increases, this should
  make project selection easier.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
2018-03-29 05:45:54 +02:00
Mikaël Bouillot
537e6b3a7b Change business name 2018-02-15 21:27:00 +00:00
Mikaël Bouillot
b6e26e75c8 Switch to relative base URL for HTTPS support 2017-09-25 14:15:39 +02:00
Mikaël Bouillot
09c29afe32 Don't hide subversions 2017-07-03 12:42:12 +02:00
Mikaël Bouillot
57c17919e7 Strip whitespace from identifier queries
Fixes #22
2017-06-30 15:44:53 +02:00
Mikaël Bouillot
1b4c0fc7d4 Update notices to match the new license 2017-06-27 14:13:28 +02:00
zo
a100f42046 Improve line's anchor scroll jump 2017-05-24 15:02:40 +02:00
zo
bcbf25a6b1 Move project link in footer 2017-05-12 20:57:34 +02:00
zo
317a1c5a4e Fix double </tr> closing 2017-05-12 20:31:33 +02:00
zo
7b07aa0c9d Show active project in project menu 2017-05-12 16:14:47 +02:00