Modify

Opened 16 years ago

Last modified 5 years ago

#4750 new enhancement

Included wiki-pages are put in a paragraph

Reported by: anonymous Owned by:
Priority: normal Component: IncludeMacro
Severity: minor Keywords:
Cc: Trac Release: 0.11

Description

Hi,

I recently reported this with WikiIncludePlugin ([ticket#4749]), and after testing IncludeMacro I hit the same problem.

Currently all included wikipages are embedded in paragraphs. Is there any way to prevent this behaviour?

Logically, if I wanted a paragraph I would put empty lines above and below the macro when I use it.

Example:

I've created the wikipage "Nav/Foo" with links to documentation of the Foo - project. All pages in the documentation start off with a level 1 header, then a wikiinclude macro including the navigation block.

This way, when I create a new page I only need to put the link in "Nav/Foo", and it is available on all related pages.

wikipage Nav/Foo:

[wiki:Docs/Foo Foo] | [wiki:Docs/Foo-subsystem FooBar]

wikipage Docs/Foo:

= Foo =
[[Include(Docs/Foo)]]

Something

wikipage Docs/FooBar:

= Foo =
[[Include(Docs/Foo)]]

Something else.

Normally I'd expect this setup to generate:

= Foo =
[wiki:Docs/Foo Foo] | [wiki:Docs/FooBar FooBar]
..

However, I get this;

= Foo =
<p>
[wiki:Docs/Foo Foo] | [wiki:Docs/FooBar FooBar]
</p>
..

Attachments (0)

Change History (5)

comment:1 in reply to:  description Changed 16 years ago by anonymous

Cut/Paste types fixed:

wikipage Docs/Foo:

= Foo =
[[Include(Nav/Foo)]]

Something

wikipage Docs/FooBar:

= Foo =
[[Include(Nav/Foo)]]

Something else.

Normally I'd expect this setup to generate:

= Foo =
<a class="wiki" href="/trac/wiki/Docs/Foo ... and so on.
..

However, I get this;

= Foo =
<p>
<p>
<a class="wiki" href="/trac/wiki/Docs/Foo ... and so on.
</p>
..

comment:2 Changed 15 years ago by anonymous

Trac Release: 0.100.11

If I am understanding what is wanted, which was analogous to what I wanted, then basically this will do the trick: At the bottom of class WikiIncludeMacro(Component):'s def render_macro(self, req, name, txt): add .strip('</p>') to the bottom of the return wiki_to_html(text, self.env, req), i.e.

		return wiki_to_html(text, self.env, req).strip('</p>')

HTH

comment:3 Changed 11 years ago by Ryan J Ollos

Owner: changed from Noah Kantrowitz to Ryan J Ollos
Status: newassigned

comment:4 Changed 10 years ago by weisslj

Hi! Any plans for solving this? Currently I use this hack to remove the paragraphs surrounding the included wiki page:

@@ -152,4 +153,6 @@ class IncludeMacro(WikiMacroBase):
         if dest_format:
             out = Mimeview(self.env).render(ctxt, dest_format, out)
+            out = re.sub(r'^<p>\n', '', out)
+            out = re.sub(r'\n</p>\n$', '', out)

comment:5 Changed 5 years ago by Ryan J Ollos

Owner: Ryan J Ollos deleted
Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.