invicticide / fractive

Fractive is a free, open-source, Markdown-based hypertext authoring tool for writing interactive fiction.
http://fractive.io
Other
37 stars 5 forks source link

Relative sections #75

Closed NQNStudios closed 6 years ago

NQNStudios commented 6 years ago

Redux of PR #50.

Changes proposed by this pull request:

Along the way I uncovered some other pre-existing bugs which I'll also be writing up.

@invicticide to review

NQNStudios commented 6 years ago

I've realized a major flaw in the way I've implemented this: relative section is meant to always refer to what is relative to the original section's position in Markdown files. With sections sometimes being embedded in other sections in Fractive, there's no easy way to figure out the original section's position in Markdown if it's embedded in another one. It would probably be better to handle all relative section macros by replacing them at compile-time with the name of the proper section, so that at runtime it still refers to the expected section no matter what. Also, it would be useful to be able to reference relative sections in simple macros that aren't links, which I haven't implemented here. Lots to think about, but probably this isn't the PR we're looking for.