Template:Person: Difference between revisions

From elijah
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<!-- https://elijahwiki.info/index.php/Template:Person -->
<includeonly>
<includeonly>
__NOFACTBOX__
__NOFACTBOX__
[[Category:People]]


<!-- Categorize all described files (optional) -->
<!-- ==========================================================
[[Category:People]]
    DATA STORAGE (THE "SET" BLOCK)
    We use #set to store data silently. No hidden divs needed.
    ========================================================== -->
{{#set:
|HasType={{{HasType|PublicFigure}}}
|HasName={{{HasName|}}}
|HasAltName={{{HasAltName|}}}
|HasHebName={{{HasHebName|}}}
|HasYiddishName={{{HasYiddishName|}}}
|HasDateOfBirth={{{HasDateOfBirth|}}}
|HasDateOfDeath={{{HasDateOfDeath|}}}
|HasPlaceOfBirth={{{HasPlaceOfBirth|}}}
|HasPlaceOfDeath={{{HasPlaceOfDeath|}}}
|HasWikidataID={{{HasWikidataID|}}}
|HasMazalID={{{HasMazalID|}}}
|HasVIAFID={{{HasVIAFID|}}}
|HasImage={{{HasImage|}}}
|HasArticle={{{HasArticle|}}}
}}


<!-- Store semantic data invisibly -->
<!-- Handle List Properties (Split by semicolon or comma) -->
<div style="display:none;">
<!-- 1. URLs: We assume raw text storage for JSON export simplicity,
{{#if:{{{HasType|PublicFigure}}}|[[HasType::{{#if:{{{HasType|}}}|{{{HasType}}}|PublicFigure}}]]}}
    but validation happens on display. -->
{{#if:{{{HasName|}}}|[[HasName::{{{HasName}}}]]}}
{{#if:{{{HasURL|}}}|
{{#if:{{{HasAltName|}}}|[[HasAltName::{{{HasAltName}}}]]}}
  {{#arraymap:{{{HasURL|}}}|;|@@|{{#set:HasURL=@@}} }}
{{#if:{{{HasHebName|}}}|[[HasHebName::{{{HasHebName}}}]]}}
}}
{{#if:{{{HasYiddishName|}}}|[[HasYiddishName::{{{HasYiddishName}}}]]}}
{{#if:{{{HasDateOfBirth|}}}|[[HasDateOfBirth::{{{HasDateOfBirth}}}]]}}
{{#if:{{{HasDateOfDeath|}}}|[[HasDateOfDeath::{{{HasDateOfDeath}}}]]}}
{{#if:{{{HasPlaceOfBirth|}}}|[[HasPlaceOfBirth::{{{HasPlaceOfBirth}}}]]}}
{{#if:{{{HasPlaceOfDeath|}}}|[[HasPlaceOfDeath::{{{HasPlaceOfDeath}}}]]}}
{{#if:{{{HasWikidataID|}}}|[[HasWikidataID::{{{HasWikidataID}}}]]}}
{{#if:{{{HasMazalID|}}}|[[HasMazalID::{{{HasMazalID}}}]]}}
{{#if:{{{HasVIAFID|}}}|[[HasVIAFID::{{{HasVIAFID}}}]]}}
{{#if:{{{HasImage|}}}|[[HasImage::{{{HasImage}}}]]}}
{{#if:{{{HasArticle|}}}|[[HasArticle::{{{HasArticle}}}]]}}
{{#if:{{{HasProfession|}}}|[[HasProfession::{{{HasProfession}}}]]}}


{{#if:{{{HasURL|}}}|[[HasURL::{{{HasURL}}}]]}}
<!-- 2. Professions: We want these to be individual data points
    so we can query "Topic:Rabbis" later. -->
{{#if:{{{HasProfession|}}}|
  {{#arraymap:{{{HasProfession|}}}|;|@@|{{#set:HasProfession=@@}} }}
}}


<!--Take the value of HasURL, split it at every semicolon (;), and create one [[HasURL::URL]] triple per item -->
<!-- ==========================================================
<!-- {{#arraymap:{{{HasURL|}}}|;|@@|[[HasURL::@@]]|}} -->  
    VISUAL DISPLAY (THE CARD)
    ========================================================== -->
<div class="person-card" style="border:1px solid #ccc; background:#f9f9f9; padding:1em; display:flow-root; box-shadow: 2px 2px 5px rgba(0,0,0,0.1);">


<!-- Multiple URLs separated by semicolon: validate each before storing -->
  <!-- Image Block -->
{{#arraymap:{{{HasURL|}}}|;|@@|
  {{#if:{{{HasImage|}}}|
  {{#if: {{#rmatch:@@|^https?://}} |
    <div style="float:right; margin-left:1em; max-width:200px;">
    [[HasURL::@@]]   <!-- valid, stored -->
      [[{{{HasImage}}}|thumb|200px|center|{{{HasName|}}}]]
  |
     </div>
     <!-- invalid, not stored -->
   }}
   }}
}}


</div>
  <!-- Header -->
  <h2 style="margin-top:0;">{{{HasName|{{PAGENAME}}}}}</h2>
 
  <div class="person-data">
  <!-- Names -->
  {{#if:{{{HasHebName|}}}{{{HasYiddishName|}}}|
    <p>
    {{#if:{{{HasHebName|}}}|'''Hebrew:''' <span lang="he" dir="rtl">{{{HasHebName}}}</span> &bull; }}
    {{#if:{{{HasYiddishName|}}}|'''Yiddish:''' <span lang="yi" dir="rtl">{{{HasYiddishName}}}</span>}}
    </p>
  }}


<!-- Visible content: nicely formatted person card -->
  <!-- Vital Statistics -->
<div class="person" style="border:1px solid #ddd; padding:.8em; background:#fafafa; margin:.8em 0; overflow:auto;">
  <ul>
    {{#if:{{{HasDateOfBirth|}}}|<li>'''Born:''' {{{HasDateOfBirth}}}{{#if:{{{HasPlaceOfBirth|}}}| in [[{{{HasPlaceOfBirth}}}]]}}</li>}}
    {{#if:{{{HasDateOfDeath|}}}|<li>'''Died:''' {{{HasDateOfDeath}}}{{#if:{{{HasPlaceOfDeath|}}}| in [[{{{HasPlaceOfDeath}}}]]}}</li>}}
  </ul>


   <!-- Float the image to the right -->
   <!-- Professional Data -->
   {{#if:{{{HasImage|}}}|
   {{#if:{{{HasProfession|}}}|
     <div style="float:right; margin:0 0 .5em .8em;">
     '''Known for:'''
      [[{{{HasImage}}}|thumb|200px|{{{HasName|}}}]]
    {{#arraymap:{{{HasProfession|}}}|;|@@|[[Term:@@|@@]]|, }} <!-- Auto-links to Term:Namespace -->
     </div>
     <br/>
   }}
   }}


  <!-- Person details -->
   {{#if:{{{HasArticle|}}}|'''Related Article:''' [[{{{HasArticle}}}]]<br/>}}
  {{#if:{{{HasName|}}}|'''Name:''' {{{HasName}}}<br/>}}
  {{#if:{{{HasAltName|}}}|'''Alternative name:''' {{{HasAltName}}}<br/>}}
  {{#if:{{{HasHebName|}}}|'''Hebrew name:''' {{{HasHebName}}}<br/>}}
  {{#if:{{{HasYiddishName|}}}|'''Yiddish name:''' {{{HasYiddishName}}}<br/>}}
  {{#if:{{{HasType|}}}|'''Type:''' {{{HasType}}}<br/>}}
  {{#if:{{{HasDateOfBirth|}}}|'''Date of birth:''' {{{HasDateOfBirth}}}<br/>}}
  {{#if:{{{HasPlaceOfBirth|}}}|'''Place of birth:''' {{{HasPlaceOfBirth}}}<br/>}}
  {{#if:{{{HasDateOfDeath|}}}|'''Date of death:''' {{{HasDateOfDeath}}}<br/>}}
  {{#if:{{{HasPlaceOfDeath|}}}|'''Place of death:''' {{{HasPlaceOfDeath}}}<br/>}}
  {{#if:{{{HasProfession|}}}|'''Known for:''' {{{HasProfession}}}<br/>}}
   {{#if:{{{HasArticle|}}}|'''Related article:''' {{{HasArticle}}}<br/>}}
  {{#if:{{{HasWikidataID|}}}|'''Wikidata ID:''' {{{HasWikidataID}}}<br/>}}
  {{#if:{{{HasMazalID|}}}|'''Mazal ID:''' {{{HasMazalID}}}<br/>}}
  {{#if:{{{HasVIAFID|}}}|'''VIAF ID:''' {{{HasVIAFID}}}<br/>}}
  <!-- {{#if:{{{HasURL|}}}|'''External link:''' [{{{HasURL}}} link]<br/>}} -->
<!-- {{#if:{{{HasURL|}}}|  -->
<!--    '''External links:''' -->
<!--    {{#arraymap:{{{HasURL}}}|;|@@|[@@ link]|<br/>}}<br/>  -->
<!--  }} -->


   <!-- External links with validation -->
  <!-- Identifiers (Crucial for TEI/MARC21 Interop) -->
  {{#if:{{{HasWikidataID|}}}{{{HasVIAFID|}}}{{{HasMazalID|}}}|
    <hr style="margin:0.5em 0; border:0; border-top:1px dashed #ccc;"/>
    <small style="color:#666;">
    {{#if:{{{HasWikidataID|}}}|'''Wikidata:''' [https://www.wikidata.org/wiki/{{{HasWikidataID}}} {{{HasWikidataID}}}] &bull; }}
    {{#if:{{{HasVIAFID|}}}|'''VIAF:''' [https://viaf.org/viaf/{{{HasVIAFID}}} {{{HasVIAFID}}}] &bull; }}
    {{#if:{{{HasMazalID|}}}|'''Mazal ID:''' {{{HasMazalID}}}}}
    </small>
    <br/>
  }}
 
   <!-- External Links with Validation -->
   {{#if:{{{HasURL|}}}|
   {{#if:{{{HasURL|}}}|
     '''External links:'''<br/>
     '''External Links:'''<br/>
    <!-- Print valid URLs as links -->
    {{#arraymap:{{{HasURL}}}|;|@@|
      {{#if: {{#rmatch:@@|^https?://}} |
        [@@ link]<br/>
      |
        <!-- Do not show invalid URLs here -->
      }}
    }}
 
    <!-- List invalid URLs -->
     {{#arraymap:{{{HasURL}}}|;|@@|
     {{#arraymap:{{{HasURL}}}|;|@@|
       {{#if: {{#rmatch:@@|^https?://}} |
       {{#if: {{#rmatch:@@|^https?://}} | [@@ Link] | <!-- Invalid hidden --> }}
        <!-- valid; do nothing -->
    |<br/>}}
      |
        <span style="color:red; font-size:90%;">Invalid URL ignored: @@</span><br/>
      }}
    }}
   }}
   }}
 
  </div>


</div>
</div>
</includeonly>
</includeonly>
<noinclude>
Use this template on Person: pages to describe individual people.
Example:
<pre>
{{Person
|HasName=Perl ,Joseph
|HasHebName=פרל, יוסף
|HasYiddishName=פערל, יוסף
|HasType=PublicFigure
|HasDateOfBirth=1773
|HasPlaceOfBirth=Community:Lviv
|HasDateOfDeath=1839
|HasPlaceOfDeath=Community:Brody
|HasWikidataID=Q123456
|HasMazalID=MAZAL-000045
|HasVIAFID=22945141
|HasImage=File:Jacob_ben_Moses.jpg
|HasArticle=Article:The Jewish Council of Lviv
|HasProfession=Community leader and rabbinical scholar
|HasURL=https://example.org/persons/jacob_ben_moses; https://en.wikipedia.org/wiki/Jacob_ben_Moses
}}
</pre>
</noinclude>

Revision as of 15:59, 27 November 2025