ipypublish.filters.filters module

ipypublish.filters.filters.basename(path, ext=False)[source]
ipypublish.filters.filters.create_key(input, **kwargs)[source]

create sanitized key string which only contains lowercase letters, (semi)colons as c, underscores as u and numbers as roman numerals in this way the keys with different input should mainly be unique

>>> create_key('fig:A_10name56')
'figcauxnamelvi'
ipypublish.filters.filters.dict_to_kwds(inobject, kwdstr='', overwrite=True)[source]

convert a dictionary to a string of keywords, or, if a list, a string of options

append to an existing options string (without duplication)

Parameters
  • dct (dict) –

  • kwdstr (str) – initial keyword string

  • overwrite (bool) – overwrite the option, if it already exists with a different value

Examples

>>> dict_to_kwds({"a":1,"c":3},'a=1,b=2')
'a=1,b=2,c=3'
>>> dict_to_kwds(['a', 'c'],'a,b')
'a,b,c'
ipypublish.filters.filters.first_para(input, **kwargs)[source]

get only ttext before a n (i.e. the fist paragraph)

ipypublish.filters.filters.get_caption(etype, cell_meta, resources)[source]

return an ipypublish caption or False

captions can either be located at cell_meta.ipub.<type>.caption, or at resources.caption[cell_meta.ipub.<type>.label]

the resources version is proritised

ipypublish.filters.filters.get_empty_lines(text)[source]

Get number of empty lines before and after text.

ipypublish.filters.filters.is_equation(text)[source]

test if a piece of text is a latex equation, by how it is wrapped

ipypublish.filters.filters.remove_dollars(text)[source]

remove dollars from start/end of text

ipypublish.filters.filters.strip_ext(path)[source]
ipypublish.filters.filters.wrap_eqn(text, cell_meta, nb_meta, out='latex')[source]

wrap an equation in a latex equation environment

environment obtained (if present) from cell_meta.ipub.equation.environment) label obtained (if present) from cell_meta.ipub.equation.label) also, nb_meta.ipub.enable_breqn used

Parameters
  • text (str) –

  • cell_meta (dict) – the cell metadata

  • nb_meta (dict) – the notebook metadata

Returns

new_text

Return type

str

ipypublish.filters.filters.wrap_latex(input, max_length=75, **kwargs)[source]