APL Wiki:Formatting: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Adám Brudzewsky
(→‎Inserting code: Section on non-highlighted code)
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[APL Wiki]] is a standard [[Wikipedia:MediaWiki|MediaWiki]], so the MediaWiki documentation for applies. In particular, the following are useful:
[[APL Wiki]] is a standard [[Wikipedia:MediaWiki|MediaWiki]], so the MediaWiki documentation for applies. In particular, the following sections may be useful:


* [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Links Links]
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Links Links]
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Formatting Formatting]
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Formatting Formatting]


However, please familiarise yourself with the below APL Wiki-specific guidelines before making any major edits.
APL Wiki doesn't have all the extensions and templates Wikipedia has, but does have some of its own. This page serves as a reference for many of them. If you are interested in making APL Wiki easier to edit, and know a bit about MediaWiki templates, you are also free to create your own.
 
== Links to Wikipedia ==
Linking to a [[wikipedia:Wikipedia|Wikipedia]] page is more like an internal link than an external one: both technically, because it uses MediaWiki just like APLWiki, and conceptually, because Wikipedia also has encyclopedic information on a variety of topics. And in fact Wikipedia links are supported by our [https://www.mediawiki.org/wiki/Help:Links#Internal_links internal link] syntax. This form is preferred because it is displayed with a "W" as an indication to the reader. Write an internal link as it would appear on Wikipedia, but put <code>wikipedia:</code> in front.
 
A Wikipedia link always needs to be given displayed text with <code>|</code>, because otherwise it will appear with that <code>wikipedia:</code> in the link, a very cluttered display! However, when editing there is a shortcut that can often be used. Writing the <code>|</code> character with no text afterwards will strip <code>wikipedia:</code> and any trailing material in parentheses from the display, so that for example <code><nowiki>[[wikipedia:APL (programming language)|]]</nowiki></code> displays as [[wikipedia:APL (programming language)|APL]].
 
== Mentioning subjects that have their own page ==
== Mentioning subjects that have their own page ==
It is fine for a page to have a section about a subject that also has its own page. When that happens, begin the section with <code><nowiki>{{Main|subject}}</nowiki></code> where <code>subject</code> is the target page title. Don't include double brackets (as a page link) — it is done for you.
It is fine for a page to have a section about a subject that also has its own page. When that happens, begin the section with <code><nowiki>{{Main|subject}}</nowiki></code> where <code>subject</code> is the target page title. Don't include double brackets (as a page link) — it is done for you.
== Also on Wikipedia ==
If a subject is notable for reasons unrelated to APL, in addition to being [[APL Wiki:Content guidelines#Notability|APL notable]], then you can indicate this fact using the [[Template:Also on Wikipedia|Also on Wikipedia]] template. By default, both the text and the Wikipedia link target are taken from the page's title. The optional first argument changes the name used in the text (for example, to use only a person's last name) and the second gives the Wikipedia article to link to.
As the template suggests, only APL-related topics, and important background information, should be covered on the APL Wiki if there is also a substantial Wikipedia article. In contrast, topics which are on Wikipedia only because of APL should eventually have APL Wiki articles with at least as much information as Wikipedia, and should not use the Also on Wikipedia template—instead, these articles should include a link to the Wikipedia article in an "External links" section. However, content should not be copied directly from Wikipedia. Rewrite it from an APL perspective instead.


== Yes/No tables ==
== Yes/No tables ==
Line 14: Line 25:
{| class=wikitable
{| class=wikitable
  ! Get wet?
  ! Get wet?
| Indoors || Outdoors  || Swimming
            | Indoors || Outdoors  || Swimming
  |-
  |-
  | Sunshine || {{No}}  || {{No}}    || {{Yes}}
  | Sunshine || {{No}}  || {{No}}    || {{Yes}}
Line 25: Line 36:
{| class=wikitable
{| class=wikitable
  ! Get wet?
  ! Get wet?
| Indoors || Outdoors  || Swimming
            | Indoors || Outdoors  || Swimming
  |-
  |-
  | Sunshine || {{No}}  || {{No}}    || {{Yes}}
  | Sunshine || {{No}}  || {{No}}    || {{Yes}}
Line 32: Line 43:
|}
|}
</blockquote>
</blockquote>
=== Custom options ===
You can customise the text by supplying an argument:
You can customise the text by supplying an argument:
<blockquote><pre>
<blockquote><pre>
{| class=wikitable
{| class=wikitable
  ! Get wet?
  ! Get wet?
| Indoors        || Outdoors            || Swimming
            | Indoors        || Outdoors            || Swimming
  |-
  |-
  | Sunshine || {{No}}        || {{No|Obviously not}} || {{Yes}}
  | Sunshine || {{No}}        || {{No|Obviously not}} || {{Yes}}
Line 48: Line 58:
{| class=wikitable
{| class=wikitable
  ! Get wet?
  ! Get wet?
| Indoors        || Outdoors            || Swimming
            | Indoors        || Outdoors            || Swimming
  |-
  |-
  | Sunshine || {{No}}        || {{No|Obviously not}} || {{Yes}}
  | Sunshine || {{No}}        || {{No|Obviously not}} || {{Yes}}
Line 57: Line 67:


== Inserting code ==
== Inserting code ==
=== Mathematical notation ===
MathJax is enabled, so you can insert mathematical notation (for example for [[Iverson notation]]) inline using
<blockquote><pre>
included the expression <math>⊥p_{32,33}:+/\alpha^2/I^0</math> in its description
</pre></blockquote>
which results in:
<blockquote>
included the expression <math>⊥p_{32,33}:+/\alpha^2/I^0</math> in its description
</blockquote>
For multiple and larger mathematical expressions, use
<blockquote><pre>
included the expression
:<math>i←O^{⊥I^0_{0,1,2,3}}_{⊥I^0_{4,5,6,7}}</math>
in its description
</pre></blockquote>
which results in:
<blockquote>
included the expression
:<math>i←O^{⊥I^0_{0,1,2,3}}_{⊥I^0_{4,5,6,7}}</math>
in its description
</blockquote>
==== Equivalence ====
It is quite common to state equivalences. Please use a proper equivalence arrow, which is easy to insert with the template:
<blockquote><pre>this {{←→}} that</pre></blockquote>
which results in:
<blockquote>this {{←→}} that </blockquote>
=== Inline code ===
=== Inline code ===
Inline code is used for single primitives and short expressions and uses the format
Inline code is used for single primitives and short expressions and uses the format
Line 105: Line 88:
</source></blockquote>
</source></blockquote>


==== Tagging dialects ====
Optionally, you can indicate one or more APL dialects which are able to run the code by using a special template immediately after the source tag, like
Optionally, you can indicate one or more APL dialects which are able to run the code by using a special template immediately after the source tag, like


Line 121: Line 105:
{{Works in|[[Dyalog APL]], [[dzaima/APL]], [[GNU APL]], [[ngn/apl]]}}</blockquote>
{{Works in|[[Dyalog APL]], [[dzaima/APL]], [[GNU APL]], [[ngn/apl]]}}</blockquote>


==== Run online ====
You can also include a permalink to [[TryAPL]], [[Try It Online]], ''repl.it'', or ''n9n.gitlab.io'' right before the source tag, for example
You can also include a permalink to [[TryAPL]], [[Try It Online]], ''repl.it'', or ''n9n.gitlab.io'' right before the source tag, for example


Line 154: Line 139:
10
10
</source>
</source>
}}}
}}
</pre></blockquote>
</pre></blockquote>


Line 175: Line 160:
</source>
</source>
}}</blockquote>
}}</blockquote>
=== Unsupported languages ===
If your code is in a language the highlighter doesn't support, then there are two ways to present code without highlighting it. Don't use a <source lang=text inline><source></source> tag with no <code>lang</code> attribute as this puts the page in the "Pages with syntax highlighting errors" category, which is visible at the bottom of the page.
* Use <source lang=text inline><code></source> tags for inline code and <source lang=text inline><pre></source> tags for blocks, avoiding <code><source></code> entirely
* Use <code>lang=text</code>.
=== Mathematical notation ===
MathJax is enabled, so you can insert mathematical notation (for example for [[Iverson notation]]) inline using
<blockquote><pre>
included the expression <math>\bot p_{32,33}:+/\alpha^2/I^0</math> in its description
</pre></blockquote>
which results in:
<blockquote>
included the expression <math>\bot p_{32,33}:+/\alpha^2/I^0</math> in its description
</blockquote>
For multiple and larger mathematical expressions, use
<blockquote><pre>
included the expression
:<math>i \gets O^{\bot I^0_{0,1,2,3}}_{\bot I^0_{4,5,6,7}}</math>
in its description
</pre></blockquote>
which results in:
<blockquote>
included the expression
:<math>i \gets O^{\bot I^0_{0,1,2,3}}_{\bot I^0_{4,5,6,7}}</math>
in its description
</blockquote>
==== Equivalence ====
It is quite common to state equivalences. Please use a proper equivalence arrow, which is easy to insert with the template:
<blockquote><pre>this {{←→}} that</pre></blockquote>
which results in:
<blockquote>this {{←→}} that </blockquote>


== Creating new pages ==
== Creating new pages ==
=== Primitives and other built-ins ===
=== Navboxes ===
 
Most articles should have a [[wikipedia:WP:NAVBOX|navigation template]] giving links to other articles of interest. The navbox should be added after all of the article text, but before the article's categories. A navbox is a template such as <code><nowiki>{{APL development}}</nowiki></code>, which displays as an expandable table of links:
{{APL development}}
 
The following navboxes exist at the moment:
* [[:Template:APL built-ins]]
* [[:Template:APL community]]
* [[:Template:APL development]]
* [[:Template:APL dialects]]
* [[:Template:APL features]]
* [[:Template:APL glyphs]]
* [[:Template:APL syntax]]
 
If you create a page that belongs in one of these navboxes but isn't already there, add it in the appropriate place in addition to placing the navbox in the new page.
 
=== Categories ===
 
The APL Wiki has a full Wikipedia-style [[wikipedia:Wikipedia:Categorization|category]] tree, which you can see by starting at the top-level category [[:Category:Contents|Contents]]. While all of Wikipedia's user-facing content is in encyclopedic ''articles'', APL Wiki also has non-encyclopedic ''essays'' that discuss a topic such as how to use APL for a particular problem. When adding a new page, try and fit it into at least one category, but it's fine to leave it out if you're not yet comfortable with the category system (other editors can easily see [[Special:UncategorisedPages|pages with no category]]). Categories are added with syntax such as <code><nowiki>[[Category:IBM employees]]</nowiki></code> at the end of the page.
 
Create new categories if needed, but please avoid [[wikipedia:Wikipedia:Overcategorization|Overcategorization]]. As with articles, each category should be placed in a parent category (the only [[Special:UncategorisedCategories|uncategorized category]] is [[:Category:Contents|Contents]]). Make sure to read Wikipedia's guidelines about categories carefully and understand the existing category tree if you plan to make major changes to the category system.
 
=== Specific types of articles ===
 
==== Primitives and other built-ins ====


When creating a page for a [[primitive function]], [[primitive operator|operator]], or [[quad name]], begin the page with the following template:
When creating a page for a [[primitive function]], [[primitive operator|operator]], or [[quad name]], begin the page with the following template:
Line 187: Line 228:
<blockquote>{{Built-in|Log|⍟}}</blockquote>
<blockquote>{{Built-in|Log|⍟}}</blockquote>


and also inserts a nice big illustration of the [[glyph]] on the page:
and also adds a large floating illustration of the [[glyph]], as seen at the right. You can use the <code>Built-ins</code> template for primitives with two different glyphs (for example <code><nowiki>{{Built-ins|Reverse|⌽|⊖}}</nowiki></code>), and <code>Glyphbox</code> if you just want a box at the right (for example <code><nowiki>{{Glyphbox|⍤}}</nowiki></code>). Since all of these templates must be put at the very beginning of the article's first paragraph, <code>Glyphbox</code> is useful if there should be leading text before the primitive's name.


At the bottom such pages, include <code><nowiki>{{APL built-ins}}</nowiki></code> and [{{fullurl:Template:APL_built-ins_body|action=edit}} edit that template's content] if the page you're creating isn't already listed there.
At the bottom of such pages, include <code><nowiki>{{APL built-ins}}</nowiki></code> and [{{fullurl:Template:APL_built-ins|action=edit}} edit that template's content] if the page you're creating isn't already listed there.


=== Dialects ===
==== Dialects ====


Begin your page about an APL dialect with the ''Infobox array language'' info box. These are all the optional parameters it supports:
Begin your page about an APL dialect with the ''Infobox array language'' info box. These are all the optional parameters it supports:
Line 210: Line 251:
| implementation language =
| implementation language =
| implementation languages =
| implementation languages =
| source =
| platform =
| platform =
| platforms =
| platforms =
Line 216: Line 258:
| license =
| license =
| website =
| website =
| forum =
| download =
| download =
| documentation =
| documentation =
| run online =
| influenced by =
| influenced by =
| influenced =
| influenced =
}}</pre></blockquote>
}}</pre></blockquote>
Have a look at the existing dialect pages, e.g. [[Dyalog APL]], to see how these values are used, Try to fill in as many as you can (but use only one of each singular/plural pair). You only need to use <code>title</code> if the language title differs from the page title (e.g. for technical reason like the inability to create a page that begins with a lowercase letter). In that case, you may also want to begin the page with <code><nowiki>{{Actually|real name}}</nowiki></code> where <code>real name</code> should be the proper name of the dialect.
Have a look at the existing dialect pages, e.g. [[Dyalog APL]], to see how these values are used, Try to fill in as many as you can (but use only one of each singular/plural pair). You only need to use <code>title</code> if the language title differs from the page title (e.g. for technical reason like the inability to create a page that begins with a lowercase letter). In that case, begin the page with <code><nowiki>{{DISPLAYTITLE:real name}}</nowiki></code> where <code>real name</code> should be the proper name of the dialect.


At the bottom of the page, include <code><nowiki>{{APL programming language}}</nowiki></code> and [{{fullurl:Template:APL_programming_language_body|action=edit}} edit that template's content] if the dialect you're creating a page about isn't already listed there.
At the bottom of the page, include <code><nowiki>{{APL programming language}}</nowiki></code> and [{{fullurl:Template:APL_programming_language_body|action=edit}} edit that template's content] if the dialect you're creating a page about isn't already listed there.
=== People, organisations, and what they do ===
Insert <code><nowiki>{{APL community}}</nowiki></code>  at the very bottom of the page, and [{{fullurl:Template:APL_community_body|action=edit}} edit that template's content] if the page you're creating isn't already listed there.

Revision as of 20:59, 8 February 2021

APL Wiki is a standard MediaWiki, so the MediaWiki documentation for applies. In particular, the following sections may be useful:

APL Wiki doesn't have all the extensions and templates Wikipedia has, but does have some of its own. This page serves as a reference for many of them. If you are interested in making APL Wiki easier to edit, and know a bit about MediaWiki templates, you are also free to create your own.

Links to Wikipedia

Linking to a Wikipedia page is more like an internal link than an external one: both technically, because it uses MediaWiki just like APLWiki, and conceptually, because Wikipedia also has encyclopedic information on a variety of topics. And in fact Wikipedia links are supported by our internal link syntax. This form is preferred because it is displayed with a "W" as an indication to the reader. Write an internal link as it would appear on Wikipedia, but put wikipedia: in front.

A Wikipedia link always needs to be given displayed text with |, because otherwise it will appear with that wikipedia: in the link, a very cluttered display! However, when editing there is a shortcut that can often be used. Writing the | character with no text afterwards will strip wikipedia: and any trailing material in parentheses from the display, so that for example [[wikipedia:APL (programming language)|]] displays as APL.

Mentioning subjects that have their own page

It is fine for a page to have a section about a subject that also has its own page. When that happens, begin the section with {{Main|subject}} where subject is the target page title. Don't include double brackets (as a page link) — it is done for you.

Also on Wikipedia

If a subject is notable for reasons unrelated to APL, in addition to being APL notable, then you can indicate this fact using the Also on Wikipedia template. By default, both the text and the Wikipedia link target are taken from the page's title. The optional first argument changes the name used in the text (for example, to use only a person's last name) and the second gives the Wikipedia article to link to.

As the template suggests, only APL-related topics, and important background information, should be covered on the APL Wiki if there is also a substantial Wikipedia article. In contrast, topics which are on Wikipedia only because of APL should eventually have APL Wiki articles with at least as much information as Wikipedia, and should not use the Also on Wikipedia template—instead, these articles should include a link to the Wikipedia article in an "External links" section. However, content should not be copied directly from Wikipedia. Rewrite it from an APL perspective instead.

Yes/No tables

For tables comparison tables, use the {{Yes}}, {{No}}, and {{Maybe}} templates, e.g.:

{| class=wikitable
 ! Get wet?
             | Indoors || Outdoors  || Swimming
 |-
 | Sunshine || {{No}}  || {{No}}    || {{Yes}}
 |-
 | Rain     || {{No}}  || {{Maybe}} || {{Yes}}
|}

gives:

Get wet? Indoors Outdoors Swimming
Sunshine No No Yes
Rain No Maybe Yes

You can customise the text by supplying an argument:

{| class=wikitable
 ! Get wet?
             | Indoors        || Outdoors             || Swimming
 |-
 | Sunshine || {{No}}         || {{No|Obviously not}} || {{Yes}}
 |-
 | Rain     || {{No|Depends}} || {{Maybe|Umbrella?}}  || {{Yes|Obviously}}
|}

gives:

Get wet? Indoors Outdoors Swimming
Sunshine No Obviously not Yes
Rain Depends Umbrella? Obviously

Inserting code

Inline code

Inline code is used for single primitives and short expressions and uses the format

<source lang=apl inline>(2=+⌿0=N∘.|N)/N←⍳100</source>

which results in

(2=+⌿0=N∘.|N)/N←⍳100

Code blocks

For session transcripts, function definitions and longer expressions, use code blocks like

<source lang=apl>
      (2=+⌿0=N∘.|N)/N←⍳100
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
</source>

which results in:

      (2=+⌿0=N∘.|N)/N←⍳100
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

Tagging dialects

Optionally, you can indicate one or more APL dialects which are able to run the code by using a special template immediately after the source tag, like

<source lang=apl>
      {(2=+⌿0=⍵∘.|⍵)/⍵}⍳100
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
</source>
{{Works in|[[Dyalog APL]], [[dzaima/APL]], [[GNU APL]], [[ngn/apl]]}}

which results in:

      {(2=+⌿0=⍵∘.|⍵)/⍵}⍳100
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

Run online

You can also include a permalink to TryAPL, Try It Online, repl.it, or n9n.gitlab.io right before the source tag, for example

[https://tryapl.org/?a=%7B%282%3D+%u233F0%3D%u2375%u2218.%7C%u2375%29/%u2375%7D%u2373100&run Try it now!]
<source lang=apl>
      {(2=+⌿0=⍵∘.|⍵)/⍵}⍳100
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
</source>

which results in:

Try it now!

      {(2=+⌿0=⍵∘.|⍵)/⍵}⍳100
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

Very long code blocks

Use

{{Collapse|The below code generates a tall column of numbers.|
<source lang=apl>
      ⍪⍳10
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
</source>
}}

which results in:

The below code generates a tall column of numbers.
      ⍪⍳10
 1
 2
 3
 4
 5
 6
 7
 8
 9
10

Unsupported languages

If your code is in a language the highlighter doesn't support, then there are two ways to present code without highlighting it. Don't use a <source> tag with no lang attribute as this puts the page in the "Pages with syntax highlighting errors" category, which is visible at the bottom of the page.

  • Use <code> tags for inline code and <pre> tags for blocks, avoiding <source> entirely
  • Use lang=text.

Mathematical notation

MathJax is enabled, so you can insert mathematical notation (for example for Iverson notation) inline using

included the expression <math>\bot p_{32,33}:+/\alpha^2/I^0</math> in its description

which results in:

included the expression in its description

For multiple and larger mathematical expressions, use

included the expression
:<math>i \gets O^{\bot I^0_{0,1,2,3}}_{\bot I^0_{4,5,6,7}}</math>
in its description

which results in:

included the expression

in its description

Equivalence

It is quite common to state equivalences. Please use a proper equivalence arrow, which is easy to insert with the template:

this {{←→}} that

which results in:

this that

Creating new pages

Navboxes

Most articles should have a navigation template giving links to other articles of interest. The navbox should be added after all of the article text, but before the article's categories. A navbox is a template such as {{APL development}}, which displays as an expandable table of links:

APL development [edit]
Interface SessionTyping glyphs (on Linux) ∙ FontsText editors
Publications IntroductionsLearning resourcesSimple examplesAdvanced examplesMnemonicsISO 8485:1989ISO/IEC 13751:2001A Dictionary of APLCase studiesDocumentation suitesBooksPapersVideosAPL Quote QuadVector journalTerminology (Chinese, German) ∙ Neural networksError trapping with Dyalog APL (in forms)
Sharing code Backwards compatibilityAPLcartAPLTreeAPL-CationDfns workspaceTatinCider
Implementation ResourcesOpen-sourceMagic functionPerformanceAPL hardware
Developers Timeline of corporationsAPL2000DyalogIBMIPSASTSC

The following navboxes exist at the moment:

If you create a page that belongs in one of these navboxes but isn't already there, add it in the appropriate place in addition to placing the navbox in the new page.

Categories

The APL Wiki has a full Wikipedia-style category tree, which you can see by starting at the top-level category Contents. While all of Wikipedia's user-facing content is in encyclopedic articles, APL Wiki also has non-encyclopedic essays that discuss a topic such as how to use APL for a particular problem. When adding a new page, try and fit it into at least one category, but it's fine to leave it out if you're not yet comfortable with the category system (other editors can easily see pages with no category). Categories are added with syntax such as [[Category:IBM employees]] at the end of the page.

Create new categories if needed, but please avoid Overcategorization. As with articles, each category should be placed in a parent category (the only uncategorized category is Contents). Make sure to read Wikipedia's guidelines about categories carefully and understand the existing category tree if you plan to make major changes to the category system.

Specific types of articles

Primitives and other built-ins

When creating a page for a primitive function, operator, or quad name, begin the page with the following template:

{{Built-in|Log|⍟}}

This inserts the text

Log ()

and also adds a large floating illustration of the glyph, as seen at the right. You can use the Built-ins template for primitives with two different glyphs (for example {{Built-ins|Reverse|⌽|⊖}}), and Glyphbox if you just want a box at the right (for example {{Glyphbox|⍤}}). Since all of these templates must be put at the very beginning of the article's first paragraph, Glyphbox is useful if there should be leading text before the primitive's name.

At the bottom of such pages, include {{APL built-ins}} and edit that template's content if the page you're creating isn't already listed there.

Dialects

Begin your page about an APL dialect with the Infobox array language info box. These are all the optional parameters it supports:

{{Infobox array language
| title =
| developer =
| released =
| latest release version =
| withdrawn =
| array model =
| index origin =
| function styles =
| numeric types =
| unicode support =
| file ext =
| implementation language =
| implementation languages =
| source =
| platform =
| platforms =
| operating system =
| operating systems =
| license =
| website =
| forum =
| download =
| documentation =
| run online =
| influenced by =
| influenced =
}}

Have a look at the existing dialect pages, e.g. Dyalog APL, to see how these values are used, Try to fill in as many as you can (but use only one of each singular/plural pair). You only need to use title if the language title differs from the page title (e.g. for technical reason like the inability to create a page that begins with a lowercase letter). In that case, begin the page with {{DISPLAYTITLE:real name}} where real name should be the proper name of the dialect.

At the bottom of the page, include {{APL programming language}} and edit that template's content if the dialect you're creating a page about isn't already listed there.