APL Wiki logo: Difference between revisions

Jump to navigation Jump to search
30 bytes added ,  05:51, 9 June 2020
m
Text replacement - " ⊢( *[^∘])" to " ⎕←$1"
m (Link to Catenate, not Concatenate)
m (Text replacement - " ⊢( *[^∘])" to " ⎕←$1")
Line 173: Line 173:
Finally, we compute the total offset for each column/row by finding the running total of the offsets:
Finally, we compute the total offset for each column/row by finding the running total of the offsets:
<source lang=apl>
<source lang=apl>
       ⊢offsets←0,+\1+⌈⌿2+/sizes
       ⎕←offsets←0,+\1+⌈⌿2+/sizes
0 9 21 33 42
0 9 21 33 42
</source>
</source>
Line 297: Line 297:
[[APL Wiki]] is a [[wikipedia:MediaWiki|MediaWiki]] which has strict requirements on the dimensions of the site logo:
[[APL Wiki]] is a [[wikipedia:MediaWiki|MediaWiki]] which has strict requirements on the dimensions of the site logo:
<source lang=apl>
<source lang=apl>
       ⊢dims←∊'width' 'height'Attr¨130
       ⎕←dims←∊'width' 'height'Attr¨130
  width="130" height="130"
  width="130" height="130"
</source>
</source>
Line 307: Line 307:
But let's add a bit more so the circles don't touch the image edge:
But let's add a bit more so the circles don't touch the image edge:
<source lang=apl>
<source lang=apl>
       ⊢pad←2+⌈/1↑sizes
       ⎕←pad←2+⌈/1↑sizes
5
5
</source>
</source>
Line 313: Line 313:
Finding the centres of the first and last circles with <source lang=apl inline>Circle</source> but this time with a 2-element left argument (this [[take]]s the first 1 layer and the first 1 row of that, etc.), we can find out where to begin, and the size of our image, which makes up the "viewBox" attribute:
Finding the centres of the first and last circles with <source lang=apl inline>Circle</source> but this time with a 2-element left argument (this [[take]]s the first 1 layer and the first 1 row of that, etc.), we can find out where to begin, and the size of our image, which makes up the "viewBox" attribute:
<source lang=apl>
<source lang=apl>
       ⊢first←1 1↑locs
       ⎕←first←1 1↑locs
0 0
0 0
       ⊢last←¯1 ¯1↑locs
       ⎕←last←¯1 ¯1↑locs
42 42
42 42
       ⊢begin←first-pad
       ⎕←begin←first-pad
¯5 ¯5
¯5 ¯5
       ⊢size←(last-first)+2×pad
       ⎕←size←(last-first)+2×pad
52 52
52 52
       ⊢viewBox←'viewBox'Attr,begin,size
       ⎕←viewBox←'viewBox'Attr,begin,size
  viewBox="-5 -5 52 52"
  viewBox="-5 -5 52 52"
</source>
</source>
Line 328: Line 328:
Now we construct the opening tag:
Now we construct the opening tag:
<source lang=apl>
<source lang=apl>
       ⊢svg←'<svg',dims,viewBox,' xmlns="http://www.w3.org/2000/svg">'
       ⎕←svg←'<svg',dims,viewBox,' xmlns="http://www.w3.org/2000/svg">'
<svg width="130" height="130" viewBox="-5 -5 52 52" xmlns="http://www.w3.org/2000/svg">
<svg width="130" height="130" viewBox="-5 -5 52 52" xmlns="http://www.w3.org/2000/svg">
</source>
</source>
Line 344: Line 344:
Now we we can put the SVG data into a native (OS) file:
Now we we can put the SVG data into a native (OS) file:
<source lang=apl>
<source lang=apl>
       ⊢svg ⎕NPUT '/tmp/aplwiki.svg'
       ⎕←svg ⎕NPUT '/tmp/aplwiki.svg'
850
850
</source>
</source>

Navigation menu