Line 1: |
Line 1: |
− | <noinclude>This template will add pop-up tip.
| + | local sb = {} -- functions package for HPB Scrapbooks |
| | | |
− | '''Usage:''' | + | function sb.item_id( frame ) |
− | <pre>{{tip|}}</pre>
| + | local id = frame.args['volume'] .. '-' .. frame.args['page'] .. '-' .. frame.args['item'] |
| + | return id |
| + | end |
| | | |
− | '''Example:''' | + | function sb.item_id2( frame ) |
− | <pre>It was said in {{tip|SD}} that...</pre>
| + | local vNum = string.format("%.2d", frame.args['volume']) |
| + | local iNum = string.format("%.2d", frame.args['item']) |
| + | --print(vNum) |
| + | local p_int, p_frac = math.modf(frame.args['page']) |
| + | local pNum = string.format("%.3d", p_int) |
| + | if p_frac > 0 then |
| + | pNum = pNum .. '.' .. p_frac |
| + | end |
| + | |
| + | --local id = string.format("%.2d", frame.args['volume']) .. '-' .. pNum .. '-' .. iNum |
| + | local id = vNum .. '--' .. pNum .. '--' .. iNum |
| + | return id |
| + | end |
| | | |
− | '''Result:'''
| |
| | | |
− | It was said in {{tip|SD}} that...
| + | return sb |
− | | |
− | [[Category: Templates]]
| |
− | </noinclude><includeonly>{{#switch: {{{1|}}}
| |
− | | =
| |
− | | Alch. = {{#vardefine:tip|Alchemical sources}}
| |
− | | Arab. = {{#vardefine:tip|Arab traditions}}
| |
− | | Assyr. = {{#vardefine:tip|Assyrian language}}
| |
− | | Eg. = {{#vardefine:tip|Egyptian mythology}}
| |
− | | IAST = {{#vardefine:tip|International Alphabet of Sanskrit Transliteration}}
| |
− | | Secret Doctrine
| |
− | | SD = {{#vardefine:tip|'The Secret Doctrine' by H.P.Blavatsky}}
| |
− | | Sk. = {{#vardefine:tip|Sanskrit language}}
| |
− | }}
| |
− | {{#varexists: tip
| |
− | | <span style="border-bottom:1px dotted gray; cursor:help;" title="{{#var:tip}}">{{{1|}}}</span>
| |
− | | {{{1|}}}
| |
− | }}
| |
− | </includeonly>
| |