diff --git a/server/dump/activity.bson.gz b/server/dump/activity.bson.gz new file mode 100644 index 0000000..2564336 Binary files /dev/null and b/server/dump/activity.bson.gz differ diff --git a/server/dump/activity.metadata.json.gz b/server/dump/activity.metadata.json.gz new file mode 100644 index 0000000..01250d7 Binary files /dev/null and b/server/dump/activity.metadata.json.gz differ diff --git a/server/dump/agenda.bson.gz b/server/dump/agenda.bson.gz new file mode 100644 index 0000000..5e080d7 Binary files /dev/null and b/server/dump/agenda.bson.gz differ diff --git a/server/dump/agenda.metadata.json.gz b/server/dump/agenda.metadata.json.gz new file mode 100644 index 0000000..7557140 Binary files /dev/null and b/server/dump/agenda.metadata.json.gz differ diff --git a/server/dump/archive.bson.gz b/server/dump/archive.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/archive.bson.gz differ diff --git a/server/dump/archive.metadata.json.gz b/server/dump/archive.metadata.json.gz new file mode 100644 index 0000000..48c4bc9 Binary files /dev/null and b/server/dump/archive.metadata.json.gz differ diff --git a/server/dump/archive_autosave.bson.gz b/server/dump/archive_autosave.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/archive_autosave.bson.gz differ diff --git a/server/dump/archive_autosave.metadata.json.gz b/server/dump/archive_autosave.metadata.json.gz new file mode 100644 index 0000000..b89d9e4 Binary files /dev/null and b/server/dump/archive_autosave.metadata.json.gz differ diff --git a/server/dump/archive_history.bson.gz b/server/dump/archive_history.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/archive_history.bson.gz differ diff --git a/server/dump/archive_history.metadata.json.gz b/server/dump/archive_history.metadata.json.gz new file mode 100644 index 0000000..526cec7 Binary files /dev/null and b/server/dump/archive_history.metadata.json.gz differ diff --git a/server/dump/archive_versions.bson.gz b/server/dump/archive_versions.bson.gz new file mode 100644 index 0000000..c01c65b Binary files /dev/null and b/server/dump/archive_versions.bson.gz differ diff --git a/server/dump/archive_versions.metadata.json.gz b/server/dump/archive_versions.metadata.json.gz new file mode 100644 index 0000000..dd04c16 Binary files /dev/null and b/server/dump/archive_versions.metadata.json.gz differ diff --git a/server/dump/archive_versions_versions.bson.gz b/server/dump/archive_versions_versions.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/archive_versions_versions.bson.gz differ diff --git a/server/dump/archive_versions_versions.metadata.json.gz b/server/dump/archive_versions_versions.metadata.json.gz new file mode 100644 index 0000000..46479a8 Binary files /dev/null and b/server/dump/archive_versions_versions.metadata.json.gz differ diff --git a/server/dump/assignments.bson.gz b/server/dump/assignments.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/assignments.bson.gz differ diff --git a/server/dump/assignments.metadata.json.gz b/server/dump/assignments.metadata.json.gz new file mode 100644 index 0000000..c208b3a Binary files /dev/null and b/server/dump/assignments.metadata.json.gz differ diff --git a/server/dump/audit.bson.gz b/server/dump/audit.bson.gz new file mode 100644 index 0000000..fdeb975 Binary files /dev/null and b/server/dump/audit.bson.gz differ diff --git a/server/dump/audit.metadata.json.gz b/server/dump/audit.metadata.json.gz new file mode 100644 index 0000000..82d0396 Binary files /dev/null and b/server/dump/audit.metadata.json.gz differ diff --git a/server/dump/auth.bson.gz b/server/dump/auth.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/auth.bson.gz differ diff --git a/server/dump/auth.metadata.json.gz b/server/dump/auth.metadata.json.gz new file mode 100644 index 0000000..1556689 Binary files /dev/null and b/server/dump/auth.metadata.json.gz differ diff --git a/server/dump/concept_items.bson.gz b/server/dump/concept_items.bson.gz new file mode 100644 index 0000000..b45391b Binary files /dev/null and b/server/dump/concept_items.bson.gz differ diff --git a/server/dump/concept_items.metadata.json.gz b/server/dump/concept_items.metadata.json.gz new file mode 100644 index 0000000..fb00b52 Binary files /dev/null and b/server/dump/concept_items.metadata.json.gz differ diff --git a/server/dump/config.bson.gz b/server/dump/config.bson.gz new file mode 100644 index 0000000..c32f032 Binary files /dev/null and b/server/dump/config.bson.gz differ diff --git a/server/dump/config.metadata.json.gz b/server/dump/config.metadata.json.gz new file mode 100644 index 0000000..5e33fe2 Binary files /dev/null and b/server/dump/config.metadata.json.gz differ diff --git a/server/dump/contacts.bson.gz b/server/dump/contacts.bson.gz new file mode 100644 index 0000000..de7b624 Binary files /dev/null and b/server/dump/contacts.bson.gz differ diff --git a/server/dump/contacts.metadata.json.gz b/server/dump/contacts.metadata.json.gz new file mode 100644 index 0000000..23fe39e Binary files /dev/null and b/server/dump/contacts.metadata.json.gz differ diff --git a/server/dump/content_filters.bson.gz b/server/dump/content_filters.bson.gz new file mode 100644 index 0000000..d9ef6d7 Binary files /dev/null and b/server/dump/content_filters.bson.gz differ diff --git a/server/dump/content_filters.metadata.json.gz b/server/dump/content_filters.metadata.json.gz new file mode 100644 index 0000000..40da06d Binary files /dev/null and b/server/dump/content_filters.metadata.json.gz differ diff --git a/server/dump/content_templates.bson.gz b/server/dump/content_templates.bson.gz new file mode 100644 index 0000000..0d8194c Binary files /dev/null and b/server/dump/content_templates.bson.gz differ diff --git a/server/dump/content_templates.metadata.json.gz b/server/dump/content_templates.metadata.json.gz new file mode 100644 index 0000000..10578ad Binary files /dev/null and b/server/dump/content_templates.metadata.json.gz differ diff --git a/server/dump/content_types.bson.gz b/server/dump/content_types.bson.gz new file mode 100644 index 0000000..cee817d Binary files /dev/null and b/server/dump/content_types.bson.gz differ diff --git a/server/dump/content_types.metadata.json.gz b/server/dump/content_types.metadata.json.gz new file mode 100644 index 0000000..473d029 Binary files /dev/null and b/server/dump/content_types.metadata.json.gz differ diff --git a/server/dump/data_updates.bson.gz b/server/dump/data_updates.bson.gz new file mode 100644 index 0000000..0795094 Binary files /dev/null and b/server/dump/data_updates.bson.gz differ diff --git a/server/dump/data_updates.metadata.json.gz b/server/dump/data_updates.metadata.json.gz new file mode 100644 index 0000000..bce77d1 Binary files /dev/null and b/server/dump/data_updates.metadata.json.gz differ diff --git a/server/dump/delivery.bson.gz b/server/dump/delivery.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/delivery.bson.gz differ diff --git a/server/dump/delivery.metadata.json.gz b/server/dump/delivery.metadata.json.gz new file mode 100644 index 0000000..734e402 Binary files /dev/null and b/server/dump/delivery.metadata.json.gz differ diff --git a/server/dump/desks.bson.gz b/server/dump/desks.bson.gz new file mode 100644 index 0000000..2a79ecc Binary files /dev/null and b/server/dump/desks.bson.gz differ diff --git a/server/dump/desks.metadata.json.gz b/server/dump/desks.metadata.json.gz new file mode 100644 index 0000000..249c3ce Binary files /dev/null and b/server/dump/desks.metadata.json.gz differ diff --git a/server/dump/email_timestamps.bson.gz b/server/dump/email_timestamps.bson.gz new file mode 100644 index 0000000..f15e003 Binary files /dev/null and b/server/dump/email_timestamps.bson.gz differ diff --git a/server/dump/email_timestamps.metadata.json.gz b/server/dump/email_timestamps.metadata.json.gz new file mode 100644 index 0000000..7997a36 Binary files /dev/null and b/server/dump/email_timestamps.metadata.json.gz differ diff --git a/server/dump/event_autosave.bson.gz b/server/dump/event_autosave.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/event_autosave.bson.gz differ diff --git a/server/dump/event_autosave.metadata.json.gz b/server/dump/event_autosave.metadata.json.gz new file mode 100644 index 0000000..a183d36 Binary files /dev/null and b/server/dump/event_autosave.metadata.json.gz differ diff --git a/server/dump/events.bson.gz b/server/dump/events.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/events.bson.gz differ diff --git a/server/dump/events.metadata.json.gz b/server/dump/events.metadata.json.gz new file mode 100644 index 0000000..7c8ef28 Binary files /dev/null and b/server/dump/events.metadata.json.gz differ diff --git a/server/dump/events_planning_filters.bson.gz b/server/dump/events_planning_filters.bson.gz new file mode 100644 index 0000000..49c3d57 Binary files /dev/null and b/server/dump/events_planning_filters.bson.gz differ diff --git a/server/dump/events_planning_filters.metadata.json.gz b/server/dump/events_planning_filters.metadata.json.gz new file mode 100644 index 0000000..5dec381 Binary files /dev/null and b/server/dump/events_planning_filters.metadata.json.gz differ diff --git a/server/dump/filter_conditions.bson.gz b/server/dump/filter_conditions.bson.gz new file mode 100644 index 0000000..7555abc Binary files /dev/null and b/server/dump/filter_conditions.bson.gz differ diff --git a/server/dump/filter_conditions.metadata.json.gz b/server/dump/filter_conditions.metadata.json.gz new file mode 100644 index 0000000..6359a35 Binary files /dev/null and b/server/dump/filter_conditions.metadata.json.gz differ diff --git a/server/dump/fs.chunks.bson.gz b/server/dump/fs.chunks.bson.gz new file mode 100644 index 0000000..7f0f8b7 Binary files /dev/null and b/server/dump/fs.chunks.bson.gz differ diff --git a/server/dump/fs.chunks.metadata.json.gz b/server/dump/fs.chunks.metadata.json.gz new file mode 100644 index 0000000..0986bfb Binary files /dev/null and b/server/dump/fs.chunks.metadata.json.gz differ diff --git a/server/dump/fs.files.bson.gz b/server/dump/fs.files.bson.gz new file mode 100644 index 0000000..d18c317 Binary files /dev/null and b/server/dump/fs.files.bson.gz differ diff --git a/server/dump/fs.files.metadata.json.gz b/server/dump/fs.files.metadata.json.gz new file mode 100644 index 0000000..3a2a8e3 Binary files /dev/null and b/server/dump/fs.files.metadata.json.gz differ diff --git a/server/dump/highlights.bson.gz b/server/dump/highlights.bson.gz new file mode 100644 index 0000000..62b895c Binary files /dev/null and b/server/dump/highlights.bson.gz differ diff --git a/server/dump/highlights.metadata.json.gz b/server/dump/highlights.metadata.json.gz new file mode 100644 index 0000000..a0861dc Binary files /dev/null and b/server/dump/highlights.metadata.json.gz differ diff --git a/server/dump/ingest.bson.gz b/server/dump/ingest.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/ingest.bson.gz differ diff --git a/server/dump/ingest.metadata.json.gz b/server/dump/ingest.metadata.json.gz new file mode 100644 index 0000000..9b6b18d Binary files /dev/null and b/server/dump/ingest.metadata.json.gz differ diff --git a/server/dump/ingest_providers.bson.gz b/server/dump/ingest_providers.bson.gz new file mode 100644 index 0000000..7356698 Binary files /dev/null and b/server/dump/ingest_providers.bson.gz differ diff --git a/server/dump/ingest_providers.metadata.json.gz b/server/dump/ingest_providers.metadata.json.gz new file mode 100644 index 0000000..011e89f Binary files /dev/null and b/server/dump/ingest_providers.metadata.json.gz differ diff --git a/server/dump/internal_destinations.bson.gz b/server/dump/internal_destinations.bson.gz new file mode 100644 index 0000000..4daa2dc Binary files /dev/null and b/server/dump/internal_destinations.bson.gz differ diff --git a/server/dump/internal_destinations.metadata.json.gz b/server/dump/internal_destinations.metadata.json.gz new file mode 100644 index 0000000..dc21550 Binary files /dev/null and b/server/dump/internal_destinations.metadata.json.gz differ diff --git a/server/dump/item_comments.bson.gz b/server/dump/item_comments.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/item_comments.bson.gz differ diff --git a/server/dump/item_comments.metadata.json.gz b/server/dump/item_comments.metadata.json.gz new file mode 100644 index 0000000..055c5fc Binary files /dev/null and b/server/dump/item_comments.metadata.json.gz differ diff --git a/server/dump/locations.bson.gz b/server/dump/locations.bson.gz new file mode 100644 index 0000000..694a525 Binary files /dev/null and b/server/dump/locations.bson.gz differ diff --git a/server/dump/locations.metadata.json.gz b/server/dump/locations.metadata.json.gz new file mode 100644 index 0000000..cecc590 Binary files /dev/null and b/server/dump/locations.metadata.json.gz differ diff --git a/server/dump/media_references.bson.gz b/server/dump/media_references.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/media_references.bson.gz differ diff --git a/server/dump/media_references.metadata.json.gz b/server/dump/media_references.metadata.json.gz new file mode 100644 index 0000000..08732f3 Binary files /dev/null and b/server/dump/media_references.metadata.json.gz differ diff --git a/server/dump/mongolock.lock.bson.gz b/server/dump/mongolock.lock.bson.gz new file mode 100644 index 0000000..4c37e7b Binary files /dev/null and b/server/dump/mongolock.lock.bson.gz differ diff --git a/server/dump/mongolock.lock.metadata.json.gz b/server/dump/mongolock.lock.metadata.json.gz new file mode 100644 index 0000000..d3972de Binary files /dev/null and b/server/dump/mongolock.lock.metadata.json.gz differ diff --git a/server/dump/planning.bson.gz b/server/dump/planning.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/planning.bson.gz differ diff --git a/server/dump/planning.metadata.json.gz b/server/dump/planning.metadata.json.gz new file mode 100644 index 0000000..e5a9b08 Binary files /dev/null and b/server/dump/planning.metadata.json.gz differ diff --git a/server/dump/planning_autosave.bson.gz b/server/dump/planning_autosave.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/planning_autosave.bson.gz differ diff --git a/server/dump/planning_autosave.metadata.json.gz b/server/dump/planning_autosave.metadata.json.gz new file mode 100644 index 0000000..4d0ff50 Binary files /dev/null and b/server/dump/planning_autosave.metadata.json.gz differ diff --git a/server/dump/products.bson.gz b/server/dump/products.bson.gz new file mode 100644 index 0000000..ad70d06 Binary files /dev/null and b/server/dump/products.bson.gz differ diff --git a/server/dump/products.metadata.json.gz b/server/dump/products.metadata.json.gz new file mode 100644 index 0000000..a935ee0 Binary files /dev/null and b/server/dump/products.metadata.json.gz differ diff --git a/server/dump/publish_queue.bson.gz b/server/dump/publish_queue.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/publish_queue.bson.gz differ diff --git a/server/dump/publish_queue.metadata.json.gz b/server/dump/publish_queue.metadata.json.gz new file mode 100644 index 0000000..2406bc6 Binary files /dev/null and b/server/dump/publish_queue.metadata.json.gz differ diff --git a/server/dump/published.bson.gz b/server/dump/published.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/published.bson.gz differ diff --git a/server/dump/published.metadata.json.gz b/server/dump/published.metadata.json.gz new file mode 100644 index 0000000..4a37a18 Binary files /dev/null and b/server/dump/published.metadata.json.gz differ diff --git a/server/dump/published_planning.bson.gz b/server/dump/published_planning.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/published_planning.bson.gz differ diff --git a/server/dump/published_planning.metadata.json.gz b/server/dump/published_planning.metadata.json.gz new file mode 100644 index 0000000..1c2bcd6 Binary files /dev/null and b/server/dump/published_planning.metadata.json.gz differ diff --git a/server/dump/reset_user_password.bson.gz b/server/dump/reset_user_password.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/reset_user_password.bson.gz differ diff --git a/server/dump/reset_user_password.metadata.json.gz b/server/dump/reset_user_password.metadata.json.gz new file mode 100644 index 0000000..ec01743 Binary files /dev/null and b/server/dump/reset_user_password.metadata.json.gz differ diff --git a/server/dump/roles.bson.gz b/server/dump/roles.bson.gz new file mode 100644 index 0000000..c37ac5b Binary files /dev/null and b/server/dump/roles.bson.gz differ diff --git a/server/dump/roles.metadata.json.gz b/server/dump/roles.metadata.json.gz new file mode 100644 index 0000000..606400c Binary files /dev/null and b/server/dump/roles.metadata.json.gz differ diff --git a/server/dump/routing_schemes.bson.gz b/server/dump/routing_schemes.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/routing_schemes.bson.gz differ diff --git a/server/dump/routing_schemes.metadata.json.gz b/server/dump/routing_schemes.metadata.json.gz new file mode 100644 index 0000000..e7cd5e4 Binary files /dev/null and b/server/dump/routing_schemes.metadata.json.gz differ diff --git a/server/dump/rule_sets.bson.gz b/server/dump/rule_sets.bson.gz new file mode 100644 index 0000000..26333aa Binary files /dev/null and b/server/dump/rule_sets.bson.gz differ diff --git a/server/dump/rule_sets.metadata.json.gz b/server/dump/rule_sets.metadata.json.gz new file mode 100644 index 0000000..a133787 Binary files /dev/null and b/server/dump/rule_sets.metadata.json.gz differ diff --git a/server/dump/saved_reports.bson.gz b/server/dump/saved_reports.bson.gz new file mode 100644 index 0000000..a0e18a8 Binary files /dev/null and b/server/dump/saved_reports.bson.gz differ diff --git a/server/dump/saved_reports.metadata.json.gz b/server/dump/saved_reports.metadata.json.gz new file mode 100644 index 0000000..908b4ab Binary files /dev/null and b/server/dump/saved_reports.metadata.json.gz differ diff --git a/server/dump/saved_searches.bson.gz b/server/dump/saved_searches.bson.gz new file mode 100644 index 0000000..a384ba5 Binary files /dev/null and b/server/dump/saved_searches.bson.gz differ diff --git a/server/dump/saved_searches.metadata.json.gz b/server/dump/saved_searches.metadata.json.gz new file mode 100644 index 0000000..7a6aa5a Binary files /dev/null and b/server/dump/saved_searches.metadata.json.gz differ diff --git a/server/dump/sequences.bson.gz b/server/dump/sequences.bson.gz new file mode 100644 index 0000000..45b9ea1 Binary files /dev/null and b/server/dump/sequences.bson.gz differ diff --git a/server/dump/sequences.metadata.json.gz b/server/dump/sequences.metadata.json.gz new file mode 100644 index 0000000..a3a19b5 Binary files /dev/null and b/server/dump/sequences.metadata.json.gz differ diff --git a/server/dump/stages.bson.gz b/server/dump/stages.bson.gz new file mode 100644 index 0000000..1355464 Binary files /dev/null and b/server/dump/stages.bson.gz differ diff --git a/server/dump/stages.metadata.json.gz b/server/dump/stages.metadata.json.gz new file mode 100644 index 0000000..0515501 Binary files /dev/null and b/server/dump/stages.metadata.json.gz differ diff --git a/server/dump/subscribers.bson.gz b/server/dump/subscribers.bson.gz new file mode 100644 index 0000000..ee7df8d Binary files /dev/null and b/server/dump/subscribers.bson.gz differ diff --git a/server/dump/subscribers.metadata.json.gz b/server/dump/subscribers.metadata.json.gz new file mode 100644 index 0000000..67677e0 Binary files /dev/null and b/server/dump/subscribers.metadata.json.gz differ diff --git a/server/dump/users.bson.gz b/server/dump/users.bson.gz new file mode 100644 index 0000000..db43a37 Binary files /dev/null and b/server/dump/users.bson.gz differ diff --git a/server/dump/users.metadata.json.gz b/server/dump/users.metadata.json.gz new file mode 100644 index 0000000..58fdfdf Binary files /dev/null and b/server/dump/users.metadata.json.gz differ diff --git a/server/dump/validators.bson.gz b/server/dump/validators.bson.gz new file mode 100644 index 0000000..de2e2ad Binary files /dev/null and b/server/dump/validators.bson.gz differ diff --git a/server/dump/validators.metadata.json.gz b/server/dump/validators.metadata.json.gz new file mode 100644 index 0000000..aaaf331 Binary files /dev/null and b/server/dump/validators.metadata.json.gz differ diff --git a/server/dump/vocabularies.bson.gz b/server/dump/vocabularies.bson.gz new file mode 100644 index 0000000..9d3d230 Binary files /dev/null and b/server/dump/vocabularies.bson.gz differ diff --git a/server/dump/vocabularies.metadata.json.gz b/server/dump/vocabularies.metadata.json.gz new file mode 100644 index 0000000..489b971 Binary files /dev/null and b/server/dump/vocabularies.metadata.json.gz differ diff --git a/server/dump/workspaces.bson.gz b/server/dump/workspaces.bson.gz new file mode 100644 index 0000000..7b0fada Binary files /dev/null and b/server/dump/workspaces.bson.gz differ diff --git a/server/dump/workspaces.metadata.json.gz b/server/dump/workspaces.metadata.json.gz new file mode 100644 index 0000000..f957be1 Binary files /dev/null and b/server/dump/workspaces.metadata.json.gz differ diff --git a/server/macros/__init__.py b/server/macros/__init__.py new file mode 100644 index 0000000..6201a0d --- /dev/null +++ b/server/macros/__init__.py @@ -0,0 +1,2 @@ +from superdesk.macros import * # noqa +from . import replace_words # noqa diff --git a/server/macros/replace_words.py b/server/macros/replace_words.py new file mode 100644 index 0000000..2df24ec --- /dev/null +++ b/server/macros/replace_words.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8; -*- +# +# This file is part of Superdesk. +# +# Copyright 2013, 2014 Sourcefabric z.u. and contributors. +# +# For the full copyright and license information, please see the +# AUTHORS and LICENSE files distributed with this source code, or +# at https://www.sourcefabric.org/superdesk/license + +import re + +from superdesk import get_resource_service +from superdesk.macros import macro_replacement_fields + + +def find_and_replace(item, **kwargs): + """ + Find and replace words + :param dict item: + :param kwargs: + :return tuple(dict, dict): tuple of modified item and diff of items modified. + """ + diff = {} + + def repl(new, old): + """ + Returns a version of the "new" string that matches the case of the "old" string + :param new: + :param old: + :return: a string which is a version of "new" that matches the case of old. + """ + if old.islower(): + return new.lower() + elif old.isupper(): + return new.upper() + else: + # the old string starts with upper case so we use the title function + if old[:1].isupper(): + return new.title() + # it is more complex so try to match it + else: + result = '' + all_upper = True + for i, c in enumerate(old): + if i >= len(new): + break + if c.isupper(): + result += new[i].upper() + else: + result += new[i].lower() + all_upper = False + # append any remaining characters from new + if all_upper: + result += new[i + 1:].upper() + else: + result += new[i + 1:].lower() + return result + + def do_find_replace(input_string, words_list): + found_list = {} + for word in words_list: + pattern = r'{}'.format(re.escape(word.get('existing', ''))) + + while re.search(pattern, input_string, flags=re.IGNORECASE): + # get the original string from the input + original = re.search(pattern, input_string, flags=re.IGNORECASE).group(0) + replacement = repl(word.get('replacement', ''), original) + if found_list.get(original): + break + diff[original] = replacement + found_list[original] = replacement + input_string = input_string.replace(original, replacement) + + return input_string + + vocab = get_resource_service('vocabularies').find_one(req=None, _id='replace_words') + + if vocab: + replace_words_list = vocab.get('items') or [] + + if not replace_words_list: + return item + + for field in macro_replacement_fields: + if not item.get(field, None): + continue + + item[field] = do_find_replace(item[field], replace_words_list) + + return item + + +name = 'Replace_Words' +label = 'Replace words in the article' +order = 1 +shortcut = 'a' +callback = find_and_replace +access_type = 'frontend' +action_type = 'direct' diff --git a/server/templates/planning_group_by_date.html b/server/templates/planning_group_by_date.html new file mode 100644 index 0000000..e984315 --- /dev/null +++ b/server/templates/planning_group_by_date.html @@ -0,0 +1,33 @@ +{% for year, year_group in items|groupby('planning_date.year') %} +{% for month, month_group in year_group|groupby('planning_date.month') %} +{% for day, day_group in month_group|groupby('planning_date.day') %} + {% set weekday = day_group[0].planning_date.strftime('%A') %} + {% if weekday == 'Monday' %}
{{ item.description_text or '' }} + {% if item.get('event', {}).get('location') %} + Location: {{ item.event.location[0].name }}. + {% endif %} + {% if item.get('planning_date', '') != '' + and item.get('planning_date', '') | format_datetime(date_format='%H:%M') != '00:00' %} + Time: {{ item.planning_date | format_datetime(date_format='%H:%M') }}. + {% endif %} +
+ {% if item.get('ednote', '') != '' %} +Editorial note: {{ item.ednote }}
+ {% endif %} + {% if item.coverages %} +Coverage(s): {{ item.coverages | join(', ') }}
+ {% endif %} + + {% endfor %} +{% endfor %} +{% endfor %} +{% endfor %}