doorstop-dev / doorstop

Requirements management using version control.
https://doorstop.readthedocs.io
Other
471 stars 132 forks source link

Child/parent links don't work in 3.0b10 #611

Closed villanella closed 8 months ago

villanella commented 11 months ago

In Doorstop 3.0b10 all links with anchors has additional .html extension before anchor that leads to incorrect hyperlink http://mytest.com:7867/documents/parent.html#childlink The same hyperlink in 3.0b4 is correctly opened.

Workaround in b10: remove *html from the hyperlink or remove html extension from def _format_html_item_link function in publisher.py:

def _format_html_item_link(item, linkify=True):
    """Format an item link in HTML."""
    if linkify and is_item(item):
        if item.header:
            #link = '<a href="{p}.html#{u}">{u} {h}</a>'.format(
            # replace to:
            link = '<a href="{p}#{u}">{u} {h}</a>'.format(
                u=item.uid, h=item.header, p=item.document.prefix
            )
        else:
            #link = '<a href="{p}.html#{u}">{u}</a>'.format(
            # replace to:
            link = '<a href="{p}#{u}">{u}</a>'.format(
                u=item.uid, p=item.document.prefix
            )
        return link
    else:
        return str(item.uid)  # if not `Item`, assume this is an `UnknownItem`

But I don't know what is expected format of hyperlinks. The variant without html extension is better for me. Removing html extension from item.header breaks tests.

jacebrowning commented 9 months ago

This beta release contains a fix for this issue: https://pypi.org/project/doorstop/3.0b11/ cc @neerdoc

neerdoc commented 8 months ago

Fixed by #615