<commit_before>Module library
==============

The module library allows to create blocks. There are libraries to create
blocks in the informatives area and inside the teaser mosaic. Available modules
are transmitted in JSON[#setup]_:

>>> import json
>>> import pprint
>>> browser.handleErrors = False
>>> browser.open('informatives/@@block-factories.json')
>>> pprint.pprint(json.loads(browser.contents))
{u'factories': [{u'css': u'module represents-content-object informatives-module',
                u'image': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/module-audio.png',
                u'title': u'Audioblock',
                u'type': u'audio'},
                ...
 u'template_url': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/block_factories.jsont'}


In the teaser mosiac different blocks can be created. When there is no teaser
bar, no blocks are offered to be created:

>>> browser.open(cp_url)
>>> browser.open('teaser-mosaic/@@block-factories.json')
>>> pprint.pprint(json.loads(browser.contents))
{u'factories': [],
 u'template_url': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/block_factories.jsont'}


After creating a teaser bar, blocks are offered:

>>> browser.open(cp_url)
>>> browser.open('contents')
>>> contents_url = browser.url
>>> browser.getLink('Add teaser bar').click()
>>> browser.open(cp_url)
>>> browser.open('teaser-mosaic/@@block-factories.json')
>>> pprint.pprint(json.loads(browser.contents))
{u'factories': [{u'css': u'module represents-content-object teaser-mosaic-module',
                u'image': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/module-audio.png',
                u'title': u'Audioblock',
                u'type': u'audio'},
                ...
 u'template_url': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/block_factories.jsont'}


One can also ask for blocks which can be added on the CP in general:

>>> browser.open(cp_url)
>>> browser.open('@@block-factories.json')
>>> pprint.pprint(json.loads(browser.contents))
{u'factories': [{u'css': u'module represents-content-object informatives-module teaser-mosaic-module',
                u'image': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/module-audio.png',
                u'title': u'Audioblock',<commit_msg>Re VIV-633: Fix test after zeit.edit commit:3<PASSWORD> added block parameters<commit_after>Module library
==============

The module library allows to create blocks. There are libraries to create
blocks in the informatives area and inside the teaser mosaic. Available modules
are transmitted in JSON[#setup]_:

>>> import json
>>> import pprint
>>> browser.handleErrors = False
>>> browser.open('informatives/@@block-factories.json')
>>> pprint.pprint(json.loads(browser.contents))
{u'factories': [{u'css': u'module represents-content-object informatives-module',
                u'image': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/module-audio.png',
                u'params': u'{}',
                u'title': u'Audioblock',
                u'type': u'audio'},
                ...
 u'template_url': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/block_factories.jsont'}


In the teaser mosiac different blocks can be created. When there is no teaser
bar, no blocks are offered to be created:

>>> browser.open(cp_url)
>>> browser.open('teaser-mosaic/@@block-factories.json')
>>> pprint.pprint(json.loads(browser.contents))
{u'factories': [],
 u'template_url': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/block_factories.jsont'}


After creating a teaser bar, blocks are offered:

>>> browser.open(cp_url)
>>> browser.open('contents')
>>> contents_url = browser.url
>>> browser.getLink('Add teaser bar').click()
>>> browser.open(cp_url)
>>> browser.open('teaser-mosaic/@@block-factories.json')
>>> pprint.pprint(json.loads(browser.contents))
{u'factories': [{u'css': u'module represents-content-object teaser-mosaic-module',
                u'image': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/module-audio.png',
                u'params': u'{}',
                u'title': u'Audioblock',
                u'type': u'audio'},
                ...
 u'template_url': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/block_factories.jsont'}


One can also ask for blocks which can be added on the CP in general:

>>> browser.open(cp_url)
>>> browser.open('@@block-factories.json')
>>> pprint.pprint(json.loads(browser.contents))
{u'factories': [{u'css': u'module represents-content-object informatives-module teaser-mosaic-module',
                u'image': u'http://localhost/++skin++cms/fanstatic/zeit.content.cp/module-audio.png',
                u'params': u'{}',
                u'title': u'Audioblock',
{'fraction_non_alphanumeric': 0.17314561882748478, 'fraction_numerical': 0.0008405127127547804, 'mean_word_length': 3.9173553719008263, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 112, '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': '4612695', 'n_tokens_mistral': 1534, 'n_tokens_neox': 1482, 'n_words': 290}