Commit Graph

497 Commits

Author SHA1 Message Date
Guillaume Gomez
24e093c5c3 Remove old isHidden function 2019-11-07 10:13:44 +01:00
Guillaume Gomez
f66a331335 When a URL hash refers to a hidden element, it makes the element visible 2019-11-06 10:10:56 +01:00
Guillaume Gomez
1c78af7de2 clean highlightSourceLines code 2019-11-04 13:28:50 +01:00
bors
0d5264a03c Auto merge of #65780 - GuillaumeGomez:move-help-popup-generation-code, r=Mark-Simulacrum
Move help popup generation code

The first commit is just a small cleanup.

The idea behind this PR is to reduce a bit more the generated HTML files by moving the duplicated code into one place instead.

r? @kinnison
2019-11-03 21:55:48 +00:00
Tyler Mandry
c4960c2602
Rollup merge of #65741 - GuillaumeGomez:help-popup, r=Dylan-DPC
Prevent help popup to disappear when clicking on it

Fixes #65736.

r? @kinnison
2019-10-29 12:01:37 -07:00
Guillaume Gomez
79956b96e8 add sub settings in rustdoc 2019-10-29 13:54:11 +01:00
Guillaume Gomez
91ef9600db reduce size of generated HTML files by moving the popup helper code to the JS 2019-10-27 11:42:38 +01:00
Guillaume Gomez
1d2808341a Cleanup search element getter 2019-10-27 11:40:47 +01:00
Guillaume Gomez
863796be7d Improve help popup detection 2019-10-25 13:43:25 +02:00
Guillaume Gomez
e836b1b9d0 Prevent help popup to disappear when clicking on it 2019-10-24 22:52:54 +02:00
Guillaume Gomez
01a1bcb7f9 Fix default "disable-shortcuts" feature value 2019-10-24 00:25:04 +02:00
Guillaume Gomez
87744841c8 Add option to disable keyboard shortcuts in docs 2019-10-21 11:36:52 +02:00
Mazdak Farrokhzad
f7ee13040b
Rollup merge of #64312 - GuillaumeGomez:rustdoc-better-esc-handling, r=Mark-Simulacrum
Unify escape usage

Fixes #63443.

I chose to keep the search text when pressing escape so when we focus on the search bar, we got the results again without needing to load them again. I also unified a bit a few things (maybe I should have done it in another commit, sorry...).

r? @Mark-Simulacrum
2019-09-09 17:42:29 +02:00
Guillaume Gomez
0d34fe42f7 Unify escape usage 2019-09-09 17:04:28 +02:00
Mazdak Farrokhzad
ab75a1713a
Rollup merge of #64094 - kawa-yoiko:rustdoc-search, r=GuillaumeGomez
Improve searching in rustdoc and add tests

👋 I have made searching in rustdoc more intuitive, added a couple more tests and made a little shell script to aid testing. Closes #63005.

It took me quite a while to figure out how to run the tests for rustdoc (instead of running tests for other crates with rustdoc); the only pointer I found was [hidden in the rustc book](https://rust-lang.github.io/rustc-guide/rustdoc.html#cheat-sheet). Maybe this could be better documented? I shall be delighted to help if it is desirable.
2019-09-06 09:36:38 +02:00
Mazdak Farrokhzad
6da74a2605
Rollup merge of #63774 - chocol4te:fix_63707, r=GuillaumeGomez
Fix `window.hashchange is not a function`

Closes #63707.
2019-09-05 12:11:05 +02:00
Shiqing
cb84aa4744 Improve searching in rustdoc and add tests 2019-09-04 21:27:13 +08:00
Mazdak Farrokhzad
1ea8fc587c
Rollup merge of #62734 - GuillaumeGomez:hide-default-methods, r=Mark-Simulacrum
Hide trait default methods

Fixes #62499.

However, the question remains: do we want to extend it to this point or not?

r? @QuietMisdreavus
2019-08-29 17:13:57 +02:00
bors
0414dfa0aa Auto merge of #62941 - GuillaumeGomez:save-crate-filter, r=Mark-Simulacrum
Save crate filtering on rustdoc

Fixes #62929.

I added a hashmap and a hash encoding for the current crate list in case you have multiple crates handling on a same website (who talked about docs.rs?!). Like that, for each context, you have the filter crate selected.

r? @QuietMisdreavus
2019-08-28 21:42:52 +00:00
Guillaume Gomez
06228d33ca Save crate filtering on rustdoc 2019-08-28 11:56:21 +02:00
Guillaume Gomez
3375b05cd0 Fix confusion in theme picker functions 2019-08-21 13:10:06 +02:00
Ferdia McKeogh
5a446c1ea9
Fix window.hashchange is not a function 2019-08-21 09:13:51 +01:00
Guillaume Gomez
cb873c5a87 code formatting 2019-07-16 18:32:40 +02:00
Guillaume Gomez
8ca3887439 Fix lines highlighting in rustdoc source view 2019-05-21 14:49:53 +02:00
bors
963184bbb6 Auto merge of #60093 - GuillaumeGomez:fix-attrs-pos, r=Manishearth
Fix attrs pos

Fixes #60042.

Screenshot:

<img width="438" alt="Screenshot 2019-05-12 at 15 02 25" src="https://user-images.githubusercontent.com/3050060/57582606-1455ec00-74c7-11e9-9d4e-5ec4da4de7dd.png">

r? @rust-lang/rustdoc
2019-05-18 20:49:22 +00:00
Dmitry Murzin
b6cfcd363b
Fix default value for setting "Auto-hide item methods' documentation" 2019-04-28 04:25:22 +03:00
Guillaume Gomez
5971266301 Fixes attributes position in types decl 2019-04-18 00:02:12 +02:00
bors
876a3bcb15 Auto merge of #59622 - GuillaumeGomez:improve-one-char-search, r=QuietMisdreavus
Ensure that exact matches come first in rustdoc search

Fixes #59287.

cc @scottmcm

r? @QuietMisdreavus
2019-04-12 08:59:03 +00:00
Guillaume Gomez
19073676bf Ensure that exact matches come first in rustdoc search 2019-04-02 00:09:27 +02:00
Mazdak Farrokhzad
ca14c56563
Rollup merge of #59534 - laurmaedje:collapse-blanket-impls, r=GuillaumeGomez
rustdoc: collapse blanket impls in the same way as normal impls

If the rustdoc setting _Auto-hide trait implementations documentation_ is activated (on by default), normal trait implementations are collapsed by default.

Blanket impls on the other hand are not collapsed. I'm not sure whether this is intended, but considering that the blanket impls for `From`, `Into`, `TryFrom`, ... are on every type, it would reduce the documentation bloat if these would also be collapsed when the setting is active.

(I'm not really familiar with the codebase and therefore just copied the code for the normal impl collapsing, but I could deduplicate it into a method, of course, too.)
2019-03-30 07:51:45 +01:00
Mazdak Farrokhzad
d050a157a8
Rollup merge of #59376 - davidtwco:finally-rfc-2008-variants, r=petrochenkov,QuietMisdreavus
RFC 2008: Enum Variants

Part of #44109. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion.

r? @petrochenkov
cc @nikomatsakis
2019-03-30 07:51:34 +01:00
Laurenz
9e4ec7a568 Collapse blanket impls in the same way as normal impls 2019-03-29 19:47:19 +01:00
David Wood
49a6da2cda
Support non-exhaustive enum variants in rustdoc.
This commit adds support for non-exhaustive enum variants in rustdoc,
extending the existing support for non-exhaustive enums and structs.
2019-03-29 11:03:35 +01:00
Guillaume Gomez
befe9cac91 Add test 2019-03-23 14:44:20 +01:00
Guillaume Gomez
6bce61cd4b Fix invalid returned types generation 2019-03-21 22:49:43 +01:00
Guillaume Gomez
aefe75095a Add bounds for return types as well 2019-03-21 22:49:43 +01:00
Guillaume Gomez
d611301e3e Small generics search improvement 2019-03-21 22:49:43 +01:00
Guillaume Gomez
e969de88bb Fix "Auto-hide item methods documentation" setting 2019-03-02 17:17:08 +01:00
kennytm
d22bb1a8b4
Rollup merge of #58336 - GuillaumeGomez:fix-search-results-interactions, r=oli-obk
Fix search results interactions

The bug is visible when you search for "none": the second tab is empty and therefore it messes with the classes. Then when you try to use arrows on the third tab, it just crashes (because only 2 "search-results" are present and you're on tab 3).

r? @QuietMisdreavus
2019-02-20 11:58:16 +08:00
kennytm
9a3e22e32f
Rollup merge of #58306 - GuillaumeGomez:crate-browser-history, r=QuietMisdreavus
Don't default on std crate when manipulating browser history

Fixes #58263.

r? @QuietMisdreavus
2019-02-16 14:11:35 +08:00
Guillaume Gomez
d5a8b247be
Rollup merge of #58297 - GuillaumeGomez:cleanup-js, r=QuietMisdreavus
Cleanup JS a bit

r? @QuietMisdreavus
2019-02-10 21:45:18 +01:00
Guillaume Gomez
c20357a62a Add trait aliases to js types 2019-02-10 14:49:20 +01:00
Guillaume Gomez
69d948d347 Fix search results interactions 2019-02-10 00:37:44 +01:00
Guillaume Gomez
8f6d05b819 Don't default on std crate when manipulating browser history 2019-02-08 16:05:48 +01:00
Guillaume Gomez
b962ecc6f9 Cleanup JS a bit 2019-02-08 12:38:47 +01:00
hrls
5288f3f967 fix rustdoc JS 2019-02-08 12:47:20 +03:00
Guillaume Gomez
da8da5e061
Rollup merge of #58150 - GuillaumeGomez:dont-apply-impl-collapse-rules-to-trait-impls, r=Manishearth
Don't apply impl block collapse rules to trait impls

Fixes #58147.

r? @QuietMisdreavus
2019-02-07 14:28:40 +01:00
Guillaume Gomez
064b787fc9
Rollup merge of #58146 - GuillaumeGomez:dont-collapse-everything, r=QuietMisdreavus
Prevent automatic collapse of methods impl blocks

Fixes #57582.

r? @QuietMisdreavus
2019-02-07 14:28:38 +01:00
Guillaume Gomez
55c0922201
Rollup merge of #57504 - GuillaumeGomez:re-enable-history, r=QuietMisdreavus
Re-enable history api on file:// protocol

Fixes #57135.

I tested locally on chrome (since it was the browser having issues with history management on `file://` protocol) and it worked fine so I guess we can re-enable it.

r? @QuietMisdreavus
2019-02-07 14:28:27 +01:00
Guillaume Gomez
729e37da4d Don't apply impl block collapse rules to trait impls 2019-02-07 11:48:31 +01:00
Guillaume Gomez
d0f88c4da3 Prevent automatic collapse of methods impl blocks 2019-02-04 14:59:06 +01:00
Guillaume Gomez
d405606c3b End fixing search index minification 2019-01-17 01:41:01 +01:00
Mazdak Farrokhzad
9947b3060c
Rollup merge of #57614 - GuillaumeGomez:fix-crate-filtering, r=QuietMisdreavus
[rustdoc] Fix crates filtering box not being filled

Currently, the filter crate box (at the left of the search input) is always empty. To get the number of keys of dictionary in JS, you need to call `Object.keys()` on it.

r? @QuietMisdreavus
2019-01-15 12:42:14 +01:00
Guillaume Gomez
0d695ff330 Fix crates filtering box not being filled 2019-01-15 00:41:41 +01:00
Mazdak Farrokhzad
6d00124b85
Rollup merge of #56874 - JohnHeitmann:docs-spacing, r=GuillaumeGomez
Simplify foreign type rendering.

Simplified foreign type rendering by switching from tables to flexbox. Also, removed some seemingly extraneous elements like “ghost” spans.

Reduces element count on the `std::iter::Iterator` page by 30%. On my laptop it drops Iterator page load time from ~15s to ~10s. Frame times during scrolling are a hair lower too.

Known visual changes (happy to tweak based on feedback):
* The main `impl ...` headers are now getting the default, larger, h3 font size. This was an accident, but I liked how it turned out so I didn't fix it.
* There's a hair less vertical spacing between the end of a where block and the start of the next fn. Now, all spacing is consistent. I think this looks a bit worse. I may tweak vertical spacing more here or in a follow-up that cleans up vertical spacing more broadly.
* "[src]" links are all sized at 17px. A few were 19px in the original.

I haven't yet done heavy cross-browser or cross-crate testing. I was hoping to get a quick thumbs up or thumbs down here at this first draft, then if this is on the right track I'll spend some time on that testing.

TODO:

- [x] Test on Chrome
- [x] Test on Firefox
- [ ] ~~Test on UC Android~~
- [x] Test on Edge
- [x] Test on iOS safari
- [x] Test on desktop safari
- [x] Update automated tests
- [x] Increase vertical margin
- [x] Fix "Important traits for" hover overlap
- [x] Wait for #55798 to land & merge it
2019-01-13 21:18:09 +01:00
Guillaume Gomez
830b3b8c75 Re-enable history api on file:// protocol 2019-01-10 23:59:42 +01:00
bors
43d26b1f35 Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavus
Add no-crate filter option on rustdoc

@onur asked me about it so here it is!

r? @QuietMisdreavus
2018-12-29 01:22:04 +00:00
John Heitmann
34bd2b845b Simplify foreign type rendering.
Simplified foreign type rendering by switching from tables to flexbox. Also, removed some seemingly extraneous elements like “ghost” spans.

Reduces element count on std::iter::Iterator by 30%.
2018-12-27 21:22:27 -08:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Guillaume Gomez
dbcf68951c Add no-crate filter option on rustdoc 2018-12-24 18:19:36 +01:00
Guillaume Gomez
b998995813 Fix js errors 2018-12-16 13:45:46 +01:00
Guillaume Gomez
b8c1726f26 Show 'loading content' when loading content 2018-12-06 23:34:36 +01:00
Guillaume Gomez
a68988719c cleanup 2018-12-06 23:34:36 +01:00
Guillaume Gomez
34e31830c0 Prevent lazy iterations over DOM 2018-12-06 23:34:36 +01:00
Guillaume Gomez
edfe2a893e Greatly improve rustdoc rendering speed issues 2018-12-06 23:34:35 +01:00
Pietro Albini
a88feabac4
Rollup merge of #56332 - GuillaumeGomez:specifi-crate-search, r=QuietMisdreavus
[rustdoc] Specific crate search

Reopening of #54706.
Fixes #54616.

<img width="1440" alt="screenshot 2018-11-29 at 01 29 11" src="https://user-images.githubusercontent.com/3050060/49191372-979adf80-f376-11e8-963e-e4feb927c1da.png">

r? @QuietMisdreavus
2018-12-06 07:48:50 +01:00
Pietro Albini
0fb90f372e
Rollup merge of #56523 - JohnHeitmann:es6, r=GuillaumeGomez
Added a bare-bones eslint config (removing jslint)

This change removes the small bit of jslint config, replacing it
with eslint. I've currently configured eslint to mostly only report
the more serious of lints, although there are still some style nits
turned on.

Eslint better supports modern js, and will be a good pre-TypeScript code
quality aid.

Install eslint with `npm install -g eslint`. Run with `eslint html/static/*.js`,
or let your IDE do it. This requires no build step.

Upcoming changes will start fixing identified bugs and other lints (mostly unused and var redef issues).
2018-12-05 23:54:38 +01:00
Pietro Albini
66ba6b3a66
Rollup merge of #55563 - GuillaumeGomez:doc-search-sentence, r=QuietMisdreavus
Improve no result found sentence in doc search

Fixes #55531.

Look:

<img width="1440" alt="screenshot 2018-11-01 at 02 21 56" src="https://user-images.githubusercontent.com/3050060/47827257-f6236c80-dd7c-11e8-9ea9-99c8cb4b2de5.png">

r? @QuietMisdreavus
2018-12-05 23:54:22 +01:00
John Heitmann
56ace3e870 Added a bare-bones eslint config (removing jslint)
This change removes the small bit of jslint config, replacing it
with eslint. I've currently configured eslint to mostly only report
the more serious of lints, although there are still some style nits
turned on.

Upcoming changes will start fixing lints.
2018-12-04 15:46:15 -08:00
Guillaume Gomez
dd717deccb Add crate filtering 2018-11-28 19:33:33 +01:00
Guillaume Gomez
93520d2ad1 Add source file sidebar 2018-11-24 09:49:57 +01:00
Guillaume Gomez
c209ed8435 Improve no result found sentence in doc search 2018-11-21 19:45:04 +01:00
Guillaume Gomez
0edc9e8395 Small fixes on code blocks in rustdoc 2018-11-10 21:58:47 +01:00
Guillaume Gomez
336b02347f
Rollup merge of #54162 - GuillaumeGomez:hide-default-impls-items, r=QuietMisdreavus
Hide default impls items

Follow up of #51885.
Fixes #54025.

cc @Mark-Simulacrum

r? @QuietMisdreavus

And screenshots of course:

<img width="1440" alt="screen shot 2018-09-12 at 23 30 35" src="https://user-images.githubusercontent.com/3050060/45454424-1ff8d500-b6e4-11e8-9257-030322495d58.png">

<img width="1440" alt="screen shot 2018-09-12 at 23 30 42" src="https://user-images.githubusercontent.com/3050060/45454431-2424f280-b6e4-11e8-8d65-db0d85ac18f0.png">
2018-11-03 13:40:32 +01:00
Guillaume Gomez
f55e986a71 Fix invalid "expand description" display 2018-10-30 10:18:51 +01:00
Pietro Albini
9786d98056
Rollup merge of #55440 - xfix:patch-11, r=GuillaumeGomez
Remove unreachable code in hasClass function in Rustdoc
2018-10-29 09:47:51 +01:00
Konrad Borowski
b7c2b471cf
Remove unreachable code in hasClass function in Rustdoc 2018-10-28 12:12:29 +01:00
Guillaume Gomez
2fd378b82b Fix sub-variant doc display 2018-10-27 14:05:34 +02:00
Guillaume Gomez
b2f80ddf34 Fix multiple errors 2018-10-22 00:43:23 +02:00
Guillaume Gomez
9d8de1e30a Fix script to avoid displaying unnecessary items 2018-10-21 19:22:21 +02:00
Guillaume Gomez
edec5807ac Hide items if they use default docs 2018-10-21 18:28:27 +02:00
Guillaume Gomez
e961d397ca Add line numbers option to rustdoc 2018-10-09 22:55:18 +02:00
kennytm
def5f84fa6
Rollup merge of #54577 - QuietMisdreavus:docs-for-procs, r=GuillaumeGomez
rustdoc: give proc-macros their own pages

related to https://github.com/rust-lang/rust/issues/49553 but i don't think it'll fix it

Currently, rustdoc doesn't expose proc-macros all that well. In the source crate, only their definition function is exposed, but when re-exported, they're treated as a macro! This is an awkward situation in all accounts. This PR checks functions to see whether they have any of `#[proc_macro]`, `#[proc_macro_attribute]`, or `#[proc_macro_derive]`, and exposes them as macros instead. In addition, attributes and derives are exposed differently than other macros, getting their own item-type, CSS class, and module heading.

![image](https://user-images.githubusercontent.com/5217170/46044803-6df8da00-c0e1-11e8-8c3b-25d2c3beb55c.png)

Function-like proc-macros are lumped in with `macro_rules!` macros, but they get a different declaration block (i'm open to tweaking this, it's just what i thought of given how function-proc-macros operate):

![image](https://user-images.githubusercontent.com/5217170/46044828-84069a80-c0e1-11e8-9cc4-127e5477c395.png)

Proc-macro attributes and derives get their own pages, with a representative declaration block. Derive macros also show off their helper attributes:

![image](https://user-images.githubusercontent.com/5217170/46094583-ef9f4500-c17f-11e8-8f71-fa0a7895c9f6.png)

![image](https://user-images.githubusercontent.com/5217170/46101529-cab3cd80-c191-11e8-857a-946897750da1.png)

There's one wrinkle which this PR doesn't address, which is why i didn't mark this as fixing the linked issue. Currently, proc-macros don't expose their attributes or source span across crates, so while rustdoc knows they exist, that's about all the information it gets. This leads to an "inlined" macro that has absolutely no docs on it, and no `[src]` link to show you where it was declared.

The way i got around it was to keep proc-macro re-export disabled, since we do get enough information across crates to properly link to the source page:

![image](https://user-images.githubusercontent.com/5217170/46045074-2cb4fa00-c0e2-11e8-81bc-33a8205fbd03.png)

Until we can get a proc-macro's docs (and ideally also its source span) across crates, i believe this is the best way forward.
2018-09-29 16:46:30 +08:00
QuietMisdreavus
aea1bd0a59 handle proc-macros as macros instead of functions 2018-09-25 14:56:43 -05:00
Guillaume Gomez
827047c18b Fix JS error 2018-09-24 22:05:12 +02:00
bors
e7f1880921 Auto merge of #52962 - GuillaumeGomez:few-things, r=QuietMisdreavus
Fix trait item doc setting, add new setting, start hiding elements by default and then showing them up

r? @QuietMisdreavus
2018-09-14 01:07:21 +00:00
bors
f2302daef3 Auto merge of #53409 - GuillaumeGomez:associated-const-value, r=QuietMisdreavus
Don't show associated const value anymore

Part of #44348.

Before:

<img width="1440" alt="screen shot 2018-08-16 at 00 48 30" src="https://user-images.githubusercontent.com/3050060/44177414-20ef1480-a0ee-11e8-80d4-7caf082cf0de.png">

After:

<img width="1440" alt="screen shot 2018-08-16 at 00 48 23" src="https://user-images.githubusercontent.com/3050060/44177417-251b3200-a0ee-11e8-956a-4229275e3342.png">

cc @nox

r? @QuietMisdreavus
2018-09-12 21:20:05 +00:00
Guillaume Gomez
1b3382f2b9 Fix implementors generation as well 2018-09-06 23:32:30 +02:00
Guillaume Gomez
e1ec05584c Apply method docs collapse to all impl-items sections 2018-09-05 23:25:28 +02:00
Guillaume Gomez
1d79d8be56 Fix source automatic scroll 2018-08-27 21:51:56 +02:00
Guillaume Gomez
9c20f06f73
Rollup merge of #53626 - kzys:hashchange, r=GuillaumeGomez
Automatically expand a section even after page load

Fixes #52774
2018-08-26 12:05:25 +02:00
Guillaume Gomez
a00706a3b9 Add collapser for associated const 2018-08-25 15:30:47 +02:00
Kazuyoshi Kato
2c61f3ce9e Expand a collapsed element on onclick
Doing the expansion on onhashchange seems too late.

Fixes #48726
2018-08-25 03:36:17 -07:00
bors
f87d9135b4 Auto merge of #53577 - GuillaumeGomez:rustdoc-substring-search, r=QuietMisdreavus
Search a substring instead of start of string in rustdoc search

Fixes #49762.

r? @QuietMisdreavus
2018-08-25 02:40:14 +00:00
Kazuyoshi Kato
1f441a0905 Check null-able variables before using them 2018-08-23 08:15:23 -07:00
Kazuyoshi Kato
917cdd295d Automatically expand a section even after page load
Fixes #52774
2018-08-23 00:45:43 -07:00
Guillaume Gomez
e87b4b3100 Search a substring instead of start of string in rustdoc search 2018-08-22 00:21:08 +02:00
Jack O'Connor
207550981f restore the page title after escaping out of a search 2018-08-15 23:05:52 -04:00
Guillaume Gomez
e37391b389 Remove unwanted console log 2018-08-10 18:48:36 +02:00
Guillaume Gomez
c70eb4b6ea Automatically expand section if url id point to one of its component 2018-08-05 19:44:10 +02:00
Guillaume Gomez
2462cdb71d Fix trait item doc setting, add new setting, start hiding elements by default and then showing them up 2018-08-02 00:19:04 +02:00
bors
11864c4e6c Auto merge of #51854 - davidtwco:rfc-2008-rustdoc, r=QuietMisdreavus
RFC 2008 non-exhaustive enums/structs: Rustdoc

Part of #44109. Not sure how those who maintain rustdoc primarily would prefer this addition look or where it should be placed, happy to make any changes required.

r? @QuietMisdreavus (not sure if this is the right person, just guessing)
2018-07-19 19:03:03 +00:00
David Wood
959a13d53e
Updated wording and placement of non-exhaustive notice so it is collapsed by default and easier to understand. 2018-07-18 20:27:25 +01:00
Guillaume Gomez
c0ec5d5e44 Add setting to prevent doc auto-hide of trait implementations 2018-07-08 15:07:06 +02:00
Guillaume Gomez
115df57757 reduce search-index size 2018-06-30 16:28:25 +02:00
Guillaume Gomez
e3b258324b Remove unused variable 2018-06-25 21:47:44 +02:00
Guillaume Gomez
f4ea46a5b3 Extend collision prevention to every type 2018-06-18 21:39:54 +02:00
Guillaume Gomez
afeb790ea1 Fix macro missing from doc search 2018-06-16 14:14:18 +02:00
Guillaume Gomez
e28502edca Fix search fn keyword 2018-06-15 23:23:25 +02:00
kennytm
ca65a5e485
Don't auto-hide inherent impls even if rustdoc-collapse == true. 2018-06-13 18:00:18 +08:00
Guillaume Gomez
ebee483e24 Add doc keyword support 2018-06-04 09:51:41 +02:00
Guillaume Gomez
26ad95c9d4 Add attributes for trait and methods as well 2018-06-02 23:26:46 +02:00
Guillaume Gomez
c7312fbae4 Fixes some style issues in rustdoc "implementations on Foreign types" 2018-05-30 01:12:23 +02:00
Guillaume Gomez
934e37aeb4
Rollup merge of #50632 - GuillaumeGomez:minification, r=ollie27
Add minification process

r? @QuietMisdreavus
2018-05-15 14:26:59 +02:00
Guillaume Gomez
f0db2cf14e Use fullpath instead of recreating it 2018-05-12 23:44:40 +02:00
Guillaume Gomez
f2bc09e68b Fix invalid deduplication 2018-05-12 19:16:37 +02:00
Guillaume Gomez
8fab482a68 Fix items counts in search results 2018-05-12 19:16:37 +02:00
Guillaume Gomez
6a4bdda87b Reduce js files size 2018-05-12 19:16:37 +02:00
Guillaume Gomez
72b7c8d291 Remove extra span tags 2018-05-12 19:16:37 +02:00
Guillaume Gomez
e81b59bba8 Improve alias rendering 2018-05-12 19:16:37 +02:00
Guillaume Gomez
cf9209f872 Improve results 2018-05-12 19:16:37 +02:00
Guillaume Gomez
4b14573d50 Add minification process 2018-05-12 19:15:06 +02:00
Guillaume Gomez
d0840fd63b Fix paths search 2018-05-05 12:44:10 +02:00
Guillaume Gomez
135ee85aba Rename "show type declaration" to "show declaration" 2018-04-30 22:32:17 +02:00
Guillaume Gomez
acf0adf798 Add setting to go to item if there is only one result 2018-04-26 19:53:21 +02:00
Guillaume Gomez
ac0f99c03f Some JS improvements 2018-04-25 09:01:32 +02:00
Guillaume Gomez
f33af5c4de fix search bar bug 2018-04-23 23:55:36 +02:00
bors
28193e873c Auto merge of #49954 - GuillaumeGomez:doc-settings, r=ollie27,QuietMisdreavus
Add rustdoc settings menu

Fixes #18167.

r? @QuietMisdreavus
2018-04-22 11:04:41 +00:00
Guillaume Gomez
d0e2d26ceb remove unused condition 2018-04-21 22:02:54 +02:00
Guillaume Gomez
ca3213c338 fix invalid items removal 2018-04-21 22:02:54 +02:00
Guillaume Gomez
03b0856849 Add aliases in the search as well 2018-04-21 22:02:53 +02:00
Guillaume Gomez
654cb84852 Add specific never search 2018-04-21 22:01:38 +02:00
Guillaume Gomez
f2ad3c3f6c Add rustdoc settings menu 2018-04-17 23:35:43 +02:00
Guillaume Gomez
47a9ffa573 Add multi-query search 2018-04-14 17:01:28 +02:00
Guillaume Gomez
238583a50f Fix anchors issue when everything is collapsed 2018-04-04 16:16:53 +02:00
bors
15e8c5d846 Auto merge of #49412 - GuillaumeGomez:hide-type-decl, r=QuietMisdreavus
Hide type declarations by default

I'm not very happy for the moment about the rendering but the bases are here:

<img width="610" alt="screen shot 2018-03-27 at 11 56 27" src="https://user-images.githubusercontent.com/3050060/37960492-0e045954-31b6-11e8-9cea-1ef8a3f980c4.png">

r? @QuietMisdreavus
2018-03-30 01:45:54 +00:00
kennytm
1a89250356
Rollup merge of #49439 - GuillaumeGomez:trait-impl-collapse, r=QuietMisdreavus
Fix trait implementation not collapsing docs

r? @QuietMisdreavus
2018-03-28 17:55:16 +02:00
kennytm
611ceef28d
Rollup merge of #49429 - GuillaumeGomez:fix-collapse-toggle-insertion, r=QuietMisdreavus
Fix collapse toggle insertions on impl with docs

Just went through this one randomly... When an impl has docs, the collapse toggle isn't generated. This fixes it.

r? @QuietMisdreavus
2018-03-28 17:55:14 +02:00
Guillaume Gomez
884153a257 Fix trait implementation not collapsing docs 2018-03-28 09:51:18 +02:00
Guillaume Gomez
8be26a2ca0 Fix collapse toggle insertions on impl with docs 2018-03-27 22:49:55 +02:00
Guillaume Gomez
73b97c7e7c Hide type declarations by default 2018-03-27 11:57:00 +02:00
Guillaume Gomez
96ef2f8ab9 Fix search appearance 2018-03-27 10:33:31 +02:00
Guillaume Gomez
90588a9086 Fix IE11 search 2018-03-23 21:27:15 +01:00
Guillaume Gomez
5581aa8eeb Fix events handling in rustdoc 2018-03-18 16:32:41 +01:00
kennytm
15d71d3285
Rollup merge of #48631 - focusaurus:remember-collapse-setting, r=QuietMisdreavus
Remember state of top-level collapse toggle widget

This change allows the big top-right expand/collapse toggle to remember its setting across navigation or page reloads. Prior to this change, there was this annoyance:

- browse to some docs
- Click the minus button to collapse them
- browse to other docs (or reload the page)
- Everything is expanded again

The solution is based on storing a simple boolean flag in localStorage. I think it's a good improvement, but it does introduce the following potentially surprising behavior:

- browse to some docs
- click the minus button to collapse them
- click to expand a particular item (not the main top-right big one)
- reload the page, everything is collapsed

Paired with @debugsteven on this.
2018-03-13 05:01:15 +08:00
Guillaume Gomez
9e0ccc5a47 Fix escape not working when searchbar selected 2018-03-09 17:45:44 +01:00
Guillaume Gomez
6235ef0422 Add missing items in the sidebar for functions 2018-03-09 17:45:44 +01:00
Guillaume Gomez
a628543891 Don't generate '[+]'/'[-]' on 'empty' traits 2018-03-05 23:39:34 +01:00
Peter Lyons
2dd81c86c5 Rename doc collapse sentinal to rustdoc-collapse 2018-03-01 02:50:32 -07:00
Peter Lyons
55cc9a4336 Remember state of top-level collapse toggle widget 2018-03-01 00:03:47 -07:00
kennytm
71ce38eb9e
Rollup merge of #48381 - GuillaumeGomez:rustdoc-theme-securities, r=QuietMisdreavus
Rustdoc theme securities

Fixes #48375.
Fixes #48376.

r? @steveklabnik
cc @QuietMisdreavus
2018-02-28 19:15:31 +08:00
bors
89e5a0796e Auto merge of #47894 - vi:rustdoc_foldable_impls, r=GuillaumeGomez,QuietMisdreavus
rustdoc: Foldable impl blocks

Addresses #40363, #45720, #24483, #23986 and so on

* Expands and refactors collapseDocs and toggleAllDocs
* Adds [-] toggle to all impls (including inherent impl)
* Makes it hiding though main css file, not though element inline style

May need to be addressed:

* "[-]" and anchor link copier are overlaid a bit
* Inherent methods are also hidden by the global [-] toggle.
* Auto-collapsing "Iterator" and so on by default is not implemented yet
* Tested only shallowly and only in Chromiuim
* No tests. Are there tests for css/js part here?
* The new implementation may be a bit slower.

What next steps are need to be done before the integration?
2018-02-28 04:24:18 +00:00
Guillaume Gomez
5b61b615f5 Allow to not switch to a theme if it doesn't exist 2018-02-20 20:11:58 +01:00
Aaron Hill
64a1f6fbfd
Fix inlining 2018-02-18 16:29:25 -05:00
Aaron Hill
1531fbe9be
Cleanup formatting 2018-02-18 16:29:25 -05:00
Aaron Hill
6728f21d85
Generate documentation for auto-trait impls
A new section is added to both both struct and trait doc pages.

On struct/enum pages, a new 'Auto Trait Implementations' section displays any
synthetic implementations for auto traits. Currently, this is only done
for Send and Sync.

On trait pages, a new 'Auto Implementors' section displays all types
which automatically implement the trait. Effectively, this is a list of
all public types in the standard library.

Synthesized impls for a particular auto trait ('synthetic impls') take
into account generic bounds. For example, a type 'struct Foo<T>(T)' will
have 'impl<T> Send for Foo<T> where T: Send' generated for it.

Manual implementations of auto traits are also taken into account. If we have
the following types:

'struct Foo<T>(T)'
'struct Wrapper<T>(Foo<T>)'
'unsafe impl<T> Send for Wrapper<T>' // pretend that Wrapper<T> makes
this sound somehow

Then Wrapper will have the following impl generated:
'impl<T> Send for Wrapper<T>'
reflecting the fact that 'T: Send' need not hold for 'Wrapper<T>: Send'
to hold

Lifetimes, HRTBS, and projections (e.g. '<T as Iterator>::Item') are
taken into account by synthetic impls

However, if a type can *never* implement a particular auto trait
(e.g. 'struct MyStruct<T>(*const T)'), then a negative impl will be
generated (in this case, 'impl<T> !Send for MyStruct<T>')

All of this means that a user should be able to copy-paste a synthetic
impl into their code, without any observable changes in behavior
(assuming the rest of the program remains unchanged).
2018-02-18 16:29:24 -05:00
Guillaume Gomez
e9bcb4eb89 Hide theme button under menu in mobile mode and fix top margin issue (in mobile too) 2018-02-08 23:47:49 +01:00
Guillaume Gomez
dde3611281 Fix rendering issues on mobile 2018-02-03 13:13:29 +01:00
Vitaly _Vi Shukela
28efcfc083
rustdoc: Fix erroneous collapsing of second+ inherent impl. 2018-02-01 17:07:43 +03:00
Vitaly _Vi Shukela
a3acd10297
rustdoc: Auto-collapse all non-inherent impls 2018-02-01 16:53:29 +03:00
Vitaly _Vi Shukela
c904b1bef4
rustdoc: Fix some minor issues per reviewer 2018-01-31 17:35:57 +03:00
Vitaly _Vi Shukela
7cd0280226
rustdoc: Fix tidy errors found by travis 2018-01-31 04:02:51 +03:00
Vitaly _Vi Shukela
73f52d3d8f
rustdoc: Foldable impl blocks
Addresses #40363, #45720, #24483, #23986 and so on

* Expands and refactors collapseDocs and toggleAllDocs
* Adds [-] toggle to all impls (including inherent impl)
* Makes it hiding though main css file, not though element style

May need to be addressed:

* "[-]" and anchor link copier are overlaid a bit
* Inherent methods are also hidden by the global [-] toggle.
* Auto-collapsing "Iterator" and so on by default is not implemented yet
* Tested only shallowly and only in Chromiuim
* No tests. Are there tests for css/js part here?
* The new implementation may be a bit slower.
2018-01-31 03:48:16 +03:00
bors
4e3901d35f Auto merge of #47678 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

- Successful merges: #47423, #47425, #47440, #47541, #47549, #47554, #47558, #47610, #47635, #47655, #47661, #47662, #47667, #47672
- Failed merges:
2018-01-23 16:13:18 +00:00
Guillaume Gomez
7cc3cb29bd Fix quoted search 2018-01-22 22:49:44 +01:00
Guillaume Gomez
003b2bc1c6 Add possibility to have multiple themes 2018-01-21 17:34:55 +01:00
Guillaume Gomez
53d8ec0ecb Prepare main.js for tests 2018-01-12 22:51:34 +01:00
Guillaume Gomez
eea860f84c Fix search bar defocus 2018-01-05 01:14:10 +01:00
Johannes Boczek
3153d23bb7 Indentation fix
Fixed intentaion (tabs -> spaces)
Added trailing newline
2018-01-02 19:58:06 +01:00
Johannes Boczek
0772b6faed Defocus search bar in rustdoc pages
Escape now removes focus from the search bar
2018-01-02 19:47:44 +01:00
Guillaume Gomez
7f5c2f9249 Fix sidebar on ios 2017-12-20 01:53:18 +01:00
Guillaume Gomez
25e5af8a27 Rollup merge of #46824 - GuillaumeGomez:doc-sidebar, r=QuietMisdreavus
Fix dynamic crates listing in doc sidebar

Fixes #46687.

r? @QuietMisdreavus
2017-12-18 23:08:40 +01:00
Guillaume Gomez
cf18b1f22a Fix dynamic crates listing in doc sidebar 2017-12-18 21:15:46 +01:00
Guillaume Gomez
97c18f420e Improve results a bit 2017-12-15 15:42:38 +01:00
Guillaume Gomez
6351ebb7e5 make doc search more relevant 2017-12-15 14:44:49 +01:00
Guillaume Gomez
557236c508 Fix type filter in rustdoc js 2017-12-12 00:19:36 +01:00
Guillaume Gomez
423e5ac6f3 Fix JS errors 2017-12-07 22:55:14 +01:00
Guillaume Gomez
71b70feb1f Greatly improve sidebar when width < 700px 2017-12-07 22:42:46 +01:00
bors
bb1bd88ec3 Auto merge of #46221 - GuillaumeGomez:doc-script-load-speedup, r=nrc
Speedup search loading when search url is received

Fixes #45971.

r? @nrc

cc @rust-lang/docs
2017-12-07 09:47:01 +00:00
bors
d10b04d3df Auto merge of #45898 - JRegimbal:master, r=QuietMisdreavus
Change "Types/modules" title of search tab to be more accurate

From issue #45787. Used "In name" as per suggestion from @Seeker14491.
2017-12-06 03:02:17 +00:00
JRegimbal
41df62ce29 Changed tab names to those agreed upon.
Tabs are "In Names", "In Parameters", and "In Return Types".
2017-12-05 17:39:50 -05:00
Guillaume Gomez
30734c4e68 Fix deduplication of items 2017-12-01 20:55:25 +01:00
Guillaume Gomez
0a1219809d Fix global search 2017-11-26 13:13:14 +01:00
bors
ca8ef26293 Auto merge of #46081 - GuillaumeGomez:fix-path-search, r=QuietMisdreavus
Fix path search

Fixes #46015.

r? @QuietMisdreavus
2017-11-25 02:43:48 +00:00
Guillaume Gomez
de3a291455 Speedup search loading when search url is received 2017-11-23 21:19:48 +01:00
bors
421a2113a8 Auto merge of #45039 - QuietMisdreavus:doc-spotlight, r=GuillaumeGomez,QuietMisdreavus
show in docs whether the return type of a function impls Iterator/Read/Write

Closes #25928

This PR makes it so that when rustdoc documents a function, it checks the return type to see whether it implements a handful of specific traits. If so, it will print the impl and any associated types. Rather than doing this via a whitelist within rustdoc, i chose to do this by a new `#[doc]` attribute parameter, so things like `Future` could tap into this if desired.

### Known shortcomings

~~The printing of impls currently uses the `where` class over the whole thing to shrink the font size relative to the function definition itself. Naturally, when the impl has a where clause of its own, it gets shrunken even further:~~ (This is no longer a problem because the design changed and rendered this concern moot.)

The lookup currently just looks at the top-level type, not looking inside things like Result or Option, which renders the spotlights on Read/Write a little less useful:

<details><summary>`File::{open, create}` don't have spotlight info (pic of old design)</summary>

![image](https://user-images.githubusercontent.com/5217170/31209495-e59d027e-a950-11e7-9998-ceefceb71c07.png)

</details>

All three of the initially spotlighted traits are generically implemented on `&mut` references. Rustdoc currently treats a `&mut T` reference-to-a-generic as an impl on the reference primitive itself. `&mut Self` counts as a generic in the eyes of rustdoc. All this combines to create this lovely scene on `Iterator::by_ref`:

<details><summary>`Iterator::by_ref` spotlights Iterator, Read, and Write (pic of old design)</summary>

![image](https://user-images.githubusercontent.com/5217170/31209554-50b271ca-a951-11e7-928b-4f83416c8681.png)

</details>
2017-11-21 03:03:28 +00:00
Guillaume Gomez
c00eaa9969 Strongly improve search path 2017-11-20 21:54:27 +01:00
Guillaume Gomez
ad6324f6f7 Fix path search in docs 2017-11-19 12:14:56 +01:00
Guillaume Gomez
6047a03659 Add tooltip for important traits display 2017-11-18 14:37:10 +01:00
bors
18250b0349 Auto merge of #46073 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 4 pull requests

- Successful merges: #45767, #46044, #46066, #46071
- Failed merges:
2017-11-18 11:38:06 +00:00
Guillaume Gomez
85dcf2ecb6 Improve modal display and add JS events 2017-11-17 22:50:15 +01:00
Guillaume Gomez
aca1bd7d7e First step for important traits UI 2017-11-17 22:50:15 +01:00
QuietMisdreavus
cbe4ac3079 spotlight Iterator/Read/Write impls on function return types 2017-11-17 22:50:15 +01:00
Guillaume Gomez
955c054ab1 Fix primitive types not showing up 2017-11-17 22:33:02 +01:00
kennytm
2792b56a92
Support extern type in rustdoc.
Fixes #45640.
2017-11-15 18:20:28 +08:00
JRegimbal
42ae3dc45e "Types/modules" in tab to "In name"
"Types/modules" doesn't properly describe the results since it includes
other things whose name matches the search term.
2017-11-13 11:13:06 -05:00
Guillaume Gomez
0e4c829f2b Add "As parameters" items as well 2017-11-12 21:38:24 +01:00
Guillaume Gomez
5c5ab0d1fb Improve result output 2017-11-12 21:38:24 +01:00
Guillaume Gomez
6514f44bd1 Big JS optimization 2017-11-12 21:38:23 +01:00
Guillaume Gomez
c96be6f4cb Add elements count in tab search title 2017-11-12 21:38:23 +01:00