APL Wiki:Formatting

From APL Wiki
Revision as of 20:59, 8 February 2021 by Marshall (talk | contribs) (→‎Inserting code: Section on non-highlighted code)
Jump to navigation Jump to search

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.