დახმარება:სექცია
漢>ა A>ა |
ეს სტატია ქართულ ენაზე თარგმნის პროცესშია. თუ ფლობთ ამ ენას, თქვენც შეგიძლიათ მონაწილეობის მიღება. |
გვერდი თავებადაა დაყოფილი.
თავების შექმნა
[რედაქტირება]Sections are created by creating their headers, see
==თავი== ===ქვეთავი=== ====Sub-subsection====
Table of contents (TOC)
[რედაქტირება]Linking to a section
[რედაქტირება]In the HTML code for each section there is an anchor element HTML element "a" with both "name" and "id" attributes holding the section title. This enables linking directly to sections. These section anchors are automatically used by MediaWiki when it generates a Table of Contents for the page, but you can also use them to manually link directly to one section within a page.
The html code generated at the beginning of this section, for example, is:
<p><a name="Section_linking" id="Section_linking"></a></p> <h2>Section linking</h2>
A link to this section (Section Linking) looks like this:
[[Help:Section#Section_linking|Section Linking]]
From within the same page you can use [[#id|link_label]], and from another page [[page_name#id|link_label]].
An underscore and number are appended to duplicate section names. E.g. for three sections named "Example", the names (for section linking) will be "Example", "Example_2" and "Example_3".
Note that using the date formatting feature in section headers complicates section linking.
An internal link in a section header does not give complications:
An external link in a section header does not seem to allow linking to that section from within Mediawiki, except from the TOC:
For linking to an arbitrary position in a page see linking to a page.
Compact TOC
[რედაქტირება]Where you have a large number of very short headings (such as letters of the alphabet) you can get a very long table of contents. An alternative is a compact TOC. If you have a template at "Template:compactTOC" such as , you can insert the following text:
{{compactTOC}}
which looks like this:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
You can do similar things with years or decades e.g.
1900s - 1910s - 1920s - 1930s - 1940s - 1950s - 1960s - 1970s - 1980s - 1990s - 2000s
Both of the above make use of section linking, see below.
See also compact TOC.
Section linking
[რედაქტირება]Linking to a section
[რედაქტირება]In the HTML code for each section there is an anchor element HTML element "a" with both "name" and "id" attributes holding the section title. This enables linking directly to sections. These section anchors are automatically used by MediaWiki when it generates a Table of Contents for the page, but you can also use them to manually link directly to one section within a page.
The html code generated at the beginning of this section, for example, is:
<p><a name="Section_linking" id="Section_linking"></a></p> <h2>Section linking</h2>
A link to this section (Section Linking) looks like this:
[[Help:Section#Section_linking|Section Linking]]
From within the same page you can use [[#id|link_label]], and from another page [[page_name#id|link_label]].
An underscore and number are appended to duplicate section names. E.g. for three sections named "Example", the names (for section linking) will be "Example", "Example_2" and "Example_3".
Note that using the date formatting feature in section headers complicates section linking.
An internal link in a section header does not give complications:
An external link in a section header does not seem to allow linking to that section from within Mediawiki, except from the TOC:
For linking to an arbitrary position in a page see linking to a page.
Linking to a section so that only that section is Displayed
[რედაქტირება]I hacked my way to a solution. If anyone knows of a more elegant way of doing this, please let me know (Behrang Amini)
Open the file includes/Article.php and scroll down to function view(). It'll look like this:
function view() { global $wgUser, $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgLang; global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol; global $wgEnotif, $wgParser, $wgParserCache, $wgUseTrackbacks; $sk = $wgUser->getSkin(); $fname = 'Article::view'; wfProfileIn( $fname ); // Get variables from query string $oldid = $this->getOldID(); $diff = $wgRequest->getVal( 'diff' ); $rcid = $wgRequest->getVal( 'rcid' ); $rdfrom = $wgRequest->getVal( 'rdfrom' );
Add the following line after the above text:
$section = $wgRequest->getText( 'section' );
This will make the variable 'section' passed in the URL available to the view function. Next, scroll down and look for the line that says:
$outputDone = false;
We'll be inserting some text before this line. The text we want to insert is:
if ($section!=''){ $this->mContent=$this->getSection($this->getContent(true),$section); $pcache=false; }
That's all. Now call your section by appending the URL of your page with either §ion=n or ?section=n, depending on whether you're passing other variables through your URL, where n is the section number.
Section linking and redirects
[რედაქტირება]A link that specifies a section of a redirect page corresponds to a link to that section of the target of the redirect.
A redirect to a section of a page goes to the top of the page. One can use it anyway as a clarification, and at least it works when clicking on the link from the redirect page.
A complication is that, unlike renaming a page, renaming a section does not create some kind of redirect. Also there is no separate what links here feature for sections, pages linking to the section are included in the list of pages linking to the page. Possible workarounds:
- put an anchor and link to that
- put a comment in the wikitext at the start of a section listing pages that link to the section
- make the section a separate page/template and either transclude it into, or just link to it from, its parent page; instead of linking to the section one can then link to the separate page.
Section editing
[რედაქტირება]Generalities
[რედაქტირება]Sections can be separately edited ("section editing feature") by right clicking on the section header and/or special edit links, depending on the preferences set, and by a url like
http://meta.wikimedia.org/w/wiki.phtml?title=Help:Section&action=edit§ion=2
(Note that here section numbers are used, not section titles; subsections have a single number, e.g. section 2.1 may be numbered 3, section 3 is then numbered 4, etc.)
This is convenient if the edit does not involve other sections and one needs not have the text of other sections at hand during the edit (or if one needs it, open the section edit link in a new window, or during section editing, open "Cancel" in a window). Section editing alleviates some problems of large pages.
"__NOEDITSECTION__" anywhere on the page will remove the edit links. It will not disable section editing itself, right clicking on the section header and the url still work.
Inserting a section can be done by editing either the section before or after it, merging with the previous section by deleting the header.
წინასწარ გადახედვა
[რედაქტირება]The preview in section editing does not always show the same as the corresponding part of the full page, e.g. if on the full page an image in the previous section intrudes into the section concerned.
The edit page shows the list of templates used on the whole page, i.e. also the templates used in other sections.
Subsections
[რედაქტირება]Subsections are included in the part of the page that is edited. Whether there is automatic section numbering is determined by the number of sections concerned, i.e. one plus the number of sub- and subsub-sections, etc. Section numbering is relative to the part that is edited, so on the relative top level there is always just number 1, relative subsections all have numbers starting with 1: 1.1., 1.2, etc.; e.g., when editing section 3.2, section 3.2.4 is numbered 1.4. However, the header format is according to the absolute level.
Editing before the first Section
[რედაქტირება]Currently there is no link for editing the part before the first heading (თარგი:Bug), except in the classic skin by right clicking on the page header, but the URL works, e.g. for this page:
http://meta.wikimedia.org/w/wiki.phtml?title=Help:Section&action=edit§ion=0
A less cumbersome way to obtain this link is to use any section edit link of the page, and change the number of the section to zero. With Javascript a link can be added, see w:en:Wikipedia:WikiProject User scripts/Scripts/Edit Top. For those fluent in PHP, it is possible to generate the link using the following code:
function GenerateTopEditLink() { $beginning = $_SERVER['PHP_SELF']; $ending = ( isset($_SERVER['QUERY_STRING']) ) ? $_SERVER['QUERY_STRING'] : ''; $title = ''; if (strlen($ending)>0) { $vals = array(); $ending = str_replace('?','', $ending); parse_str($ending, $vals); $title = $vals["title"]; } else { $tmp = parse_url($beginning); $tmp = $tmp["path"]; $beginning = dirname($tmp); $title = basename($tmp); } return $beginning . '?title=' . $title . '&action=edit§ion=0'; }
See also Help:Edit summary#Section title as automatic edit summary, Help:Section editing demo.
Providing for a separate edit history for a section
[რედაქტირება]Without changing the appearance of a page, a section of it can be an included separate page, see composite pages. This way a separate edit history is provided for the section. Also this allows watching it separately.
დახმარება:Editing sections of included templates
Editing a page with large sections
[რედაქტირება]If a page has very large sections, or is very large and has no division into sections, and one's browser or connection does not allow editing of such a large section, then one can still:
- append a section by specifying a large section number (too large does not matter); however, one has to start with a blank line before the new section header
- append content to the last section by not starting with a blank line; however, with the limitations of one's browser or connection, one cannot revert this, or edit one's new text.
If one can view the wikitext of a large section, one can divide the page into smaller sections by step by step appending one, and finally deleting the original content (this can be done one large section at a time). Thus temporarily there is partial duplication of the content, so it is useful to put an explanation in the edit summary.
Opening a link in a header in a new window
[რედაქტირება]When right click editing is enabled, you cannot right click a link in a header to open it in a new window, etc. However most browsers have an alternative way of doing that (Mozilla: middle click, ctrl+left click, type ahead find, TAB navigation; IE: shift+left click).
ჰორიზონტალური გამყოფი ხაზი
[რედაქტირება]A horizontal dividing line as a division demarcation is not taken into account in the section numbering and TOC. Therefore it should not be used for dividing a page in sets of sections.
"See also" line or section
[რედაქტირება]If a page consists of sections and a "see also" refers to the whole page, then make it a separate section. This is to avoid it becoming part of the prior section, to make it visible in the TOC, and to make it easily accessible through the TOC.
Alternatively, a "see also" line is sometimes put at the beginning.
A "see also" belonging to just one section can be put in that section: within a paragraph, as a separate paragraph, or as a subsection.
Text in a large font that should not begin a section
[რედაქტირება]When using text in a large font that should not begin a section, e.g. to show a font, use something like
<b><span style="font-size:120%"> Example text </span></b>
giving
Example text
Blank space as header
[რედაქტირება]If a (sub)section has a blank space as header, it results in a link in the TOC that does not work.
Sections vs. separate pages vs. transclusion
[რედაქტირება]Advantages of separate pages:
- what links here feature
- automatic redirect on renaming
- redirect to a section is not possible
- loading a small page is faster than loading a large page
Advantages of one large page with sections:
- loading one large page is faster and more convenient than loading several small ones
- searching within one large page (the page itself or the wikitext) with a local search function is faster and in some respects better than searching several pages (for which one has to search the whole project); also the TOC provides for convenient navigation.
Another alternative is composing a page of other pages using the template feature (creating a compound document by transclusion). This allows easy searching within the combined rendered page, but not in the combined wikitext. Titles have to be provided.
Subdivisions in general
[რედაქტირება]- Sections of a page are adjacent, and the end of the last section coincides with the end of the page, i.e., all the text within the page is in a section other than a possible part before the first section.
- The same applies at lower levels, i.e. in sections and subsections.
- In a list in a section, each list item is a kind of subsection; however, lists need not be adjacent, i.e., between lists there may be content at the section level, after which the list items of the following list are content which is down again to list item level.
- In HTML, a list item may contain several sublists, not necessarily adjacent; thus there may be parts of the list not only before the first sublist, but also between sublists, and after the last one; however, in wiki-syntax-lists, sublists follow the same rules as sections (see the first item in this list): the only possible part of the list not in sublists is before the first sublist.
See also continuing a list item after a sub-item and თარგი:Tim.
Sections for demo above
[რედაქტირება]Demo a
[რედაქტირება]This section is linked to from #Linking to a section.
Demo http://a
[რედაქტირება]This section is linked to from #Linking to a section.