Annotations¶
Annotations.
invenio.modules.annotations¶
FIXME: Outdated documentation.
To enable the module, make sure to remove it from PACKAGES_EXCLUDE
,
where it is placed by default.
To enable Web page annotations, add the following to your templates:
{%- from "annotations/macros.html" import annotations_toolbar -%}
{%- block global_bundles -%}
{{ super() }}
{% bundle "30-annotations.js", "30-annotations.css" %}
{%- endblock global_javascript -%}
{%- block page_body -%}
{{ annotations_toolbar() }}
{{ super() }}
{%- endblock page_body -%}
To enable document annotations, along with the previewer, set the following
configuration variables to True
:
ANNOTATIONS_NOTES_ENABLED = True
ANNOTATIONS_PREVIEW_ENABLED = True
Models¶
-
class
invenio.modules.annotations.models.
CmtNOTECOLLAPSED
(**kwargs)¶ Represents a CmtNOTECOLLAPSED record.
Noteutils¶
Utils for extracting notes from comments and manipulating them.
-
invenio.modules.annotations.noteutils.
MARKERS
¶ the note markers; references have a special type of location, e.g. “[Ellis98]”
-
invenio.modules.annotations.noteutils.
extract_notes_from_comment
(comment, bodyOnly=False)¶ Extracts notes from a comment.
Notes are one-line blocks of text preceded by
MARKERS
and locations (page numbers, figure names etc.).Parameters: comment – the comment to parse Returns: the list of parsed notes in the following JSON form below ( if the body
is a JSON, it means that the note has a child).{ "marker": String, "location": String, "body": JSON|String }
-
invenio.modules.annotations.noteutils.
get_note_title
(location)¶ Convert a note/ marker combination to a human readable string.
Parameters: location – the note/ marker combination Returns: the human-readable location
-
invenio.modules.annotations.noteutils.
get_original_comment
(note)¶ Fetches the original comment of the note; in case of hierarchic notes, it goes up to the parent.
Parameters: note – the note Returns: the comment in which the note appeared
-
invenio.modules.annotations.noteutils.
note_collapse
(id_bibrec, path)¶ Collapses note category for user.
-
invenio.modules.annotations.noteutils.
note_expand
(id_bibrec, path)¶ Expands note category for user.
-
invenio.modules.annotations.noteutils.
note_is_collapsed
(id_bibrec, path)¶ Checks if a note category is collapsed.
Views¶
Annotations module.
-
invenio.modules.annotations.views.
add
(*args, **kwargs)¶ Add page.
-
invenio.modules.annotations.views.
attach
(*args, **kwargs)¶ Attach page.
-
invenio.modules.annotations.views.
detach
(*args, **kwargs)¶ Detach page.
-
invenio.modules.annotations.views.
get__anno_count
()¶ Get count page.
Menu page.
-
invenio.modules.annotations.views.
notes
(recid, *args, **kwargs)¶ Note page.
-
invenio.modules.annotations.views.
notes_toggle
(*args, **kwargs)¶ Toggle notes collapsed/ expanded.
-
invenio.modules.annotations.views.
permission_builder
(public, groups=None)¶ Permission builder.
-
invenio.modules.annotations.views.
ping
(message=u'')¶ Pong message.
-
invenio.modules.annotations.views.
view
()¶ View page.