Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Keywords and keyword index #52

merged 15 commits into from

2 participants


This pull request adds keyword support for the book.


  • A tinymce Plugin for BookTextBlocks only, which allows to set keywords
  • A keyword index book_keywords, indexing the keywords
  • LaTeX changes which convert keywords to \index{} commands
  • New field include index on books and a keyword index implementation in the default layout LaTeX layout
  • A new "Keywords" tab, which only is visible when the "Include index" option is activated in the book AND tabbedview is installed and activated for the book.
  • The "Keywords" tab provides a keyword selection (select2), showing the blocks which have the selected keyword; all links point to the content position in the book reader.

TinyMCE plugin

bildschirmfoto 2014-03-03 um 11 57 01

Keywords tab

bildschirmfoto 2014-03-06 um 11 48 24

Requires PR 4teamwork/ftw.pdfgenerator#32


@maethu I've updated the pull request. It should now contain all parts of the keywords feature.

((7 lines not shown))
+ <metal:main-macro define-macro="main">
+ <metal:SLOT define-slot="resources">
+ <link href="" rel="stylesheet"/>
+ <script src=""
+ type="text/javascript" language="javascript"></script>
+ <script src=""
+ type="text/javascript" language="javascript"></script>
+ </metal:SLOT>
+ <metal:SLOT define-slot="above-form" />
+ <metal:SLOT define-slot="form">
+ <form class="keywords">
+ <metal:SLOT define-slot="keywords-select">
+ <select name="book_keywords" id="keyword"
+ data-placeholder="Stichwort">
@jone Owner
jone added a note

translations needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
KeyError: 'ftw.tabbedview.interfaces.ITabbedView.batch_size'

1. Create example book with master
2. Switch ot this branch
3. Run upgrade steps
4. go to book and Chose (Display -> Tabbedview)

You need to install the ftw.tabbedview default profile, if it is not already installed.

@maethu maethu commented on the diff
((15 lines not shown))
+ return self.template()
+ @property
+ def macros(self):
+ return {'form': self.template.macros['main'],
+ 'results': self.results.macros['main']}
+ def keywords(self):
+ catalog = getToolByName(self.context, 'portal_catalog')
+ query = {'path': '/'.join(self.context.getPhysicalPath()),
+ 'portal_type': 'BookTextBlock'}
+ keywords = set()
+ for brain in catalog(query):
+ for keyword in brain.book_keywords:
@maethu Owner
maethu added a note


 Module zope.tales.tales, line 696, in evaluate
   - URL: /Users/maethu/pkgs/
   - Line 25, Column 24
   - Expression: <PathExpr standard:u'view/keywords'>
   - Names:
      {'args': (),
       'container': <Book at /Plone/example-book>,
       'context': <Book at /Plone/example-book>,
       'default': <object object at 0x102bb6bb0>,
       'here': <Book at /Plone/example-book>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x1083cf368>,
       'request': <HTTPRequest, URL=http://localhost:8080/Plone/example-book/tabbed_view/listing>,
       'root': <Application at >,
       'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x1063bf210>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <Products.Five.metaclass.KeywordsTab object at 0x1086452d0>,
       'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x1087e5310>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 155, in _eval
  Module Products.PageTemplates.Expressions, line 117, in render
  Module, line 30, in keywords
TypeError: 'Missing.Value' object is not iterable

This happends on a upgraded book.
There's no value on the brain... I guess you need to reindex (INCL. METADATA) the book_keywords index in a upgrade step. So there's is a proper default value, like empty list/tuple, or add a condition (I'll prefer the first solution).
After a catalog_rebuild it worked in my case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

If I choose the same keyword twice in one BookTextBlock the text also appears twice in the search result. Is this the right behaviour? or merge theme together?

screen shot 2014-03-07 at 4 16 31 pm


The tabbedview view (Display -> Tabbedview) doesn't work neither after a fresh installation.
Also the ftw.tabbedview profile is missing.


@maethu ftw.tabbedview is not a regular dependency of, but I've added it to the development.cfg so that development is easier. This means a developer is required to manually install the GS profile of and those effects are "normal" when the profile was not installed..


@jone :+1: manually



  • upgrade step fixed
  • keywords in result filtered for duplicates (and also sorted)

squash on demand

@jone jone referenced this pull request

Improve book internal links #53

@maethu maethu merged commit 6fc17e3 into v3.x

1 check passed

Details default CI Status: 3 SUCCESS
@maethu maethu deleted the jone-keywords branch
@jone jone referenced this pull request

Improve book internal links #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.