Keywords and keyword index #52

merged 15 commits into from Mar 11, 2014


None yet
2 participants

jone commented Mar 4, 2014

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


jone commented Mar 6, 2014

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

+ <form class="keywords">
+ <metal:SLOT define-slot="keywords-select">
+ <select name="book_keywords" id="keyword"
+ data-placeholder="Stichwort">

jone Mar 6, 2014


translations needed


maethu commented Mar 7, 2014

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.

+ keywords = set()
+ for brain in catalog(query):
+ for keyword in brain.book_keywords:

maethu Mar 7, 2014



 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


maethu commented Mar 7, 2014

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


maethu commented Mar 7, 2014

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


jone commented Mar 7, 2014

@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..


maethu commented Mar 7, 2014

@jone 👍 manually


jone commented Mar 7, 2014


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

squash on demand

@jone jone referenced this pull request Mar 10, 2014


Improve book internal links #53

maethu added a commit that referenced this pull request Mar 11, 2014

@maethu maethu merged commit 6fc17e3 into v3.x Mar 11, 2014

1 check passed

default CI Status: 3 SUCCESS

@maethu maethu deleted the jone-keywords branch Mar 11, 2014

@jone jone referenced this pull request Mar 11, 2014


Improve book internal links #54

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