Difference between revisions of "Template:Address"

From Wayne County, Ohio Online Resource Center
Jump to navigation Jump to search
 
Line 24: Line 24:
 
<pre>
 
<pre>
 
{{#if: {{{street|}}}  
 
{{#if: {{{street|}}}  
  | [[
+
  | {{#if: {{{number|}}}
  {{#if: {{{number|}}}
+
     |{{!((}}{{{number}}}&nbsp;
     |{{{number}}}  
+
    |{{!((}}
 
   }}
 
   }}
 
   {{{street}}}
 
   {{{street}}}
Line 38: Line 38:
 
     |, {{{state}}}
 
     |, {{{state}}}
 
   }}
 
   }}
   {{!}}{{{street}}}
+
   {{!}}
    {{#if: {{{unit|}}}  
+
  {{#if: {{{number|}}}
      |, {{{unit}}}
+
    | {{{number}}}&nbsp;
    }}
+
  }}
 +
  {{{street}}}
 +
  {{#if: {{{unit|}}}  
 +
    |, {{{unit}}}
 +
  }}
 
   ]]
 
   ]]
 
}}
 
}}

Latest revision as of 14:57, 25 August 2016

Use like:

{{Address
 | number=304
 | street=N. Market St.
 | city=Wooster
 | state=Ohio
 | zip=44691
 | type=library
}}

And you get:

304 N. Market St., Wooster, Ohio 44691

Parameters are: address, unit (for apartment, suite, unit, etc. numbers), city, state, and zip. All parameters are optional. Additional parameters can be added (like type in the above example) to supply scripts with metadata.

Development codeblock

{{#if: {{{street|}}} 
 | {{#if: {{{number|}}}
    |{{!((}}{{{number}}} 
    |{{!((}}
   }}
   {{{street}}}
   {{#if: {{{unit|}}} 
    |, {{{unit}}}
   }}
   {{#if: {{{city|}}} 
    |, {{{city}}}
   }}
   {{#if: {{{state|}}}
    |, {{{state}}}
   }}
   {{!}}
   {{#if: {{{number|}}}
    | {{{number}}} 
   }}
   {{{street}}}
   {{#if: {{{unit|}}} 
    |, {{{unit}}}
   }}
   ]]
}}
{{#if: {{{city|}}}
 | {{#if: {{{street|}}}
    |, {{!((}}{{{city}}}
    |{{!((}}{{{city}}}
   }}
   {{#if: {{{state|}}}
    | , 
    | {{!))}}
   }}
 | {{#if: {{{state|}}}
    | {{!((}}
   }}
}}
{{#if: {{{state|}}}
 | {{{state}}}{{!))}}
}} 
{{{zip|}}}

Code

Edit this section to modify production code.