I'd like to use the Mediawiki SpecialPage class on a page in my customized "Data:" namespace.
The MediaWiki Manual on Special Pages states:
The general form is "Special:Pagename" where both "Special" and
"Pagename" are customizable. The Special pseudo namespace can be
translated in other languages. This translated namespace can be
produced with the wikitext {{ns:special}}, on this wiki giving
"Special". The name of the special page can also be redefined in a
system message, for the site language, with the generic name of the
special page as the ID.
This reads to me like the "Special" namespace is only customizable to accommodate use in other languages. In other words, the Special namespace itself will change rather than choosing a different namespace for a specific page.
Is that correct, or is there a way I can in fact include the SpecialPage class in another namespace?
Indeed, SpecialPage is for its particular namespace. To combine content with UI, look towards the Content / ContentHandler combination.
Related
What does _ and / mean in HTML? I am trying to add an image to my site and would like to know what those functions do?
I've tried looking through google for the answer.
(I initially wrote this answer thinking you were asking about javascript instead of html; just in case I've included both here because, eh, why not.)
HTML
_ has no specific meaning, it's just a letter.
/ is used in file paths (such as URLs) to denote a change in directory. So <img src="/foo/bar/baz.gif"> would find an image named "baz.gif" inside a directory named "bar" inside a directory named "foo", at the root level of the website. For more detail, see https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL
Javascript
As in HTML, _ is just a character; it has no specific meaning in javascript. It is used by a common utility library named "underscore", and a competing library named "lodash"; if you're seeing this in js code it's probably including one of those libraries. (This is similar to how $ is commonly used for jQuery.)
/ does have a specific meaning in javascript; it's used to denote a regular expression, or as the "division" symbol for math.
I am using Vuetify, so this could be either a VueJS, Vuetify or even HTML question, but my component looks like this :
<v-list-tile
v-for="item in menuItem.items"
:key="item.type"
:style="`background: ${item.colour}`"
:html="item.type">
</v-list-tile>
Take the :key for example, what does the colon (:) before the word key mean? And where can I find what values I can use ?
:key is a shorthand for v-bind:key:
The v- prefix serves as a visual cue for identifying Vue-specific
attributes in your templates. This is useful when you are using Vue.js
to apply dynamic behavior to some existing markup, but can feel
verbose for some frequently used directives. At the same time, the
need for the v- prefix becomes less important when you are building a
SPA where Vue.js manages every template. Therefore, Vue.js provides
special shorthands for two of the most often used directives, v-bind
and v-on
https://v1.vuejs.org/guide/syntax.html#v-bind-Shorthand
It's a good practice to separate each class from the main code using
headers and sources. But what about functions? Let's say, I have a
function I would like to use across multiple classes and I don't
want to include this function as a method of a class.
If I decide to create a separate file for this function(s), should I
put everything inside .h or should I do as I do with classes
(separate .h and .cpp)?
Yes, whether it's a class or not it's still good practice to separate the declaration / signature (in the header file) from the definition / implementation (in the cpp file).
The code that calls the function does not need to know about how the function actually works - just how to call it.
This separation can avoid circular references that can sometimes otherwise occur. It avoids the compiler having to re-parse the definition every time the declaration is included.
Basically the reasons for separation between header and cpp are much the same for class and non-class functions.
However if you're using templates you will need to include the definition not just the declaration ( as you would with template classes ).
I'd suggest you put the functions in a namespace even if you don't put them in a class.
To set string #Input() properties of the component, we can use two type of syntax:
<my-component caption="Hello there" type="primary" someThing="text value"></my-component>
OR:
<my-component [caption]="'Hello there'" [type]="'primary'" [someThing]="'text value'"></my-component>
I'm fully aware of the differences between those two types of bindings. The question is: If I have bunch of string #Input() properties that I want to set statically, can I use simple attribute binding syntax (first example) than more "meaty" property binding syntax (second example)?
What is the recommendation, and why? I.e. what are the trade-offs and is it preferable to use property-binding always, even for setting static string inputs?
Here are the few drawbacks I can think of:
Attribute bindings are actually applied as HTML attributes, and e.g.
user can see/alter them via browser's dev tools easily. Property
bindings are not part of the markup.
Attribute bindings might collide
with actual HTML attribute names (unless you prefix them with data-
which defeats the whole purpose of simplicity). Actual example that
already bit me is title attribute.
There is no intellisense in markup for attribute bindings with Angular Language Service.
But the major advantage is the simplicity. In the example above, you would agree that the first form is more elegant. In my projects it seems that big number of properties are constant (one-time-set) string properties, and the syntax makes actual difference in readability.
So... Is it a bad practice to use attribute-binding syntax for custom (non-HTML) string properties? (Given the fact that I'm aware/ok with above listed few limitations)
These are a couple of things I like to add:
Attributes are just plain static fields.
There is a fine line when attributes become properties.
Simplicity is not the goal here, modularity and reuse-ability is.
Property binding give you more control in your component and you can use a component in any like any data-driven or static scenario.
One component build right with property binding can be used in 20 different projects.
But if you got no such requirement then you can use attributes. They are fine.
I will not say which one is better, both have their use cases but overall property bindings are lot more powerful and flexible.
And last thing I like to mention for all readers:
In front-end development any one can modify the code. We use
validations just to provide a smooth user experience. Other than that
any one can get the code or alter HTML if they want to, that's why we
use server side validations. Angular pipe line is complex but
hack-able. A user can wrap a JSON object and send it to server
bypassing all our validations. So for all readers who are new front-end
devs, we don't bother too much about security, we try our best to give
a good user experience.
I've faced two strange attributes of an html tag . They are "data-url" and "data-key".
What are they and how can they be used?
For some reasons i can't show the exact example of the HTML file I've found them in, but here are some examples from the web with such tags:
data-key
data-key
data-url
PS: I've tried to Google, but no useful results were found.
When Should I Use the Data Attribute?
Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements.
This time the data attribute is used to indicate the bubble value of the notification bubble.
Profile
This time is used to show the text for the tooltip.
This is the link
When Shouldn’t I Use the Data Attribute?
We shouldn’t use data attributes for anything which already has an already established or more appropriate attribute. For example it would be inappropriate to use:
<span data-time="20:00">8pm<span>
when we could use the already defined datetime attribute within a time element like below:
<time datetime="20:00">8pm</time>
Using Data Attributes With CSS (Attribute selectors)
[data-role="page"] {
/* Styles */
}
Using Data Attributes With jQuery (.attr())
Google
$('.button').click(function(e) {
e.preventDefault();
thisdata = $(this).attr('data-info');
console.log(thisdata);
});
Examples and info from here
Those are called HTML5 Custom Data attributes.
Custom data attributes are intended to store custom data private to
the page or application, for which there are no more appropriate
attributes or elements. These attributes are not intended for use by
software that is independent of the site that uses the attributes.
Every HTML element may have any number of custom data attributes
specified, with any value.
The reason why you can't find it in Google is because those attribute are custom attributes generated by user for their own usage.
From seeing your code it seems:
The person who has written this code, wants to store some additional
information with the elements. Not sure he may handle this in
Javascript too.
What you should do is to check the Javascript code completely,
whether he is handling those data attributes or if possible check
with him.
Since you code is using jQuery library, check for .data()
method. After a complete code review, if you find it has no use,
then feel free to remove.
data-* attributes are for adding arbitrary data to an element for use solely by the code (usually client side JavaScript) running on the site hosting the HTML.
In order to tell what the three examples you give are for, we would have to reverse engineer the code that comes with them (unless they are documented on the sites) since they don't have standard meanings.
A new feature being introduced in HTML 5 is the addition of custom data attributes. Simply, the specification for custom data attributes states that any attribute that starts with “data-” will be treated as a storage area for private data (private in the sense that the end user can’t see it – it doesn’t affect layout or presentation). This allows you to write valid HTML markup (passing an HTML 5 validator) while, simultaneously, embedding data within your page. A quick example:
<li class="user" data-name="John Resig" data-city="Boston"
data-lang="js" data-food="Bacon">
<b>John says:</b> <span>Hello, how are you?</span>
</li>