summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
AgeCommit message (Collapse)AuthorLines
2014-06-26Remove unnecessary to_string callsPiotr Jawniak-2/+1
This commit removes superfluous to_string calls from various places
2014-06-18Deprecate the bytes!() macro.Simon Sapin-2/+2
Replace its usage with byte string literals, except in `bytes!()` tests. Also add a new snapshot, to be able to use the new b"foo" syntax. The src/etc/2014-06-rewrite-bytes-macros.py script automatically rewrites `bytes!()` invocations into byte string literals. Pass it filenames as arguments to generate a diff that you can inspect, or `--apply` followed by filenames to apply the changes in place. Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-13rustdoc: Larger click areas for sidebar itemsValentin Tsatskin-1/+1
* Change links to display:block for click larger targets * Remove linebreaks due to extra space * Adjust margins so that element spacing stays the same * Sidebar item hover background colour chosen from <pre> styling
2014-06-11std: Remove i18n/l10n from format!Alex Crichton-32/+28
* The select/plural methods from format strings are removed * The # character no longer needs to be escaped * The \-based escapes have been removed * '{{' is now an escape for '{' * '}}' is now an escape for '}' Closes #14810 [breaking-change]
2014-06-11sync: Move underneath libstdAlex Crichton-1/+1
This commit is the final step in the libstd facade, #13851. The purpose of this commit is to move libsync underneath the standard library, behind the facade. This will allow core primitives like channels, queues, and atomics to all live in the same location. There were a few notable changes and a few breaking changes as part of this movement: * The `Vec` and `String` types are reexported at the top level of libcollections * The `unreachable!()` macro was copied to libcore * The `std::rt::thread` module was moved to librustrt, but it is still reexported at the same location. * The `std::comm` module was moved to libsync * The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`. It is now a private module with types/functions being reexported under `sync::comm`. This is a breaking change for any existing users of duplex streams. * All concurrent queues/deques were moved directly under libsync. They are also all marked with #![experimental] for now if they are public. * The `task_pool` and `future` modules no longer live in libsync, but rather live under `std::sync`. They will forever live at this location, but they may move to libsync if the `std::task` module moves as well. [breaking-change]
2014-06-06rustdoc: Submit examples to play.rust-lang.orgAlex Crichton-2/+13
This grows a new option inside of rustdoc to add the ability to submit examples to an external website. If the `--markdown-playground-url` command line option or crate doc attribute `html_playground_url` is present, then examples will have a button on hover to submit the code to the playground specified. This commit enables submission of example code to play.rust-lang.org. The code submitted is that which is tested by rustdoc, not necessarily the exact code shown in the example. Closes #14654
2014-06-06Rename Iterator::len to countAaron Turon-1/+1
This commit carries out the request from issue #14678: > The method `Iterator::len()` is surprising, as all the other uses of > `len()` do not consume the value. `len()` would make more sense to be > called `count()`, but that would collide with the current > `Iterator::count(|T| -> bool) -> unit` method. That method, however, is > a bit redundant, and can be easily replaced with > `iter.filter(|x| x < 5).count()`. > After this change, we could then define the `len()` method > on `iter::ExactSize`. Closes #14678. [breaking-change]
2014-06-06rustdoc: Inline static documentation across cratesAlex Crichton-2/+3
2014-06-05Fallout from the libcollections movementAlex Crichton-1/+1
2014-06-03rustdoc: Put primitives in respective modulesAlex Crichton-14/+21
The logical location for the documentation of a primitive is in the module that declared it was a module for that primitive.
2014-06-02rustdoc: Deduplicate lists of implementorsAlex Crichton-0/+7
Inlining caused implementors to show up multiple times. cc #14584
2014-05-31rustdoc: Fix cross-crate links to reexported itemsAlex Crichton-19/+64
Cross crate links can target items which are not rendered in the documentation. If the item is reexported at a higher level, the destination of the link (a concatenation of the fully qualified name) may actually lead to nowhere. This fixes this problem by altering rustdoc to emit pages which redirect to the local copy of the reexported structure. cc #14515 Closes #14137
2014-05-31doc: Fix a number of broken linksAlex Crichton-4/+9
cc #14515
2014-05-31rustdoc: Create anchor pages for primitive typesAlex Crichton-32/+101
This commit adds support in rustdoc to recognize the `#[doc(primitive = "foo")]` attribute. This attribute indicates that the current module is the "owner" of the primitive type `foo`. For rustdoc, this means that the doc-comment for the module is the doc-comment for the primitive type, plus a signal to all downstream crates that hyperlinks for primitive types will be directed at the crate containing the `#[doc]` directive. Additionally, rustdoc will favor crates closest to the one being documented which "implements the primitive type". For example, documentation of libcore links to libcore for primitive types, but documentation for libstd and beyond all links to libstd for primitive types. This change involves no compiler modifications, it is purely a rustdoc change. The landing pages for the primitive types primarily serve to show a list of implemented traits for the primitive type itself. The primitive types documented includes both strings and slices in a semi-ad-hoc way, but in a way that should provide at least somewhat meaningful documentation. Closes #14474
2014-05-31rustdoc: Show all implementors of traitsAlex Crichton-55/+37
When inlining documentation across crates, primitive implementors of traits were not shown. This commit tweaks the infrastructure to treat primitive and Path-like impls the same way, displaying all implementors everywhere. cc #14462
2014-05-31rustdoc: Freeze the cache ASAPAlex Crichton-6/+9
The cache is going to be used earlier in the HTML generation process, which means that it needs to get into TLS as soon as possible.
2014-05-31rustdoc: Refactor structure of html::runAlex Crichton-166/+179
Instead of one giant function, this breaks it up into several smaller functions which have explicit dependencies among one another. There are no code changes as a result of this commit.
2014-05-28std: Remove format_strbuf!()Alex Crichton-5/+5
This was only ever a transitionary macro.
2014-05-28rustdoc: cross-crate source links are one level lower.Huon Wilson-2/+2
Previously this was adding one-too-many `..`s to the path for the `gotosrc=...` links for local crates. Also, the `root_path` already ends in `/`s so a trailing / shouldn't be added after the root (some servers treat `...//...` different to `.../...` including the one running doc.rust-lang.org).
2014-05-27rustdoc: Only link to local inlined foreign itemsAlex Crichton-0/+6
This commit alters rustdoc to keep a hash set of known inlined items which is a whitelist for generating URLs to. Closes #14438
2014-05-27std: Rename strbuf operations to stringRicho Healey-19/+19
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-3/+3
2014-05-25rustdoc: Move inlining to its own moduleAlex Crichton-5/+34
2014-05-25rustdoc: Get [src] links working for inlined doxAlex Crichton-20/+51
These links work by hyperlinking back to the actual documentation page with a query parameter which will be recognized and then auto-click the appropriate [src] link.
2014-05-25rustdoc: Link to local reexportations of itemsAlex Crichton-0/+1
Within the documentation for a crate, all hyperlinks to reexported items don't go across crates, but rather to the items in the crate itself. This will allow references to Option in the standard library to link to the standard library's Option, instead of libcore's. This does mean that other crate's links for Option will still link to libcore's Option.
2014-05-25rustdoc: Start inlining structs across cratesAlex Crichton-6/+4
2014-05-25rustdoc: Inline documentation of `pub use`Alex Crichton-35/+27
This commit teaches rustdoc to inline the documentation for the destination of a `pub use` statement across crate boundaries. This is intended for the standard library's facade to show the fact that the facade is just an implementation detail rather than the api of the standard library itself. This starts out by inlining traits and functions, but more items will come soon. The current drawback of this system is that hyperlinks across crates sill go to the original item's definition rather than the reexported location.
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-27/+27
[breaking-change]
2014-05-24Port more stuff to mark used attributesSteven Fackler-2/+2
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-2/+2
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-4/+7
2014-05-22rustdoc: Fill in external trait methodsAlex Crichton-66/+65
This commit alters rustdoc to crawl the metadata of upstream libraries in order to fill in default methods for traits implemented in downstream crates. This, for example, documents the `insert` function on hash maps. This is a fairly lossy extraction from the metadata. Documentation and attributes are lost, but they aren't used anyway. Unfortunately, argument names are also lost because they are not present in the metadata. Source links are also lost because the spans are not serialized. While not perfect, it appears that presenting this documentation through rustdoc is much better than nothing, so I wanted to land this to allow iteration on it later on.
2014-05-21rustdoc: Show types for traits across cratesAlex Crichton-22/+91
Right now, when you look in the "Implementors" section for traits, you only see implementors within that crate. This commit modifies that section to include implementors from neighboring crates as well. For example, the Container trait currently says that it is only implemented by strings and slices, but it is in fact implemented by nearly all containers. Implementation-wise, this change generates an "implementors cache" similarly to the search index where each crate will append implementors to the files. When the page for a trait is loaded, it will load its specific cache file, rendering links for all upstream types which implement the trait.
2014-05-15Updates with core::fmt changesAlex Crichton-61/+60
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-12rustdoc: List macros in the sidebarSeo Sanghyeon-0/+1
2014-05-12librustdoc: Remove all `~str` usage from librustdoc.Patrick Walton-59/+79
2014-05-10auto merge of #14068 : alexcrichton/rust/rustdoc-xcrate-links, r=brsonbors-26/+62
This should improve the libcore experience quite a bit when looking at the libstd documentation.
2014-05-09rustdoc: Hyperlink cross-crate reexportsAlex Crichton-26/+62
This should improve the libcore experience quite a bit when looking at the libstd documentation.
2014-05-08Handle breakage after libcore splitKevin Ballard-1/+2
API Changes: - &[T] and ~[T] no longer support the addition operator (+)
2014-05-07std: Modernize the local_data apiAlex Crichton-82/+72
This commit brings the local_data api up to modern rust standards with a few key improvements: * The `pop` and `set` methods have been combined into one method, `replace` * The `get_mut` method has been removed. All interior mutability should be done through `RefCell`. * All functionality is now exposed as a method on the keys themselves. Instead of importing std::local_data, you now use "key.replace()" and "key.get()". * All closures have been removed in favor of RAII functionality. This means that get() and get_mut() no long require closures, but rather return Option<SmartPointer> where the smart pointer takes care of relinquishing the borrow and also implements the necessary Deref traits * The modify() function was removed to cut the local_data interface down to its bare essentials (similarly to how RefCell removed set/get). [breaking-change]
2014-05-03rustdoc: Turn the noise down on implemented traitsAlex Crichton-37/+7
This commit removes the inherited documentation from type pages. This generally just clutters up the page when you can click through to the trait itself to get all the meaty documentation. Closes #11991
2014-05-03rustdoc: Make static initalizers prettierAlex Crichton-24/+29
Previously, if an initializer took multiple lines or was just large in general, it was pretty poorly rendered [1] [2]. This alters the logic to just link back to the source for any multi-line static, with a placeholder of "[definition]". This should make reading statics a little easier on the eyes. All single-line statics are still inlined in the documentation. Closes #13198 [1] - http://static.rust-lang.org/doc/master/sync/mutex/index.html#statics [2] - http://static.rust-lang.org/doc/master/std/sync/atomics/index.html#statics
2014-05-03rustdoc: Fix inclusion of the new fontsAlex Crichton-6/+16
These fonts were moved into place by rust's makefiles, but rustdoc is widely used outside of rustc itself. This moves the fonts into the rustdoc binary, similarly to the other static assets, and writes them to the output location whenever rustdoc generates documentation. Closes #13593 Closes #13787
2014-04-29auto merge of #13776 : adrientetar/rust/rustdoc-fix, r=brsonbors-1/+1
- Closes #13591. Relevant example: http://adrientetar.legtux.org/cached/rust-docs/struct.CChars.htm (Had to use `!important` to override CSS selector precedence, namely matching over parent class.) - Implement changes from #13780 feedback, namely: * Changed font-size from 18px to 15px * Reintroduced gray background for code samples * Tightened up the margins - Fix point 1 and point 4 of #13804. Samples: - [enum.FileType](http://adrientetar.legtux.org/cached/rust-docs/enum.FileType.htm) - [struct.CChars](http://adrientetar.legtux.org/cached/rust-docs/struct.CChars.htm) - [std](http://adrientetar.legtux.org/cached/rust-docs/std.htm) - [std::io](http://adrientetar.legtux.org/cached/rust-docs/io.htm). r? @brson
2014-04-26auto merge of #13777 : lifthrasiir/rust/no-multi-viewitemuse, r=alexcrichtonbors-6/+4
It reflected the obsolete syntax `use a, b, c;` and did not make past the parser (though it was a non-fatal error so we can continue). This legacy affected many portions of rustc and rustdoc as well, so this PR cleans them up altogether. As a side effect of cleanup, we now have `SCHEMA_VERSION` in `rustdoc::clean` (instead of the crate root), so it has a better chance to be updated when `rustdoc::clean` gets updated.
2014-04-26syntax: ViewItemUse no longer contains multiple view paths.Kang Seonghoon-6/+4
it reflected the obsolete syntax `use a, b, c;` and did not make past the parser (though it was a non-fatal error so we can continue). this legacy affected many portions of rustc and rustdoc as well, so this commit cleans them up altogether.
2014-04-26rustdoc: refactor and unstyle inline section headersAdrien Tétar-1/+1
2014-04-25rustdoc: bring it inlineAdrien Tétar-13/+15
2014-04-21auto merge of #13587 : adrientetar/rust/more-docs, r=brsonbors-1/+1
- Use Fira Sans for headlines, Heuristica for the body (Adobe Utopia derivative). Both are licensed under the SIL OFL license. (I didn't include BoldItalic because it is sparingly used.) - Split TOC into 2 columns for the docs except manual (too tall, too wide to be readable). - Some fixes to rustdoc, bring styles in coherency with eachother - A few tweaks Two examples: [modified tutorial](http://adrientetar.legtux.org/cached/rust-docs/tutorial.htm) and [modified manual](http://adrientetar.legtux.org/cached/rust-docs/manual.htm). Rustdoc got some fixes, here is [modified `enum.FileType`](http://adrientetar.legtux.org/cached/rust-docs/enum.FileType.htm), [modified `std`](http://adrientetar.legtux.org/cached/rust-docs/std.htm) and [modified `std::io`](http://adrientetar.legtux.org/cached/rust-docs/io.htm). #13484, #13485 follow-up. cc @brson
2014-04-20rustdoc: Display tuple structs correctlyAlex Crichton-12/+32
The fields of tuple structs recently gained the ability to have privacy associated with them, but rustdoc was not updated accodingly. This moves the struct field filtering to the rendering phase in order to preserve the ordering of struct fields to allow tuple structs to have their private fields printed as underscores. Closes #13594