<commit_before>import os
from docutils.parsers import rst
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
from docutils.nodes import fully_normalize_name, whitespace_normalize_name
from docutils.parsers.rst.roles import set_classes
from docutils import nodes
from pelican import signals
from pelican import StaticGenerator

# If Pillow is not available, it's not an error unless one uses the image grid
# functionality
try:
    import PIL.Image
    import PIL.ExifTags
except ImportError:
    PIL = None

settings = {}

def configure(pelicanobj):
    settings['path'] = pelicanobj.settings.get('PATH', 'content')
    pass

class Image(Directive):
    """Image directive

    Copy of docutils.parsers.rst.directives.Image with some default classes
    added on top.
    """

    required_arguments = 1
    optional_arguments = 0
    final_argument_whitespace = True
    option_spec = {'alt': directives.unchanged,
                   'name': directives.unchanged,
                   'class': directives.class_option}

    def run(self):
        messages = []
        reference = directives.uri(self.arguments[0])
        self.options['uri'] = reference
        reference_node = None
        if 'target' in self.options:
            block = states.escape2null(
                self.options['target']).splitlines()<commit_msg>m.images: properly support the image :target: option.<commit_after>import os
from docutils.parsers import rst
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives, states
from docutils.nodes import fully_normalize_name, whitespace_normalize_name
from docutils.parsers.rst.roles import set_classes
from docutils import nodes
from pelican import signals
from pelican import StaticGenerator

# If Pillow is not available, it's not an error unless one uses the image grid
# functionality
try:
    import PIL.Image
    import PIL.ExifTags
except ImportError:
    PIL = None

settings = {}

def configure(pelicanobj):
    settings['path'] = pelicanobj.settings.get('PATH', 'content')
    pass

class Image(Directive):
    """Image directive

    Copy of docutils.parsers.rst.directives.Image with:

    -   the align, scale, width, height options removed (handled better by
        m.css)
    -   .m-image CSS class added
    """

    required_arguments = 1
    optional_arguments = 0
    final_argument_whitespace = True
    option_spec = {'alt': directives.unchanged,
                   'name': directives.unchanged,
                   'class': directives.class_option,
                   'target': directives.unchanged_required}

    def run(self):
        messages = []
        reference = directives.uri(self.arguments[0])
        self.options['uri'] = reference
        reference_node = None
        if 'target' in self.options:
            block = states.escape2null(
                self.options['target']).splitlines()
{'fraction_non_alphanumeric': 0.08401920438957476, 'fraction_numerical': 0.0027434842249657062, 'mean_word_length': 3.108450704225352, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3279952', 'n_tokens_mistral': 835, 'n_tokens_neox': 789, 'n_words': 237}