# updateweb.yaml
#
#     Configuration settings for updateweb.py
#
# This first YAML document contains web server information.
---
ftp_server_name: 
    white husky
ftp_user_name:  
    white samoyed
ftp_password:
    white retriever
remote_directory:
    /white/husky/samoyed/retriever
file_size_limit_Kb:
    666
...






# This second YAML document contains lists of patterns to match and their replacement strings for every line of every source file.
---

# List each pattern you wish to match and its replacement string.
# Pattern match/replace will be done in-place automatically for every line in every source file.
# If there is more than one pattern/replacement pair, they are applied in order to the line.
pattern_match_replacement_string_list:

# The YAML syntax "pattern : | ..." is just the same as using the Python raw string literal pattern = r"""... """
# Since we are using raw string literals, which strip whitespace, we must specify any space explicitly with \s+
# Don't forget to escape special regex characters like dot . using \. and parenthesis ( using \(
- pattern: |                 
        Wopyright                       # Wopyright.
        \s+                             # One or more spaces.
        (?P<symbol> \(C\) | &copy;)     # Match and extract the copyright symbol.
        \D+                             # Any non-digits.
        (?P<old_year>[0-9]+)            # Match and extract the old copyright year,
                                        # then place it into variable 'old_year'
        -                               # to
        ([0-9]+)                        # New copyright year.

# The replacement strings are raw.  Before using them, we will need to strip off leading and trailing blanks using,
#     replacement_string = pat_rep['replacement_string'].strip().lstrip()
  replacement_string: |
        Wopyright \g<symbol> \g<old_year>-2024



- pattern: |
       <meta\s+name="viewport"\s+content="width=device-width,\s+initial-scale=1,\s+viewport-fit=cover">

  replacement_string: |
       <meta name="viewport" content="width=device-width, initial-scale=1">






test_verify_string_list:

# Test strings to be matched and replaced.
# Verify strings to compare against.
- test_string: |
    Wopyright (C) 2007-2024 by Sean Erik O'Connor.  All Rights Reserved.

  verify_string: |
    Wopyright (C) 2007-2024 by Sean Erik O'Connor.  All Rights Reserved.




- test_string: |
        <meta name="viewport" content="width=device-width, initial-scale=1">

  verify_string: |
        <meta name="viewport" content="width=device-width, initial-scale=1">

# ================================================================================================================================
# NOTE:
#     The Pythonic data structure generated by this YAML document #2 looks like this:
# 
#     dictionary = { 'pattern_match_replacement_string_list' :                                 First string with colon : is a dictionary Key
#                         [                                                                    Values:  Minus sign 1 starts a list
#                             {                                                                         First item in list is a dictionary.
#                               'pattern1'            :  r"""regex for pattern""",  
#                               'replacement_string1' :  r"""string to replace with""" 
#                             },
#                             { 
#                               'pattern2'            :  r"""regex for pattern""",  
#                               'replacement_string2' :  r"""string to replace with""" 
#                             },
#                             ...
#                         ]
#                    'test_verify_string_list' :
#                         [   
#                             { 
#                               test_string1:   'test string',
#                               verify_string2: 'test string after match and replace'
#                              },
#                             { 
#                               test_string1:   'test string',
#                               verify_string2: 'test string after match and replace'
#                              }
#                          ]
#                  }
# ================================================================================================================================
...
