Template:Person: Difference between revisions

From elijah
Jump to navigation Jump to search
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
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|}}}
|HasBibLink={{{HasBibLink|}}}
|HasYIVOLink={{{HasYIVOLink|}}}
|HasWikiLink={{{HasWikiLink|}}}
}}


<!-- 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}}}]]}}
<!-- Handle Profession List (Controlled Vocabulary) -->
<!-- We split by semicolon so "Rabbi;Author" becomes two distinct data values -->
{{#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 -->
{{#arraymap:{{{HasURL|}}}|;|@@|
  <!-- Image Block -->
  {{#if: {{#rmatch:@@|^https?://}} |
  {{#if:{{{HasImage|}}}|
     [[HasURL::@@]]   <!-- valid, stored -->
    <div style="float:right; margin-left:1em; max-width:200px;">
  |
      [[{{#show: {{{HasImage|}}} |?HasFile |link=none}}|thumb|200px|center|{{{HasName|}}}]]
    <!-- 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>
   }}
   }}
}}


</div>
  <!-- Vital Statistics -->
  <ul>
    {{#if:{{{HasDateOfBirth|}}}|<li>'''Born:''' {{{HasDateOfBirth}}}{{#if:{{{HasPlaceOfBirth|}}}| in [[{{{HasPlaceOfBirth}}}]]}}</li>}}
    {{#if:{{{HasDateOfDeath|}}}|<li>'''Died:''' {{{HasDateOfDeath}}}{{#if:{{{HasPlaceOfDeath|}}}| in [[{{{HasPlaceOfDeath}}}]]}}</li>}}
  </ul>


<!-- Visible content: nicely formatted person card -->
  <!-- Professional Data -->
<div class="person" style="border:1px solid #ddd; padding:.8em; background:#fafafa; margin:.8em 0; overflow:auto;">
  {{#if:{{{HasProfession|}}}|
    '''Known for:'''
    <!-- {{#arraymap:{{{HasProfession|}}}|;|@@|[[Term:@@|@@]]|, }} --> <!-- Auto-links to Term:Namespace -->
    <!--
      We use [[HasProfession::@@]] syntax here.
      This displays the text "@@" (e.g. Rabbi), but clicking it
      searches the wiki for other people with that same property value.
    -->
    {{#arraymap:{{{HasProfession|}}}|;|@@|[[HasProfession::@@]]|, }}


  <!-- Float the image to the right -->
     <br/>
  {{#if:{{{HasImage|}}}|
    <div style="float:right; margin:0 0 .5em .8em;">
      [[{{{HasImage}}}|thumb|200px|{{{HasName|}}}]]
     </div>
   }}
   }}


  <!-- Person details -->
  {{#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|}}}|   -->
  {{#if:{{{HasArticle|}}}|'''Related Article:''' [[{{{HasArticle}}}]] | '''No Related Article''' <br/>}}
<!--    '''External links:''' -->
<!--    {{#arraymap:{{{HasURL}}}|;|@@|[@@ link]|<br/>}}<br/>  -->
<!--  }} -->


   <!-- External links with validation -->
   <!-- Identifiers (Crucial for TEI/MARC21 Interop) -->
   {{#if:{{{HasURL|}}}|
   {{#if:{{{HasWikidataID|}}}{{{HasVIAFID|}}}{{{HasMazalID|}}}|
     '''External links:'''<br/>
     <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/>
  }}


    <!-- Print valid URLs as links -->
  {{#if:{{{HasBibLink|}}}|'''Selected bibliography:'''[[{{{HasBibLink}}}]] |'''No Selected bibliography''' <br/>}}
    {{#arraymap:{{{HasURL}}}|;|@@|
  {{#if:{{{HasYIVOLink|}}}|'''YIVO Encyclopedia entry:'''[[{{{HasYIVOLink}}}]] |'''No YIVO Encyclopedia entry''' <br/>}}
      {{#if: {{#rmatch:@@|^https?://}} |
  {{#if:{{{HasWikiLink|}}}|'''Wikipedia entry:'''[[{{{HasWikiLink}}}]] |'''No Wikipedia entry''' <br/>}}
        [@@ link]<br/>
      |
        <!-- Do not show invalid URLs here -->
      }}
    }}


    <!-- List invalid URLs -->
  <!-- Other External Links with Validation -->
  {{#if:{{{HasURL|}}}|
    '''External Links:'''<br/>
     {{#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>
Line 117: Line 133:
  |HasMazalID=MAZAL-000045
  |HasMazalID=MAZAL-000045
  |HasVIAFID=22945141
  |HasVIAFID=22945141
  |HasImage=File:Jacob_ben_Moses.jpg
  |HasImage=Image:Josef Perl
  |HasArticle=Article:The Jewish Council of Lviv
  |HasArticle=Article:The Jewish Council of Lviv
  |HasProfession=Community leader and rabbinical scholar
  |HasProfession=Community leader and rabbinical scholar
  |HasURL=https://example.org/persons/jacob_ben_moses; https://en.wikipedia.org/wiki/Jacob_ben_Moses
  |HasURL=https://example.org/persons/jacob_ben_moses; https://en.wikipedia.org/wiki/Jacob_ben_Moses
|HasWikiLink=
|HasYIVOLink=
|HasBibLink=
}}
}}
</pre>
</pre>
</noinclude>
</noinclude>

Latest revision as of 20:25, 23 December 2025


Use this template on Person: pages to describe individual people.

Example:

{{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=Image:Josef Perl
 |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
 |HasWikiLink=
 |HasYIVOLink=
 |HasBibLink=
}}