4,494
edits
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 | |||
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 | |||
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 | |||
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 | |||
0 0 | 0 0 | ||
⎕←last←¯1 ¯1↑locs | |||
42 42 | 42 42 | ||
⎕←begin←first-pad | |||
¯5 ¯5 | ¯5 ¯5 | ||
⎕←size←(last-first)+2×pad | |||
52 52 | 52 52 | ||
⎕←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 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' | |||
850 | 850 | ||
</source> | </source> |