Source file
* Implicit anchors are not saved in the source file, they are generated from their labels when page is parsed.
Indexing
* Anchor id and label are indexed to provide autocompletion in Insert Link dialog.
Parsetree
* Elements with anchors (only headings for now) have "anchor" attribute.
TextBuffer
* Tags with anchors (only headings for now) have "anchor" attribute.
* Editing of page can cause inconsistencies in anchors, anchors become dirty (TextBuffer.anchors_dirty = True).
* TextBuffer.cleanup_anchors() finds and repairs dirty anchors.
* Dirty anchors don't affect editing except autocompletion of local anchors ("#anchor"), therefore anchors have to be cleaned up when Insert Link dialog is opened.
* Dirty anchors have to be cleaned up before page is saved and reindexed.
Modified anchors
* Links to local anchors (within the current page) are repaired in TextBuffer.cleanup_anchors()
* TextBuffer.cleanup_anchors() emits "anchors-modified" signal and stores changes in a dict self.modified_anchors (old_id => new_id)
TODO:
* Support for image links to anchors
* Index links to anchors
* Repair links to anchors outside the current page
* Detect anchor moved to another page
* Show anchor type (heading, object, ...) in anchor selector
A few notes about current progress:
Source file
* Implicit anchors are not saved in the source file, they are generated from their labels when page is parsed.
Indexing
* Anchor id and label are indexed to provide autocompletion in Insert Link dialog.
Parsetree
* Elements with anchors (only headings for now) have "anchor" attribute.
TextBuffer anchors_ dirty = True). cleanup_ anchors( ) finds and repairs dirty anchors.
* Tags with anchors (only headings for now) have "anchor" attribute.
* Editing of page can cause inconsistencies in anchors, anchors become dirty (TextBuffer.
* TextBuffer.
* Dirty anchors don't affect editing except autocompletion of local anchors ("#anchor"), therefore anchors have to be cleaned up when Insert Link dialog is opened.
* Dirty anchors have to be cleaned up before page is saved and reindexed.
Modified anchors cleanup_ anchors( ) cleanup_ anchors( ) emits "anchors-modified" signal and stores changes in a dict self.modified_ anchors (old_id => new_id)
* Links to local anchors (within the current page) are repaired in TextBuffer.
* TextBuffer.
TODO:
* Support for image links to anchors
* Index links to anchors
* Repair links to anchors outside the current page
* Detect anchor moved to another page
* Show anchor type (heading, object, ...) in anchor selector