Hi,
It seems well that : when paginated posts are used the common fragment identifiers cannot be used easily (see detailed note), because the pages are identified by their number (page=<num_page>) which is not a stable data.
This makes quite impossible to develop and test internal links and maintain long paginated documents with many fragments identifiers because pagination can easily change.
After researches of existing solutions, I decide to develop "something" which is quite fully designed, the feasibility checked, too some main parts of code.
For now, because I am new in WordPress developments I need some help.
I don't think at all that the problem is only a pluging problem.
There are some things that I don't know how to do for hacks.
I do not know anymore where are good existing examples.
The development features are :
(to avoid errors we replace the "page" of paginated post by the "section" word : then a post can have sections)
- A section can be named by the use of a shortcode associated with <!--nextpage--> into the document.
- optional replacement of the url of section identified currently by his number : <permalink>/<num_page>/
by
A new syntax which is the unique way (in my opinion) to reach a fragment into a paginated post
<permalink>/section/<section_name>/
- determine and store the post datas which describes the post sections (needs a wp enhancement - add a column to post table, or badly a special table like for a plugin for storing the pagination data, updated when the post is saved) containing :
post, version : table (json) with for each section (section_name, title, page_num)
Then the steps of url treatment are :
- with a add_rewrite_endpoint it becomes
<permalink>/?section=section_name
- with add_rewrite_tag we can get the new query arg ['section']
- read first the sections data (pagination) from data base using the permalink
Then I need to set into the current query the hook (set by add_action) to set the query var "page=<num_page>", the only known identifier of the "section" known by other WP soft elements.
(I don't know how to do this : must be placed just at the query.php beginning ?)
I am not sure of the sequence of actions (must be the first process : it builds the request for full compatibility giving section_name and old page number) and priorities.
The other parts of the soft with which I have no problem at all are :
- treatment of the content to set the pagination (or sectionning) data (shortcodes)
- writing pagination data at saving posts.
To test, I developed a "at display" treatment which sets
the internal good urls (as shortcodes) into href to fragments. This makes the fragment url identifiers displayed usable (replacement into urls of the section_name by the page number at display).
But the external links cannot be obviously kept anywhere with reliability because links to fragments are broken by any pagination change while section_names are stable data.
I think that it is not a so important work.
I hope this is interesting development.
Best regards
Trebly
________________________________________________________________________
(note :For clarity the concept of an article page is replaced by article "section" (concept which covers easily : parts, main chapters, which uses are naturally extended to summary, bibliography, indexes etc.)
The styling pages link brakes the concept of spaces for html/xml.
A post is no more, with the pagebreak feature a space, it is the section which is, but it is managed as an entity by WP.
The enhancement restores a HTML/XML true space as a section for post paginated : divided into sections.
Then when you creates a document a fragment identifier "#<fragment_name>" cannot be used if a <!--nextpage--> (or equivalent) is used into the document. The URI is unknown. This is proper to the multipage concept not at all to any multipage plugin.
I have not found anywhere information (and I worked a lot on this subject) about the way to define a fragment reference inside a multi page document a tag href or to externally reference a fragment which is contained into a multipage document.
_______________________________________________________________________
remark : It is very difficult to write such projects without any preview of the content of message... sorry I can edit after for a while.