Module:SetDateRange/doc: Difference between revisions

From The Seven Sages of Rome
No edit summary
No edit summary
Line 1: Line 1:
== Module Documentation: SetDateRange ==
== Module Documentation: SetDateRange ==


This module is used to determine and set appropriate date properties for sorting and display. It takes various date inputs, prioritises them based on availability, and sets corresponding Semantic MediaWiki properties.
This module is used in Semantic MediaWiki to determine and set appropriate date properties for sorting and display. It takes various date inputs, prioritizes them based on availability, and sets corresponding Semantic MediaWiki properties.


=== Usage ===
=== Usage ===
Line 18: Line 18:


=== Parameters ===
=== Parameters ===
* **fixed_date**: A fixed date value (YYYY-MM-DD format, converted to YYYY/MM/DD for consistency)
* '''fixed_date''': A fixed date value (YYYY-MM-DD format, converted to YYYY/MM/DD for consistency)
* **start_date**: The beginning date of a range
* '''start_date''': The beginning date of a range
* **end_date**: The ending date of a range
* '''end_date''': The ending date of a range
* **islamic_date**: Optional Islamic calendar date
* '''islamic_date''': Optional Islamic calendar date
* **hebrew_date**: Optional Hebrew calendar date
* '''hebrew_date''': Optional Hebrew calendar date
* **date_range_property**: The Semantic MediaWiki property where the displayed date range will be stored
* '''date_range_property''': The Semantic MediaWiki property where the displayed date range will be stored
* **sort_date_property**: The Semantic MediaWiki property where the sorting date will be stored
* '''sort_date_property''': The Semantic MediaWiki property where the sorting date will be stored


=== Behavior ===
=== Behavior ===
# If a `fixed_date` is provided, it is used for both display and sorting.
# If a '''fixed_date''' is provided, it is used for both display and sorting.
# If `start_date` and `end_date` are both provided, a date range is created with `start_date` as the sorting date.
# If '''start_date''' and '''end_date''' are both provided, a date range is created with '''start_date''' as the sorting date.
# If only `start_date` is available, it is used for both display and sorting.
# If only '''start_date''' is available, it is used for both display and sorting.
# If only `end_date` is available, it is used for both display and sorting.
# If only '''end_date''' is available, it is used for both display and sorting.
# If `islamic_date` or `hebrew_date` are provided, they are added to the display output along with tooltips explaining their meaning.
# If '''islamic_date''' or '''hebrew_date''' are provided, they are added to the display output along with tooltips explaining their meaning.
# The generated output includes Bootstrap 4 tooltips for `AH` (Anno Hegirae, Islamic calendar) and `AM` (Anno Mundi, Hebrew calendar).
# The generated output includes Bootstrap 4 tooltips for '''AH''' (Anno Hegirae, Islamic calendar) and '''AM''' (Anno Mundi, Hebrew calendar).


=== Example Output ===
=== Example Output ===
If a manuscript has a start date of `1500-01-01`, an end date of `1500-12-31`, an Islamic date of `905`, and a Hebrew date of `5260`, the rendered output might look like:
If a manuscript has a start date of '''1500-01-01''', an end date of '''1500-12-31''', an Islamic date of '''905''', and a Hebrew date of '''5260''', the rendered output might look like:


<blockquote>
<pre>
1500/01/01 - 1500/12/31 (<span data-toggle="tooltip" title="Anno Hegirae (Islamic calendar)">905<sup>AH</sup></span>) (<span data-toggle="tooltip" title="Anno Mundi (Hebrew calendar)">5260<sup>AM</sup></span>)
1500/01/01 - 1500/12/31 (<span data-toggle="tooltip" title="Anno Hegirae (Islamic calendar)">905<sup>AH</sup></span>) (<span data-toggle="tooltip" title="Anno Mundi (Hebrew calendar)">5260<sup>AM</sup></span>)
</blockquote>
</pre>


=== Notes ===
=== Notes ===
- Bootstrap 4 tooltips require initialization via JavaScript:
* Bootstrap 4 tooltips require initialization via JavaScript:


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
Line 50: Line 50:
</syntaxhighlight>
</syntaxhighlight>


- Ensure that the required Semantic MediaWiki properties are correctly defined in your wiki configuration.
* Ensure that the required Semantic MediaWiki properties are correctly defined in your wiki configuration.


This module enhances the display and semantic organization of historical dates, including cross-calendar representation, for improved research and usability.
This module enhances the display and semantic organization of historical dates, including cross-calendar representation, for improved research and usability.

Revision as of 09:14, 25 March 2025

Module Documentation: SetDateRange

This module is used in Semantic MediaWiki to determine and set appropriate date properties for sorting and display. It takes various date inputs, prioritizes them based on availability, and sets corresponding Semantic MediaWiki properties.

Usage

To invoke this module, use the following syntax within a template:

{{#invoke:SetDateRange|set
 | fixed_date={{{Has Date Of Text Composition|}}}
 | start_date={{{Has Start Date Of Composition|}}}
 | end_date={{{Has End Date Of Composition|}}}
 | islamic_date={{{Has Islamic Date Of Text Composition|}}}
 | hebrew_date={{{Has Hebrew Date Of Text Composition|}}}
 | date_range_property=Has Date Range Of Text Composition
 | sort_date_property=Has Sort Date Of Text Composition}}

Parameters

  • fixed_date: A fixed date value (YYYY-MM-DD format, converted to YYYY/MM/DD for consistency)
  • start_date: The beginning date of a range
  • end_date: The ending date of a range
  • islamic_date: Optional Islamic calendar date
  • hebrew_date: Optional Hebrew calendar date
  • date_range_property: The Semantic MediaWiki property where the displayed date range will be stored
  • sort_date_property: The Semantic MediaWiki property where the sorting date will be stored

Behavior

  1. If a fixed_date is provided, it is used for both display and sorting.
  2. If start_date and end_date are both provided, a date range is created with start_date as the sorting date.
  3. If only start_date is available, it is used for both display and sorting.
  4. If only end_date is available, it is used for both display and sorting.
  5. If islamic_date or hebrew_date are provided, they are added to the display output along with tooltips explaining their meaning.
  6. The generated output includes Bootstrap 4 tooltips for AH (Anno Hegirae, Islamic calendar) and AM (Anno Mundi, Hebrew calendar).

Example Output

If a manuscript has a start date of 1500-01-01, an end date of 1500-12-31, an Islamic date of 905, and a Hebrew date of 5260, the rendered output might look like:

1500/01/01 - 1500/12/31 (<span data-toggle="tooltip" title="Anno Hegirae (Islamic calendar)">905<sup>AH</sup></span>) (<span data-toggle="tooltip" title="Anno Mundi (Hebrew calendar)">5260<sup>AM</sup></span>)

Notes

  • Bootstrap 4 tooltips require initialization via JavaScript:
$(document).ready(function() {
    $('[data-toggle="tooltip"]').tooltip();
});
  • Ensure that the required Semantic MediaWiki properties are correctly defined in your wiki configuration.

This module enhances the display and semantic organization of historical dates, including cross-calendar representation, for improved research and usability.