The expert corner

From GeneWeb
(Redirected from Expert)
Jump to navigation Jump to 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. The last two examples are extracted from a template that generates LaTeX rather than HTML.

For further analysis, explore the various other template files, and on last resort, explore the Ocaml source files!!

WARNING: one of the main issue with template programming is that all functions are not permanently available on all pages! Describing which are available where is beyond reach, and trial and error is the only solution, but being aware of the problem is important!!

Programming constructs:

 %define(p1, p2) ... %end;
 %if;(cond) [%elseif;] [%else;] %end;
 %let;xxx;zzz%in;
 %foreach; ... %end;
 %for;i;0;n;... %end;
 %apply;xxxx(p1, p2) or
 %apply; ... [%with;... [%and;] ...%end;]
 %nl; %nn; %sp; %sq;

Functions callable with %apply:

 a_of_b ("aaa", "bbb") 
 a_of_b2 ("aaa", "bbb", "ccc") test vowel at beginning of "ccc"
 a_of_b_gr_eq_lev (??)
 capitalize ("aaa")
 language_name ("fr")
 nth("aaa"/"bbb"/"ccc"/"ddd", n)
 nth_c("abcdef", n)
 blue_of_hsv
 red_of_hsv
 green_of_hsv

Arithmetic and booleans:

 +, -, /, *, %, =, !=, <, <=, >, >=, "and", "or", "not", "is_substr" or "in"

WARNING: all functions may not be fully available depending on the execution context!

 <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;
 
%define;hgindex(alxx, snxx, fnxx, occxx)
  %if;(alxx = "0")
    %if;(occxx = "0")
      \index{snxx, fnxx}
    %else;
      \index{snxx, fnxx (occxx)}
    %end;
  %else;
    %if;(occxx = "0")
      \index{alxx, voir snxx, fnxx}
    %else;
      \index{alxx, voir snxx, fnxx (occxx)}
    %end;
  %end;
%end
%foreach;alias;
    {\it {\bf %alias;}}%apply;hgindex(alias, surname, first_name, occ)\\%nl;
%end;

List of commands

This list does not claim to be exhaustive (but pretty close!!). A good way to understand the semantic of these commands is to explore the template files and observe how they are used (grep is your friend).

Most of the commands are interpreted by the files perso.ml or templ.ml. When this is not the case, the name of the interpreter file is associated with the command.

  "a_of_b"
  "a_of_b2"
  "a_of_b_gr_eq_lev"
  "acc_if_titles", updateInd.ml
  "acc_private", updateInd.ml
  "acc_public", updateInd.ml
  "acces", historyDiffDisplay.ml
  "access", dagDisplay.ml, history.ml, historyDiffDisplay.ml
  "access_by_key"
  "action"
  "add_in_sorted_list"
  "add_in_sorted_listb"
  "add_in_sorted_listc"
  "add_in_sorted_listd"
  "add_in_sorted_liste"
  "after", historyDiffDisplay.ml
  "age"
  "alias", updateInd.ml
  "aliases", historyDiffDisplay.ml
  "align", dagDisplay.ml
  "all"
  "anc1"
  "anc2"
  "anc_f_list"
  "anc_level"
  "anc_paths"
  "anc_paths_at_level"
  "anc_paths_at_level_cnt"
  "anc_paths_at_level_cnt_raw"
  "anc_paths_cnt"
  "anc_paths_cnt_raw"
  "anc_sosa"
  "ancestor"
  "ancestor_at_level"
  "ancestor_level"
  "ancestor_surname"
  "ancestor_tree_line"
  "and"
  "approx_birth_place"
  "approx_death_place"
  "are_divorced"
  "are_engaged"
  "are_marriage_banns"
  "are_marriage_contract"
  "are_marriage_license"
  "are_married"
  "are_not_married"
  "are_pacs"
  "are_residence"
  "are_separated"
  "auto_image_file_name"
  "bapt", updateInd.ml
  "bapt_note", updateInd.ml
  "bapt_place", updateInd.ml
  "bapt_src", updateInd.ml
  "baptism", historyDiffDisplay.ml
  "baptism_date"
  "baptism_note", historyDiffDisplay.ml
  "baptism_place", historyDiffDisplay.ml
  "baptism_source"
  "baptism_src", historyDiffDisplay.ml
  "baptism_witness"
  "bar_link", dagDisplay.ml
  "base", srcfileDisplay.ml
  "base_header"
  "base_trailer"
  "bases_list"
  "bdo", dagDisplay.ml
  "before", historyDiffDisplay.ml
  "birth", historyDiffDisplay.ml, updateInd.ml
  "birth_date"
  "birth_day", updateFam.ml
  "birth_month", updateFam.ml
  "birth_note", historyDiffDisplay.ml, updateInd.ml
  "birth_place", historyDiffDisplay.ml, updateFam.ml, updateInd.ml
  "birth_source"
  "birth_src", historyDiffDisplay.ml, updateInd.ml
  "birth_witness"
  "birth_year", updateFam.ml
  "birthday"
  "blue_of_hsv"
  "bname_prefix"
  "body_prop"
  "border"
  "browsing_with_sosa_ref", dagDisplay.ml, srcfileDisplay.ml
  "bt_buried", updateInd.ml
  "bt_cremated", updateInd.ml
  "bt_unknown_burial", updateInd.ml
  "burial", historyDiffDisplay.ml, updateInd.ml
  "burial_date"
  "burial_note", historyDiffDisplay.ml, updateInd.ml
  "burial_place", historyDiffDisplay.ml, updateInd.ml
  "burial_source"
  "burial_src", historyDiffDisplay.ml, updateInd.ml
  "burial_witness"
  "bvar", updateFam.ml
  "cal_french", update_util.ml
  "cal_gregorian", update_util.ml
  "cal_hebrew", update_util.ml
  "cal_julian", update_util.ml
  "calendar", update_util.ml
  "cancel_links"
  "canton", util.ml
  "capitalize"
  "cell"
  "cell_nbr", dagDisplay.ml
  "center", dagDisplay.ml
  "cgi"
  "charset"
  "child", updateFam.ml
  "child_cnt"
  "child_name"
  "children", historyDiffDisplay.ml
  "clean_comment_tags"
  "clean_html_tags"
  "cnt", updateDataDisplay.ml, updateFam.ml, updateInd.ml
  "colspan", dagDisplay.ml
  "comment", historyDiffDisplay.ml, updateFam.ml
  "computable_age"
  "computable_death_age"
  "computable_marriage_age"
  "connections"
  "consanguinity"
  "copyright"
  "count", history.ml, updateDataDisplay.ml
  "count1"
  "count2"
  "count3"
  "country", util.ml
  "county", util.ml
  "cous_paths"
  "cous_paths_cnt"
  "cous_paths_cnt_raw"
  "cous_paths_max_date"
  "cous_paths_min_date"
  "cousin"
  "cousin_level"
  "cousins"
  "cousins_cnt"
  "create", updateFam.ml, updateInd.ml, updateIndOk.ml, update_util.ml
  "cremated_date"
  "cremation_place"
  "cremation_witness"
  "dag", dagDisplay.ml
  "dag_cell", dagDisplay.ml
  "dag_cell_pre", dagDisplay.ml
  "dag_line", dagDisplay.ml
  "dag_line_pre", dagDisplay.ml
  "date", historyDiffDisplay.ml, hutil.ml
  "date_begin"
  "date_end"
  "date_s"
  "dates", history.ml
  "day", templDate.ml, update_util.ml
  "day2"
  "ddmmyyyy", dateDisplay.ml
  "dead_dont_know_when", updateInd.ml
  "death", historyDiffDisplay.ml, updateInd.ml
  "death_age"
  "death_date"
  "death_day", updateFam.ml
  "death_month", updateFam.ml
  "death_note", historyDiffDisplay.ml, updateInd.ml
  "death_place", historyDiffDisplay.ml, updateFam.ml, updateInd.ml
  "death_source"
  "death_src", historyDiffDisplay.ml, updateInd.ml
  "death_witness"
  "death_year", updateFam.ml
  "debug"
  "desc_cnt"
  "desc_level"
  "desc_paths"
  "desc_paths_at_level"
  "desc_paths_at_level_cnt"
  "desc_paths_at_level_cnt_raw"
  "desc_paths_cnt"
  "desc_paths_cnt_raw"
  "descendant"
  "descendant_cnt"
  "descendant_level"
  "died"
  "died_young", updateInd.ml
  "digest", updateFam.ml, updateInd.ml
  "district", util.ml
  "divorce", historyDiffDisplay.ml, updateFam.ml
  "divorce_date"
  "dmyyyy", dateDisplay.ml
  "doctype"
  "dont_know_if_dead", updateInd.ml
  "dr_disappeared", updateInd.ml
  "dr_executed", updateInd.ml
  "dr_killed", updateInd.ml
  "dr_murdered", updateInd.ml
  "dr_unspecified", updateInd.ml
  "e_name", updateFam.ml, updateInd.ml
  "e_note", updateFam.ml, updateInd.ml
  "e_place", updateFam.ml, updateInd.ml
  "e_src", updateFam.ml, updateInd.ml
  "empty_sorted_list"
  "empty_sorted_listb"
  "empty_sorted_listc"
  "empty_sorted_listd"
  "empty_sorted_liste"
  "enclosing"
  "encode", updateDataDisplay.ml
  "entry", updateDataDisplay.ml
  "entry_ini", updateDataDisplay.ml
  "entry_key", updateDataDisplay.ml
  "entry_value", updateDataDisplay.ml
  "entry_value_rev", updateDataDisplay.ml
  "env"
  "env_binding"
  "evar", historyDiffDisplay.ml, updateDataDisplay.ml
  "evar_cur"
  "event", updateFam.ml, updateInd.ml
  "event_date", updateFam.ml, updateInd.ml
  "event_str", updateFam.ml, updateInd.ml
  "event_witness"
  "event_witness_kind"
  "event_witness_relation"
  "event_witness_relation_kind"
  "f_of_index"
  "false"
  "family", historyDiffDisplay.ml
  "family_cnt"
  "father", dagDisplay.ml, updateFam.ml
  "father_age_at_birth"
  "father_sosa"
  "fevent", historyDiffDisplay.ml, updateFam.ml
  "fevent_date", historyDiffDisplay.ml
  "fevent_name", historyDiffDisplay.ml
  "fevent_note", historyDiffDisplay.ml
  "fevent_place", historyDiffDisplay.ml
  "fevent_src", historyDiffDisplay.ml
  "fevent_witness", historyDiffDisplay.ml
  "first", updateDataDisplay.ml
  "first_name", history.ml, historyDiffDisplay.ml, updateFam.ml, updateInd.ml
  "first_name_alias", updateInd.ml
  "first_name_key"
  "first_name_key_strip"
  "first_name_key_val"
  "first_names_aliases", historyDiffDisplay.ml
  "found", history.ml
  "french", templDate.ml
  "friend"
  "fsources", historyDiffDisplay.ml, updateFam.ml
  "fwitness", updateFam.ml
  "fwitness_kind", updateFam.ml
  "get_var", dagDisplay.ml
  "green_of_hsv"
  "gregorian", templDate.ml
  "has_aliases", updateInd.ml
  "has_approx_birth_date"
  "has_approx_birth_place"
  "has_approx_death_date"
  "has_approx_death_place"
  "has_baptism_date"
  "has_baptism_note"
  "has_baptism_place"
  "has_baptism_source"
  "has_baptism_witnesses"
  "has_birth_date", updateInd.ml
  "has_birth_note"
  "has_birth_place"
  "has_birth_source"
  "has_birth_witnesses"
  "has_burial_date"
  "has_burial_note"
  "has_burial_place"
  "has_burial_source"
  "has_burial_witnesses"
  "has_children"
  "has_comment"
  "has_consanguinity"
  "has_cremation_date"
  "has_cremation_place"
  "has_cremation_witnesses"
  "has_date"
  "has_death_date"
  "has_death_note"
  "has_death_place"
  "has_death_source"
  "has_death_witnesses"
  "has_event"
  "has_families"
  "has_fevents", updateFam.ml
  "has_first_names_aliases", updateInd.ml
  "has_fsources"
  "has_fwitness", updateFam.ml
  "has_history", history.ml, srcfileDisplay.ml
  "has_image"
  "has_image_url"
  "has_linked_page"
  "has_linked_pages"
  "has_marriage_note"
  "has_marriage_source"
  "has_misc_notes", srcfileDisplay.ml
  "has_nephews_or_nieces"
  "has_next_sibling", dagDisplay.ml
  "has_nobility_titles"
  "has_note"
  "has_notes", srcfileDisplay.ml
  "has_occupation"
  "has_parents"
  "has_pevent_baptism", updateInd.ml
  "has_pevent_birth", updateInd.ml
  "has_pevent_burial", updateInd.ml
  "has_pevent_cremation", updateInd.ml
  "has_pevent_death", updateInd.ml
  "has_pevents", updateInd.ml
  "has_place"
  "has_possible_duplications"
  "has_prev_sibling", dagDisplay.ml
  "has_primary_pevents", updateInd.ml
  "has_psources"
  "has_public_name"
  "has_qualifiers", updateInd.ml
  "has_referer"
  "has_relation_her"
  "has_relation_him"
  "has_relations", updateInd.ml
  "has_secondary_pevents", updateInd.ml
  "has_siblings"
  "has_sosa"
  "has_sources"
  "has_spouse"
  "has_src"
  "has_surnames_aliases", updateInd.ml
  "has_titles", updateInd.ml
  "has_witness", updateInd.ml
  "has_witnesses"
  "head_title", dagDisplay.ml
  "hebrew", templDate.ml
  "hexa"
  "hidden"
  "highlight"
  "himher", updateFam.ml
  "history_file", history.ml
  "history_len", historyDiffDisplay.ml
  "history_line", history.ml, historyDiffDisplay.ml
  "hour", templDate.ml
  "hours"
  "ident"
  "ident_key"
  "image", historyDiffDisplay.ml, updateInd.ml
  "image_html_url"
  "image_medium_size"
  "image_prefix"
  "image_size"
  "image_small_size"
  "image_url"
  "include"
  "include_perso_header", updateFam.ml, updateInd.ml
  "incr_count", history.ml, updateDataDisplay.ml
  "incr_count1"
  "incr_count2"
  "incr_count3"
  "incr_next_pevent", updateInd.ml
  "index", dagDisplay.ml, templDate.ml, updateInd.ml
  "ini", updateDataDisplay.ml
  "init", srcfileDisplay.ml
  "init_cache"
  "initial", updateDataDisplay.ml
  "integer", hutil.ml
  "integer_range", hutil.ml
  "interp"
  "interval"
  "is_bar", dagDisplay.ml
  "is_buried"
  "is_center"
  "is_certainly_dead"
  "is_cremated"
  "is_dead"
  "is_descendant"
  "is_empty"
  "is_female", updateInd.ml
  "is_first", dagDisplay.ml, updateFam.ml, updateInd.ml
  "is_hr", dagDisplay.ml
  "is_hr_center", dagDisplay.ml
  "is_hr_left", dagDisplay.ml
  "is_hr_right", dagDisplay.ml
  "is_invisible", history.ml
  "is_last", dagDisplay.ml, updateFam.ml, updateInd.ml
  "is_left"
  "is_main"
  "is_male", updateInd.ml
  "is_modified", updateDataDisplay.ml
  "is_no_mention"
  "is_no_sexes_check"
  "is_note", history.ml
  "is_nothing", dagDisplay.ml
  "is_printed_by_template"
  "is_private"
  "is_public"
  "is_restricted"
  "is_right"
  "is_self"
  "is_sibling_after"
  "is_sibling_before"
  "is_substr"
  "is_top"
  "item", dagDisplay.ml
  "iz"
  "julian", templDate.ml
  "julian_day", templDate.ml
  "just_friend_wizard"
  "key", history.ml
  "lang"
  "language_name"
  "lazy_force"
  "lazy_print"
  "lazy_printed"
  "left"
  "length", updateDataDisplay.ml
  "lev_cnt"
  "level"
  "line", historyDiffDisplay.ml
  "line_nbr", dagDisplay.ml
  "link", updateInd.ml
  "link_next", dagDisplay.ml
  "linked_page"
  "list_size"
  "listb_size"
  "listc_size"
  "listd_size"
  "liste_size"
  "lvl"
  "manitou"
  "mark_descendants"
  "marriage", historyDiffDisplay.ml, updateFam.ml
  "marriage_age"
  "marriage_date"
  "marriage_note", updateFam.ml
  "marriage_place", historyDiffDisplay.ml, updateFam.ml
  "marriage_places"
  "marriage_source"
  "marriage_src", historyDiffDisplay.ml, updateFam.ml
  "marriage_type", historyDiffDisplay.ml
  "max", dagDisplay.ml, updateDataDisplay.ml
  "max_a"
  "max_anc_level"
  "max_cous_level"
  "max_d"
  "max_desc_level"
  "max_wid", dagDisplay.ml
  "message_to_wizard"
  "min", dagDisplay.ml
  "min_wid", dagDisplay.ml
  "minute", templDate.ml
  "minutes"
  "misc_names"
  "mmddyyyy", dateDisplay.ml
  "mn", history.ml
  "mode"
  "month", templDate.ml, update_util.ml
  "month2"
  "moon_age", templDate.ml
  "moon_phase", templDate.ml
  "mother", dagDisplay.ml
  "mother_age_at_birth"
  "mother_sosa"
  "mrel", updateFam.ml
  "name", srcfileDisplay.ml
  "nb_accesses", srcfileDisplay.ml
  "nb_accesses_to_welcome", srcfileDisplay.ml
  "nb_children"
  "nb_children_total"
  "nb_events"
  "nb_families", historyDiffDisplay.ml
  "nb_fevents", updateFam.ml
  "nb_ind"
  "nb_persons", srcfileDisplay.ml
  "nb_pevents", updateInd.ml
  "nb_results", updateDataDisplay.ml
  "nb_times"
  "nb_witnesses_attending"
  "nb_witnesses_civilofficer"
  "nb_witnesses_godparent"
  "nb_witnesses_informant"
  "nb_witnesses_mentioned"
  "nb_witnesses_other"
  "nb_witnesses_religiousofficer"
  "nb_witnesses_witness"
  "nbr"
  "nbr_a"
  "nbr_a_l"
  "ncol", dagDisplay.ml
  "next_item"
  "next_pevent", updateInd.ml
  "next_sibling", dagDisplay.ml
  "nn"
  "nob_title"
  "nobility_title"
  "not"
  "not_dead", updateInd.ml
  "note", history.ml
  "notes", historyDiffDisplay.ml, updateInd.ml
  "nth"
  "nth_c"
  "number_of_ancestors"
  "number_of_ancestors_at_level"
  "number_of_bases"
  "number_of_descendants"
  "number_of_descendants_at_level"
  "number_of_subitems"
  "occ", history.ml, historyDiffDisplay.ml, updateFam.ml, updateInd.ml
  "occupation", historyDiffDisplay.ml, updateFam.ml, updateInd.ml
  "octal"
  "of_course_dead", updateInd.ml
  "on_baptism_date"
  "on_birth_date"
  "on_burial_date"
  "on_cremation_date"
  "on_date"
  "on_death_date"
  "on_marriage_date"
  "or"
  "orday", update_util.ml
  "origin_file", historyDiffDisplay.ml, updateFam.ml
  "ormonth", update_util.ml
  "oryear", update_util.ml
  "other", updateDataDisplay.ml
  "p", updateDataDisplay.ml
  "p_of_index"
  "parent", updateFam.ml
  "part", history.ml
  "path"
  "path_at_level"
  "path_end"
  "person", history.ml, historyDiffDisplay.ml
  "person_index"
  "pevent", historyDiffDisplay.ml, updateInd.ml
  "pevent_date", historyDiffDisplay.ml
  "pevent_name", historyDiffDisplay.ml
  "pevent_note", historyDiffDisplay.ml
  "pevent_place", historyDiffDisplay.ml
  "pevent_src", historyDiffDisplay.ml
  "pevent_witness", historyDiffDisplay.ml
  "place"
  "place_key"
  "places"
  "plugin"
  "plugins"
  "pos", history.ml
  "prec", update_util.ml
  "prec_about", update_util.ml
  "prec_after", update_util.ml
  "prec_before", update_util.ml
  "prec_maybe", update_util.ml
  "prec_no", update_util.ml
  "prec_oryear", update_util.ml
  "prec_sure", update_util.ml
  "prec_yearint", update_util.ml
  "prefix"
  "prefix_base"
  "prefix_base_password"
  "prefix_no_all"
  "prefix_no_iz"
  "prefix_no_lang"
  "prefix_no_pmod"
  "prefix_no_templ"
  "prefix_no_wide"
  "prefix_set"
  "prev_fam_father"
  "prev_fam_index"
  "prev_fam_mother"
  "prev_family"
  "prev_item"
  "prev_sibling", dagDisplay.ml
  "printable", updateDataDisplay.ml
  "psources", historyDiffDisplay.ml
  "public_name", historyDiffDisplay.ml, updateInd.ml
  "pvar"
  "qualifier", updateInd.ml
  "qualifiers", historyDiffDisplay.ml
  "qvar"
  "r_father", updateInd.ml
  "r_mother", updateInd.ml
  "random", srcfileDisplay.ml
  "real_nb_persons", srcfileDisplay.ml
  "red_of_hsv"
  "referer"
  "region", util.ml
  "related"
  "related_type"
  "relation", updateInd.ml
  "relation_her"
  "relation_him"
  "relation_type"
  "relations", historyDiffDisplay.ml
  "reset_count", history.ml, updateDataDisplay.ml
  "reset_count1"
  "reset_count2"
  "reset_count3"
  "reset_desc_level"
  "right"
  "roman", templDate.ml
  "rt_adoption", updateInd.ml
  "rt_candidate_parent", updateInd.ml
  "rt_empty", updateInd.ml
  "rt_foster_parent", updateInd.ml
  "rt_godparent", updateInd.ml
  "rt_recognition", updateInd.ml
  "safe", updateDataDisplay.ml
  "same"
  "seconds"
  "self"
  "sep1000", templDate.ml
  "sep_date_s"
  "set_count"
  "set_infinite_desc_level"
  "set_var", dagDisplay.ml
  "setup_link"
  "sex", historyDiffDisplay.ml, updateFam.ml, updateInd.ml
  "slash_approx_birth_date"
  "slash_approx_death_date"
  "slash_baptism_date"
  "slash_birth_date"
  "slash_burial_date"
  "slash_cremation_date"
  "slash_death_date"
  "slash_divorce_date"
  "slash_marriage_date"
  "sorted_list_item"
  "sorted_listb_item"
  "sorted_listc_item"
  "sorted_listd_item"
  "sorted_liste_item"
  "sosa"
  "sosa_access"
  "sosa_anc"
  "sosa_anc_p"
  "sosa_in_list"
  "sosa_link"
  "sosa_next"
  "sosa_prev"
  "sosa_ref", srcfileDisplay.ml
  "sosa_ref_max_anc_level"
  "source"
  "source_type"
  "sources", updateInd.ml
  "sp"
  "spouse", historyDiffDisplay.ml
  "src"
  "start_date", srcfileDisplay.ml
  "static_max_anc_level", dagDisplay.ml
  "static_max_desc_level", dagDisplay.ml
  "static_path"
  "subs", updateDataDisplay.ml
  "substr", updateDataDisplay.ml
  "substr_start"
  "substr_start_e"
  "suburb", updateDataDisplay.ml
  "suffix"
  "supervisor"
  "surname", history.ml, historyDiffDisplay.ml, updateFam.ml, updateInd.ml
  "surname_alias", updateInd.ml
  "surname_begin"
  "surname_end"
  "surname_key"
  "surname_key_strip"
  "surname_key_val"
  "surnames_aliases", historyDiffDisplay.ml
  "svar"
  "t_estate", updateInd.ml
  "t_ident", updateInd.ml
  "t_main", updateInd.ml
  "t_name", updateInd.ml
  "t_nth", updateInd.ml
  "table", srcfileDisplay.ml
  "tail", updateDataDisplay.ml
  "text", dagDisplay.ml, update_util.ml
  "time", history.ml
  "title", history.ml, updateDataDisplay.ml, updateInd.ml
  "title_date_end", updateInd.ml
  "title_date_start", updateInd.ml
  "titles", historyDiffDisplay.ml
  "today", hutil.ml
  "town", util.ml
  "township", util.ml
  "transl_date", historyDiffDisplay.ml
  "true"
  "type"
  "update", history.ml
  "url"
  "url_no_pwd"
  "url_set"
  "url_set2"
  "url_set3"
  "url_set_pn"
  "user", history.ml
  "v", history.ml
  "val"
  "value", updateDataDisplay.ml
  "var", history.ml
  "version"
  "wcnt", updateFam.ml, updateInd.ml
  "wedding_birthday"
  "week_day", templDate.ml
  "witness", updateFam.ml, updateInd.ml
  "witness_attending"
  "witness_civilofficer"
  "witness_godparent"
  "witness_informant"
  "witness_kind", updateInd.ml
  "witness_mentioned"
  "witness_other"
  "witness_relation"
  "witness_religiousofficer"
  "witnesses", historyDiffDisplay.ml
  "wizard", historyDiffDisplay.ml
  "wiznotes_dir_exists", srcfileDisplay.ml
  "year", templDate.ml, update_util.ml
  "year2"
  "yymmdd", dateDisplay.ml
  "yyyymmdd", dateDisplay.ml

Note for has_event (v7)

Note that the has_event function does not consider birth, baptism, death and burial as "events" per se (as they are often already listed in the personnal data of the individual). If you want those events to be taken into account in this function, then you have to add has_events=always in your .gwf parameter file.

Note also that if has_events=never, then has_event always returns False.

JavaScript

JavaScript can be inserted anytime within templates. JavaScript code may contain template commands as in:

<script type="text/javascript">
  <!--
  function over1(xx)
  {
   document.getElementById(xx).style.%if;(evarso="on")outline="#C0FEFF solid 6px"%else;backgroundColor="#CBFECE"%end;;
   return false;
  }
  function out1(xx)
  {
   document.getElementById(xx).style.%if;(evarso="on")outline="none"%else;backgroundColor=""%end;;
   return false;
  }
  -->
</script>

Note that GeneWeb does not perform any language interpretation ([text to be translated]) within HTML comments!

Macros (%x)

See Macros for a description of their use and a better/updated table.

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:

%prefix;m=COMMAND;p=param1;n=param2; (or %sm=COMMAND... in notes and m=SRC .txt files)

This list does not claim to be exhaustive, and does not "explain" what each command does!

 "A"
 "AD"
 "ADD_FAM"
 "ADD_FAM_OK"
 "ADD_IND"
 "ADD_IND_OK"
 "ADD_PAR"
 "ADD_PAR_OK"
 "AM"
 "AN"
 "ANM"
 "AS_OK"
 "C"
 "CAL"
 "CAST"
 "CHANGE_WIZ_VIS"
 "CHG_CHN"
 "CHG_CHN_OK"
 "CHG_EVT_FAM_ORD"
 "CHG_EVT_FAM_ORD_OK"
 "CHG_EVT_IND_ORD"
 "CHG_EVT_IND_ORD_OK"
 "CHG_FAM_ORD"
 "CHG_FAM_ORD_OK"
 "CONN_WIZ"
 "D"
 "DAG" *
 "DATE"
 "DEL_FAM"
 "DEL_FAM_OK"
 "DEL_IMAGE"
 "DEL_IMAGE_OK"
 "DEL_IND"
 "DEL_IND_OK"
 "F"
 "FIXBASE"
 "FIXBASE_OK"
 "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"
 "IM" *
 "IMH" *
 "INV_FAM"
 "INV_FAM_OK"
 "KILL_ANC"
 "L"
 "LB"
 "LD"
 "LINKED"
 "LL"
 "LM"
 "LOG"
 "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_WIZNOTES"
 "MOD_WIZNOTES_OK"
 "MRG"
 "MRG_DUP"
 "MRG_DUP_FAM_Y_N"
 "MRG_DUP_IND_Y_N"
 "MRG_FAM"
 "MRG_FAM_OK"
 "MRG_IND"
 "MRG_IND_OK"
 "MRG_MOD_FAM_OK"
 "MRG_MOD_IND_OK"
 "N"
 "NAME"
 "NG"
 "NOTES"
 "OA"
 "OE"
 "OPT"
 "P"
 "POP_PYR"
 "PPS"
 "PS"
 "R"
 "REQUEST"
 "RL"
 "RLM" *
 "S"
 "SND_IMAGE"
 "SND_IMAGE_OK"
 "SRC" *
 "STAT"
 "TP"
 "TT"
 "U"
 "VIEW_WIZNOTES" *
 "WIZNOTES" *
 "WIZNOTES_SEARCH" *

Commands marked with a * are documented below:

Environnement and configuration

GeneWeb propose a general-purpose mechanism allowing the user/programmer to extend at will the notion of variable described here.

Configuration variables

If a new variable is defined in the .gwf configuration file, then it will be possible to test for the value of this variable in the context of a template file. For instance, if we have added

new_var=some-text

in .gwf, then the following code in the template will be able to perform some specific action:

%if; (bvar.new_var = "sometext" ) 
    ... perform some specific action ...
%end;

Personal variables

The special variable var is treated in the following fashion within notes, sources and comments: If you define in the .gwf file a variable var_text=some_text, then calling the macro %vtext; in a note or a template will produce the text some_text as in the following example:

var_who=Bond, James Bond

"My name is %vwho;." in a note will be transformed into "My name is Bond, James Bond.".

This feature is used by some to facilitate the signature of sources. The .gwf file contains a list of var_nickname definitions whose value is a full name and possibly a pointer to a page containing more detailed information:

var_henri=<a href="http://site/base?p=Firstname;n=lastname">First_name Lastname</a>

(no %x or %macro; in the value of the parameter!!).

Note: in latest version 7 of GeneWeb, the wiki syntax can be used in the parameter as in:

var_who=[[james/bond/James Bond]]

which will include the text "James Bond" and a link to the corresponding page.

Environment variables (evar/e)

Environment variables are variables used by templates to modify the behaviour of pages. They are available in the query string of the URL and can be called to obtain their value with “{c|%evar.variable_name;}} or shorter Template:%e.variable name; since v7.1.

Examples with a query string that is ?lang=fr&m=A&t=T&p=first_name&n=lastname&v=7, to check if…

  • … the language is English: %if;(evar.lang="en")…%end;.
  • … the individual has a first_name and a surname defined: %if;(e.p!="" and e.n!="")…%end;.
  • … the number of generations is lower than 10: %if;(e.v<10)…%end;.

Out of templates, there are potentially few environment variables used in .ml code that are parts of conf.env (to be searched with p_getenv in files.

See also “gwd#Some frequently used evars” for more examples.

Bvar variables used in templates

 access_by_key
 always_surname
 auth_file
 authorized_wizards_notes
 base_notes_title
 birth_symbol
 can_kill_ancestors
 can_send_image
 carrousel
 com
 counter
 css
 css_prop
 datalist_fn
 datalist_occu
 datalist_place
 datalist_sn
 datalist_src
 datalist_z
 death_symbol
 default_fnav_images
 default_fnav_semi
 default_fnav_spouse
 default_image
 default_image_no
 default_lang
 default_sosa_ref
 defaut_lang
 disable_forum
 display_sosa
 display_timeline
 event_age
 fn_sn_switch
 friend_passwd
 friend_passwd_file
 full_siblings
 hide_advanced_request
 history
 history_diff
 jquery
 latest_event
 max_anc_level
 max_anc_tree
 max_cousins_level
 max_dates
 max_desc_level
 max_desc_tree
 max_rlm_nbr
 maxlev
 menu
 misc
 module_perso_ix
 module_perso_tplnb
 motd
 move_comment
 moved
 multi_parents
 no_image_for_visitor
 no_note_for_visitor
 notextarea
 origin_file
 p_mod
 particles
 perso_module_modnum
 perso_module_tplnum
 plugins
 propose_add_family
 propose_alias
 propose_place_surnames
 propose_qualifier
 propose_titles
 setup_http
 setup_link
 show_consang
 show_flag
 show_invisible
 static_path
 template
 timeline
 tuxfamily
 txt
 uppercase
 use_cdn
 var_img_ext
 var_t_BIRTHA
 var_t_DEATHA
 var_t_MARRIAGEA
 visitor_access
 visitor_access_msg_en
 visitor_access_msg_lg
 welcome_logo
 welcome_logo_style
 wide
 wizard_descr_file
 wizard_just_friend
 wizard_passwd
 wizard_passwd_file

Bvar variables used by Gwd

always_surname, yes
auth_file
base_notes_title
body_prop
can_kill_ancestors
can_send_image, no
conf.base_env
counter, no
death_symbol, †
default_sosa_ref
disable_forum, yes
dump_bad_images, yes
expand_env
fast_alphabetic, yes
forum_exclude_file
friend_passwd
friend_passwd_file
has_events
history, yes
history_diff
history_path
image_prefix
images_path
latest_event
long_date, yes
max_anc_tree
max_ancestor_implex
max_cousins
max_desc_level
max_desc_tree
max_images_size
max_nb_update
max_rlm_nbr
moderator_file
no
notes_alias_file
notify_change
passwd_
place
place_surname_link_to_ind, yes
places_inverted, yes
print_advanced_title, yes
propose_add_family, no
ptempl, yes
red_if_not_exist
short_place_threshold
show_query_time
static_path
template
var_
visitor_access, no
wizard_descr_file
wizard_passwd_file

The bvar name is sometimes followed by one of its options (yes/no)

Building trees through direct url construction

See trees or trees/fr


GeneWeb Manual

Rembrandt Old Man Reading a Book.jpg

Use and manage genealogical databases

Technical annex