#!/usr/bin/python3
# -*- coding: utf-8 -*-
################################################################################
#    Anceps Copyright (C) 2014 Suizokukan
#    Contact: suizokukan _A.T._ orange dot fr
#
#    This file is part of Anceps.
#    Anceps is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Anceps is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Anceps.  If not, see <http://www.gnu.org/licenses/>.
################################################################################
"""
    ❏Anceps❏ : anceps/lectiones/lat.py

        Latin text substitutions.
"""

from anceps.messages.messages import debug as debug
from anceps.lectiones.all_languages import substitution_based_on_makron, \
                                           substitution_based_on_makron_but_not_if_2nd_part_of_a_diphthong

#///////////////////////////////////////////////////////////////////////////////
def lectio_lat_a_vowel(dstring_type, notes_and_texts):
    """
        DESCRIPTION :
                a -> a/ā

        PARAMETERS :
        o dstring_type          : DSTRING object (confer DChars library)
        o notes_and_texts       : [ [note, (dstring)line1\nline2\nline3...] ]
    """
    return substitution_based_on_makron(dstring_type = dstring_type,
                                        notes_and_texts = notes_and_texts,
                                        base_char = "a")

#///////////////////////////////////////////////////////////////////////////////
def lectio_lat_e_vowel(dstring_type, notes_and_texts):
    """
        DESCRIPTION :
                e -> e/ē, except in 'ae' -> 'ae', 'oe' -> 'oe'

        PARAMETERS :
        o dstring_type          : DSTRING object (confer DChars library)
        o notes_and_texts       : [ [note, (dstring)line1\nline2\nline3...] ]
    """
    return substitution_based_on_makron_but_not_if_2nd_part_of_a_diphthong(dstring_type = dstring_type,
                                                                           notes_and_texts = notes_and_texts,
                                                                           base_char = "e",
                                                                           diphthongs = ("ae", "oe"))

#///////////////////////////////////////////////////////////////////////////////
def lectio_lat_i_vowel(dstring_type, notes_and_texts):
    """
        DESCRIPTION :
                i -> i/ī, except in 'ei' -> 'ei'

        PARAMETERS :
        o dstring_type          : DSTRING object (confer DChars library)
        o notes_and_texts       : [ [note, (dstring)line1\nline2\nline3...] ]
    """
    return substitution_based_on_makron_but_not_if_2nd_part_of_a_diphthong(dstring_type = dstring_type,
                                                                           notes_and_texts = notes_and_texts,
                                                                           base_char = "i",
                                                                           diphthongs = ("ei",))

#///////////////////////////////////////////////////////////////////////////////
def lectio_lat_o_vowel(dstring_type, notes_and_texts):
    """
        DESCRIPTION :
                o -> o/ō

        PARAMETERS :
        o dstring_type          : DSTRING object (confer DChars library)
        o notes_and_texts       : [ [note, (dstring)line1\nline2\nline3...] ]
    """
    return substitution_based_on_makron(dstring_type = dstring_type,
                                        notes_and_texts = notes_and_texts,
                                        base_char = "o")

#///////////////////////////////////////////////////////////////////////////////
def lectio_lat_u_vowel(dstring_type, notes_and_texts):
    """
        DESCRIPTION :
                u -> u/ū, except in 'eu' -> 'eu', 'au' -> 'au'

        PARAMETERS :
        o dstring_type          : DSTRING object (confer DChars library)
        o notes_and_texts       : [ [note, (dstring)line1\nline2\nline3...] ]
    """
    return substitution_based_on_makron_but_not_if_2nd_part_of_a_diphthong(dstring_type = dstring_type,
                                                                           notes_and_texts = notes_and_texts,
                                                                           base_char = "u",
                                                                           diphthongs = ("eu", 'au'))

#///////////////////////////////////////////////////////////////////////////////
def lectio_lat_y_vowel(dstring_type, notes_and_texts):
    """
        DESCRIPTION :
                y -> y/ȳ

        PARAMETERS :
        o dstring_type          : DSTRING object (confer DChars library)
        o notes_and_texts       : [ [note, (dstring)line1\nline2\nline3...] ]
    """
    return substitution_based_on_makron(dstring_type = dstring_type,
                                        notes_and_texts = notes_and_texts,
                                        base_char = "y")
