The expert corner

From GeneWeb
Revision as of 15:09, 1 November 2015 by Henri83 (Talk | contribs) (Template programming (%if; ... %end;))

Jump to: navigation, search
150px-Geographylogo svg.png Language: English

Template programming (%if; ... %end;)

The template mechanism provides a very powerful mechanism to construct HTML (or other) pages according to the content of a GeneWeb base. This section is not intending to give an exhaustive description of the corresponding language. Through some examples extracted from gw/etc/perso.txt, it provides a glimpse of the possibility. For further analysis, explore the various other template files, and on last resort, explore the Ocaml source files!!

 <title>%nn;
   %if;has_public_name;
     %if;has_qualifiers;%public_name; %qualifier;
     %else;%public_name; %surname;%end;
   %else;
     %if;has_qualifiers;%first_name; %qualifier;
     %else;%first_name; %surname;%end;
   %end;
 </title>
%define;married_to(sexx, date_place)
 %if;(sexx = 0 or sexx = 2)
   %if;are_married;[*married%t to:::date_place]0%nn;
   %elseif;are_not_married;[*relationship%t to:::date_place]0%nn;
   %elseif;are_engaged;[*engaged%t to:::date_place]0%nn;
   %elseif;is_no_sexes_check;[*relationship%t to:::date_place]0%nn;
   %elseif;is_no_mention;date_place [*with]%nn;
   %end;
 %else;
   %if;are_married;[*married%t to:::date_place]1%nn;
   %elseif;are_not_married;[*relationship%t to:::date_place]1%nn;
   %elseif;are_engaged;[*engaged%t to:::date_place]1%nn;
   %elseif;is_no_sexes_check;[*relationship%t to:::date_place]1%nn;
   %elseif;is_no_mention;date_place [*with]%nn;
   %end;
 %end;
%end;
%if;(bvar.can_send_image != "no" and image = "" and first_name != "?" and surname != "?")
     <li><a href="%prefix;m=SND_IMAGE;i=%index;" class="add_portrait">
            %if;(auto_image_file_name != "")[*modify picture]%else;[*add picture]%end;
          </a>
     </li>
%end;
 
"access_by_key"
"access" 
"age"
"alias" 
"anc_sosa" 
"ancestor_level" 
"ancestor_level2" 
"ancestor_surname" 
"ancestor_tree_line" 
"ancestor" 
"are_divorced"
"are_engaged"
"are_married"
"are_not_married"
"are_separated"
"auto_image_file_name"
"baptism_date" 
"baptism_note"
"baptism_place"
"baptism_witness" 
"base" 
"birth_date" 
"birth_note"
"birth_place"
"birth_witness" 
"birth_witness" 
"birthday"
"browsing_with_sosa_ref"
"burial_date" 
"burial_note"
"burial_place"
"burial_witness" 
"canton"
"cell" 
"child_cnt" 
"child_name"
"child" 
"colspan"
"comment"
"computable_age"
"computable_death_age"
"computable_marriage_age"
"consanguinity"
"count"
"country"
"county"
"cousin_level" 
"cremated_date" 
"cremation_place"
"cremation_witness" 
"date_begin" 
"date_end" 
"date"
"dates"
"day"
"death_age"
"death_date" 
"death_note"
"death_place"
"death_witness" 
"desc_level"
"descendant_level" 
"died" 
"district"
"divorce_date"
"empty_sorted_list"
"enclosing" 
"event_witness_kind" 
"event_witness_relation_kind" 
"event_witness_relation" 
"event_witness" 
"event" 
"fam_access"
"family_cnt" 
"family" 
"father_age_at_birth" 
"father_sosa"
"father" 
"first_name_alias"
"first_name_alias" 
"first_name_key_strip"
"first_name_key_val"
"first_name_key"
"first_name"
"has_aliases"
"has_baptism_date" 
"has_baptism_note"
"has_baptism_place" 
"has_baptism_witnesses"
"has_birth_date" 
"has_birth_note"
"has_birth_place" 
"has_birth_witnesses"
"has_burial_date"
"has_burial_note"
"has_burial_place" 
"has_burial_witnesses"
"has_children"
"has_comment"
"has_consanguinity"
"has_cremation_date"
"has_cremation_place" 
"has_cremation_witnesses"
"has_date" e
"has_death_date"
"has_death_note"
"has_death_place" 
"has_death_witnesses"
"has_event"
"has_families" 
"has_first_names_aliases"
"has_fsources"
"has_history"
"has_image" 
"has_linked_page"
"has_linked_pages"
"has_marriage_note"
"has_nephews_or_nieces" 
"has_nobility_titles" 
"has_note" 
"has_notes" "
"has_occupation" 
"has_parents" 
"has_place"
"has_possible_duplications" 
"has_psources"
"has_public_name"
"has_qualifiers"
"has_relation_her"
"has_relation_him"
"has_relations"
"has_siblings"
"has_sosa"
"has_sources"
"has_spouse" e
"has_src" 
"has_surnames_aliases"
"has_witnesses"
"has_witnesses" 
"hexa" 
"history_file"
"ident_key" 
"image_html_url" 
"image_medium_size" s
"image_size" 
"image_small_size" 
"image_url" 
"image" if 
"incr_count"
"ind_access"
"index" 
"index" 
"interval"
"is_buried"
"is_center"
"is_cremated"
"is_dead"
"is_descendant"
"is_empty"
"is_female" 
"is_first"
"is_invisible"
"is_last"
"is_left"
"is_male" e
"is_no_mention"
"is_no_sexes_check"
"is_private" 
"is_public" 
"is_restricted" 
"is_right"
"is_self" get_env 
"is_sibling_after" 
"is_sibling_before" 
"is_top"
"item" 
"lazy_force"
"lazy_printed"
"level"
"linked_page"
"mark_descendants"
"marriage_age"
"marriage_date" 
"marriage_note"
"marriage_place"
"max_anc_level"
"max_cous_level"
"max_desc_level"
"misc_names"
"month"
"mother_age_at_birth" 
"mother_sosa"
"mother" 
"name"
"nb_children"
"nb_events" 
"nb_families" 
"nb_ind"
"nb_times" 
"next_item" 
"nobility_title"
"note"
"notes"
"number_of_ancestors" 
"number_of_descendants" 
"number_of_subitems"
"occ"
"occupation"
"octal"
"on_baptism_date"
"on_birth_date"
"on_burial_date"
"on_cremation_date"
"on_date"
"on_death_date"
"on_marriage_date"
"origin_file"
"other"
"parent" 
"place_key" 
"place"
"prec"
"prev_fam_father"
"prev_fam_index"
"prev_fam_mother"
"prev_family" 
"prev_item" 
"public_name"
"pvar" 
"qualifier"
"region"
"related_type"
"related" 
"relation_her" 
"relation_him" 
"relation_type"
"relation" 
"reset_count"
"reset_desc_level"
"same" 
"self" 
"set_infinite_desc_level"
"sex"
"slash_baptism_date"
"slash_birth_date"
"slash_burial_date"
"slash_cremation_date"
"slash_death_date"
"slash_divorce_date"
"slash_marriage_date"
"sorted_list_item" 
"sosa_access"
"sosa_in_list"
"sosa_link"
"sosa_ref" 
"sosa" 
"source_type"
"source"
"spouse" 
"src"
"surname_alias"
"surname_begin"
"surname_end"
"surname_key_strip"
"surname_key_val"
"surname_key"
"surname"
"title" 
"town"
"township"
"v" 
"var" 
"wedding_birthday"
"witness_relation" 
"witness" 
"year"

Macros (%x)

See Macros for a description of their use.

Below is the result of calling all 26 lower case possible macros: This table is automatically generated by inserting a bit of HTML/GeneWeb code into the notes of one person in your base. The corresponding code is here

Table of GeneWeb macros.

Commands (m=XXX)

List of the commands appearing in URL with the form:

%sm=COMMAND;p=param1;n=param2;
"A"
"ADD_FAM" 
"ADD_FAM_OK" 
"ADD_IND" 
"ADD_IND_OK"  
"ADD_PAR" 
"ANM" 
"AN"
"AD"
"AM"
"AS_OK" 
"B" 
"C"
"CAL" 
"CHG_CHN" 
"CHG_CHN_OK" 
"CHG_FAM_ORD" 
"CHG_FAM_ORD_OK" 
"CONN_WIZ" 
"D"
"DAG" 
"DEL_FAM"  
"DEL_FAM_OK"  
"DEL_IMAGE"  
"DEL_IMAGE_OK" 
"DEL_IND"  
"DEL_IND_OK" 
"DOC" (* obsolete *)
"FORUM"
"FORUM_ADD"
"FORUM_ADD_OK"
"FORUM_DEL"
"FORUM_P_P"
"FORUM_SEARCH"
"FORUM_VAL"
"FORUM_VIEW"
"H"
"HIST" 
"HIST_CLEAN"  
"HIST_CLEAN_OK" 
"HIST_DIFF" 
"HIST_SEARCH" 
"IMH" 
"INV_FAM"  
"INV_FAM_OK"  
"KILL_ANC" 
"LB" 
"LD" 
"LINKED"
"LL" 
"LM" 
"LEX" 
"MISC_NOTES" 
"MISC_NOTES_SEARCH" 
"MOD_DATA"  
"MOD_DATA_OK"  
"MOD_FAM"  
"MOD_FAM_OK"  
"MOD_IND"  
"MOD_IND_OK" 
"MOD_NOTES"  
"MOD_NOTES_OK"  
"MOD_WDOC"  (* obsolete *)
"MOD_WDOC_OK"  (* obsolete *)
"MOD_WIZNOTES" 
"MOD_WIZNOTES_OK"
"MRG" 
"MRG_DUP"  
"MRG_DUP_IND_Y_N" 
"MRG_DUP_FAM_Y_N" 
"MRG_FAM"  
"MRG_FAM_OK"  
"MRG_MOD_FAM_OK" 
"MRG_IND"  
"MRG_IND_OK"  
"MRG_MOD_IND_OK" 
"N"
"NG"
"NOTES" 
"OA" 
"OE" 
"P"
"POP_PYR" 
"PS" P
"R"
"REQUEST" 
"RL" 
"RLM" 
"S" 
"SND_IMAGE"  
"SND_IMAGE_OK" 
"SRC"
"STAT" B
"CHANGE_WIZ_VIS" 
"TT" 
"U" 
"VIEW_WIZNOTES" 
"WDOC" (* obsolete *)
"WIZNOTES" 
"WIZNOTES_SEARCH" 

Variables (evar and bvar)