Keywords and keyword index #52

Merged
merged 15 commits into from Mar 11, 2014

Conversation

Projects
None yet
2 participants
Owner

jone commented Mar 4, 2014

This pull request adds keyword support for the book.

Changes

  • 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

Owner

jone commented Mar 6, 2014

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

ftw/book/browser/keywords.pt
+ <form class="keywords">
+ <metal:SLOT define-slot="keywords-select">
+ <select name="book_keywords" id="keyword"
+ data-placeholder="Stichwort">
@jone

jone Mar 6, 2014

Owner

translations needed

Owner

maethu commented Mar 7, 2014

KeyError: 'ftw.tabbedview.interfaces.ITabbedView.batch_size'

Reproduce:

  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

maethu Mar 7, 2014

Owner

@jone

 Module zope.tales.tales, line 696, in evaluate
   - URL: /Users/maethu/pkgs/ftw.book/ftw/book/browser/keywords.pt
   - 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 ftw.book.browser.keywords, 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

Owner

maethu commented Mar 7, 2014

@jone
Discussion:
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

Owner

maethu commented Mar 7, 2014

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

Owner

jone commented Mar 7, 2014

@maethu ftw.tabbedview is not a regular dependency of ftw.book, 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 ftw.book and those effects are "normal" when the profile was not installed..

Owner

maethu commented Mar 7, 2014

@jone 👍 manually

Owner

jone commented Mar 7, 2014

@maethu

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

squash on demand

@jone jone referenced this pull request Mar 10, 2014

Closed

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
Details

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

@jone jone referenced this pull request Mar 11, 2014

Merged

Improve book internal links #54

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