Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implement experimental interspace transclusion

See: http://cdent.tiddlyspace.com/Interspace%20Transclusion

This relies on arbitrary behavior from the TiddlyWiki code
that can be parsed out while processing transclusion spans.

The above link includes information about how to make this
something other than experimental.
  • Loading branch information...
commit d07859d3564693242dc1d8752e21cdd8244a430b 1 parent 725697b
@cdent cdent authored
Showing with 25 additions and 9 deletions.
  1. +25 −9 twikified.py
View
34 twikified.py
@@ -32,6 +32,7 @@
from tiddlyweb.control import determine_bag_from_recipe
from tiddlyweb.store import StoreError
from tiddlyweb.model.bag import Bag
+from tiddlyweb.model.policy import PermissionsError
from tiddlyweb.model.recipe import Recipe
from tiddlyweb.model.tiddler import Tiddler
from tiddlyweb.util import renderable
@@ -142,20 +143,35 @@ def render(tiddler, environ, seen_titles=None):
if attribute == 'tiddler':
attr = span.attributes[attribute]
interior_title = attr.value
- if interior_title not in seen_titles:
- seen_titles.append(interior_title)
+ try:
+ span_class = span.attributes['class'].value
+ if span_class.startswith('@'):
+ interior_bag = span_class[1:] + '_public'
+ else:
+ interior_bag = ''
+ except KeyError:
+ interior_bag = ''
+ title_semaphore = '%s:%s' % (interior_title, interior_bag)
+ if title_semaphore not in seen_titles:
+ seen_titles.append(title_semaphore)
interior_tiddler = Tiddler(interior_title)
try:
store = environ['tiddlyweb.store']
- if tiddler.recipe:
- interior_tiddler.recipe = tiddler.recipe
- recipe = store.get(Recipe(tiddler.recipe))
- interior_tiddler.bag = determine_bag_from_recipe(
- recipe, interior_tiddler, environ).name
+ if interior_bag:
+ public_bag = store.get(Bag(interior_bag))
+ public_bag.policy.allows(
+ environ['tiddlyweb.usersign'], 'read')
+ interior_tiddler.bag = interior_bag
else:
- interior_tiddler.bag = tiddler.bag
+ if tiddler.recipe:
+ interior_tiddler.recipe = tiddler.recipe
+ recipe = store.get(Recipe(tiddler.recipe))
+ interior_tiddler.bag = determine_bag_from_recipe(
+ recipe, interior_tiddler, environ).name
+ else:
+ interior_tiddler.bag = tiddler.bag
interior_tiddler = store.get(interior_tiddler)
- except StoreError:
+ except (StoreError, PermissionsError):
continue
if renderable(interior_tiddler, environ):
interior_content = render(interior_tiddler, environ,
Please sign in to comment.
Something went wrong with that request. Please try again.