Opened 13 years ago
Closed 8 years ago
#9537 closed enhancement (fixed)
Only Include a Section of a wikipage or a regular expression match
Reported by: | Owned by: | Ryan J Ollos | |
---|---|---|---|
Priority: | high | Component: | IncludeMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
This Patch allows you to include a Section(with all its subsections) into another wiki page with:
[[Include(wiki:Page#Section)]]
and it allows you to match for regular expressions in a wiki page and only include those like:
[[Include(wiki:Page@/== Section ==(.*?)==/)]]
it than returns the first saved group of the regular expression in this case everything inside the Section with name "Section" but without its subsections.
Attachments (2)
Change History (17)
Changed 13 years ago by
Attachment: | includeSectionOnlyPatch.diff added |
---|
comment:2 Changed 13 years ago by
I retract that statement because I was unable to get the patch to work...
comment:3 Changed 12 years ago by
comment:4 Changed 11 years ago by
Owner: | changed from Noah Kantrowitz to Ryan J Ollos |
---|---|
Status: | new → assigned |
comment:6 Changed 11 years ago by
I'm pretty busy working on other Trac-related things, but if you can test the patch and provide feedback, that would be a good start to getting it incorporated.
comment:7 Changed 11 years ago by
I didn't manage to apply the patch to the newest version of includemacro. The first two hunks were succesful and two latter ones unsuccesful.
comment:8 Changed 11 years ago by
Status: | assigned → accepted |
---|
Changed 8 years ago by
Attachment: | IncludeSection.diff added |
---|
Patch implementing #section to include section.
comment:11 Changed 8 years ago by
We found this useful so I implemented the top syntax - [[Include(wiki:Page#Section)]] - patch is against the trunk (3.0.0) source and was tested against Trac 1.2.
comment:12 Changed 8 years ago by
Status: | new → accepted |
---|
comment:15 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
I reworked the patch to use the same heading regex as the Trac wiki parser. Ideally we should match the implicit ids that are created for each section, but I didn't come up with a way to do that, and so the change requires that an explicit id be created for the heading. For example:
== The heading #headingid
... and then you can link to [[Include(page#headingid)]]
. If in the future we can map from implicit id to heading, then having an explicit id won't be required.
I also think it's probably possible to implement the match in a single regex, but I didn't figure it out yet.
IncludeSectionPatch