Finished property code formatting in full property function page.
This commit is contained in:
parent
4cb120d60b
commit
b6cc0eccb6
|
@ -58,4 +58,5 @@ Wgt
|
|||
attrs
|
||||
SysRq
|
||||
numlock
|
||||
'docblock'
|
||||
docblock
|
||||
ffn
|
|
@ -1,6 +1,6 @@
|
|||
// Script inserted in each property function's full page after the user docs.
|
||||
// It changes the page to highlight the widget property aspects.
|
||||
(function () {
|
||||
function property(capture_only) {
|
||||
|
||||
// change title.
|
||||
let title = document.getElementsByTagName('h1')[0];
|
||||
|
@ -15,7 +15,15 @@
|
|||
fn.innerText = fn.innerText
|
||||
.replace(/.*fn /s, '')
|
||||
.replace(/(?!<[^>]*)\((?![^<]*>)\s*/s, ': {\n ')
|
||||
.replace(/(?!<[^>]*)\s*\)\s+->(?![^<]*>).*/s, '\n}');
|
||||
.replace(/(?!<[^>]*)\s*\)\s+->(?![^<]*>).*/s, '}')
|
||||
.replace(/,\s*/sg, ', ');
|
||||
|
||||
if (!capture_only) {
|
||||
fn.innerText = fn.innerText.replace(/(.*?: {\n {4})((?!<[^>]*).*?, (?![^<]*>))(.*)/s, '$1$3');
|
||||
}
|
||||
|
||||
fn.innerText = fn.innerText.replace(/(?!<[^>]*),\s*(?![^<]*>)/gs, ',\n ').replace(/\s*}/s, '\n}');
|
||||
|
||||
let set = new Set();
|
||||
for (let a of ffn.getElementsByTagName('a')) {
|
||||
if (!set.has(a.innerText)) {
|
||||
|
@ -23,5 +31,4 @@
|
|||
set.add(a.innerText)
|
||||
}
|
||||
}
|
||||
|
||||
})()
|
||||
}
|
|
@ -449,6 +449,7 @@ mod analysis {
|
|||
inline: attrs.inline,
|
||||
cfg: attrs.cfg.clone(),
|
||||
attrs: attrs.others,
|
||||
is_capture_only: args.priority.is_capture_only(),
|
||||
},
|
||||
types: output::OutputTypes {
|
||||
cfg: attrs.cfg.clone(),
|
||||
|
@ -588,6 +589,7 @@ mod output {
|
|||
pub inline: Option<Attribute>,
|
||||
pub cfg: Option<Attribute>,
|
||||
pub attrs: Vec<Attribute>,
|
||||
pub is_capture_only: bool,
|
||||
}
|
||||
|
||||
impl ToTokens for OutputAttributes {
|
||||
|
@ -606,7 +608,12 @@ mod output {
|
|||
/// the other inputs are the property arguments. The function output is a new [`UiNode`](crate::core::UiNode) that
|
||||
/// includes the property behavior.
|
||||
});
|
||||
doc_extend!(tokens, "<script>{}</script>", js!("property_full.js"));
|
||||
doc_extend!(
|
||||
tokens,
|
||||
"<script>{}property({})</script>",
|
||||
js!("property_full.js"),
|
||||
self.is_capture_only
|
||||
);
|
||||
self.inline.to_tokens(tokens);
|
||||
self.cfg.to_tokens(tokens);
|
||||
for attr in &self.attrs {
|
||||
|
|
Loading…
Reference in New Issue