diff --git a/doorstop/core/files/assets/doorstop/sidebar.css b/doorstop/core/files/assets/doorstop/sidebar.css index e1856017f..f2b06ecef 100644 --- a/doorstop/core/files/assets/doorstop/sidebar.css +++ b/doorstop/core/files/assets/doorstop/sidebar.css @@ -10,6 +10,8 @@ padding-left: 20px; margin-top: 20px; margin-bottom: 20px; + width: 18em; + overflow: hidden; } /* all links */ diff --git a/doorstop/core/files/doorstop.css b/doorstop/core/files/doorstop.css deleted file mode 100644 index d3f7edbd0..000000000 --- a/doorstop/core/files/doorstop.css +++ /dev/null @@ -1,118 +0,0 @@ -body{ - margin: 0 auto; - font-family: Georgia, Palatino, serif; - color: #444444; - line-height: 1; - max-width: 960px; - padding: 30px; -} -h1, h2, h3, h4, h5, h6 { - color: #111111; - font-weight: 400; -} -h1, h2, h3, h4, h5, h6, p { - margin-bottom: 24px; - padding: 0; -} -h1 { - font-size: 48px; -} -h2 { - font-size: 40px; -} -h3 { - font-size: 32px; -} -h4, h5, h6 { - font-size: 28px; -} -a { - color: #0099ff; - margin: 0; - padding: 0; - vertical-align: baseline; -} -a:hover { - text-decoration: none; - color: #ff6600; -} -a:visited { - color: purple; -} -ul, ol { - padding: 0; - margin-left: 48px; -} -li { - line-height: 24px; -} -li ul, li ul { - margin-left: 24px; -} -p, ul, ol { - font-size: 16px; - line-height: 24px; - max-width: 540px; -} -pre { - padding: 0px 24px; - max-width: 800px; - white-space: pre-wrap; -} -code { - font-family: Consolas, Monaco, Andale Mono, monospace; - line-height: 1.5; - font-size: 13px; -} -aside { - display: block; - float: right; - width: 390px; -} -blockquote { - border-left:.5em solid #eee; - padding: 0 2em; - margin-left:0; - max-width: 476px; -} -blockquote cite { - font-size:14px; - line-height:20px; - color:#bfbfbf; -} -blockquote cite:before { - content: '\2014 \00A0'; -} - -blockquote p { - color: #666; - max-width: 460px; -} - -hr { - width: 540px; - text-align: left; - margin: 0 auto 0 0; - color: #999; -} - -table, th, td { - border:1px solid #DDDDDD; - border-collapse:collapse; - font-weight:normal -} - -th { - background-color: #E6E6E6; -} - -tr.alt td { - background-color: #F8F8F8; -} - -:target { - background-color: #F5F9FC; - padding-top: 10px; - padding-bottom: 15px; - padding-left: 10px; -} diff --git a/doorstop/core/publisher.py b/doorstop/core/publisher.py index b6ab22ee7..75359318a 100644 --- a/doorstop/core/publisher.py +++ b/doorstop/core/publisher.py @@ -30,7 +30,6 @@ alt='UML Diagram', ), ) -CSS = os.path.join(os.path.dirname(__file__), 'files', 'doorstop.css') HTMLTEMPLATE = 'sidebar' INDEX = 'index.html' @@ -154,9 +153,8 @@ def _lines_index(filenames, charset='UTF-8', tree=None): ''.format(charset=charset) ) - yield '' + yield '' + yield '' yield '' yield '' # Tree structure @@ -189,14 +187,14 @@ def _lines_index(filenames, charset='UTF-8', tree=None): # table yield '

Item Traceability:

' yield '

' - yield '' + yield '
' # header for document in documents: # pylint: disable=not-an-iterable - yield '' + yield '' yield '' for document in documents: # pylint: disable=not-an-iterable link = '{p}'.format(p=document.prefix) - yield (' '.format(link=link)) + yield (' '.format(link=link)) yield '' # data for index, row in enumerate(tree.get_traceability()): @@ -208,8 +206,8 @@ def _lines_index(filenames, charset='UTF-8', tree=None): if item is None: link = '' else: - link = _format_html_item_link(item) - yield ' '.format(link) + link = _format_html_item_link_index_table(item) + yield ' '.format(link) yield '' yield '
{link} {link}
{} {}
' yield '

' @@ -218,14 +216,6 @@ def _lines_index(filenames, charset='UTF-8', tree=None): yield '' -def _lines_css(): - """Yield lines of CSS to embedded in HTML.""" - yield '' - for line in common.read_lines(CSS): - yield line.rstrip() - yield '' - - def publish_lines(obj, ext='.txt', **kwargs): """Yield lines for a report in the specified format. @@ -386,7 +376,7 @@ def _lines_markdown(obj, **kwargs): yield "" # break before links items2 = item.parent_items if settings.PUBLISH_CHILD_LINKS: - label = "Parent links:" + label = "🡩 Parents:" else: label = "Links:" links = _format_md_links(items2, linkify) @@ -398,12 +388,13 @@ def _lines_markdown(obj, **kwargs): items2 = item.find_child_items() if items2: yield "" # break before links - label = "Child links:" + label = "🡫 Children:" links = _format_md_links(items2, linkify) label_links = _format_md_label_links(label, links, linkify) yield label_links yield "" # break between items + yield "***" # horizontal rule between items def _format_level(level): @@ -530,16 +521,32 @@ def _format_html_item_link(item, linkify=True): return str(item.uid) # if not `Item`, assume this is an `UnknownItem` +def _format_html_item_link_index_table(item, linkify=True): + """Format an item link in HTML.""" + if linkify and is_item(item): + if item.header: + link = '{u}
{h}'.format( + u=item.uid, h=item.header, p=item.document.prefix + ) + else: + link = '{u}'.format( + u=item.uid, p=item.document.prefix + ) + return link + else: + return str(item.uid) # if not `Item`, assume this is an `UnknownItem` + + def _format_md_label_links(label, links, linkify): """Join a string of label and links with formatting.""" if linkify: - return "*{lb}* {ls}".format(lb=label, ls=links) + return "{lb} {ls}".format(lb=label, ls=links) else: return "*{lb} {ls}*".format(lb=label, ls=links) def _table_of_contents_md(obj, linkify=None): - toc = '### Table of Contents\n\n' + toc = '**Contents**\n\n' for item in iter_items(obj): if item.depth == 1: @@ -554,7 +561,10 @@ def _table_of_contents_md(obj, linkify=None): elif item.header: heading = "{h}".format(h=item.header) else: - heading = item.uid + if settings.ENABLE_HEADERS and item.header: + heading = item.header + else: + heading = item.uid if settings.PUBLISH_HEADING_LEVELS: level = _format_level(item.level) @@ -595,6 +605,7 @@ def _lines_html( if toc: toc_md = _table_of_contents_md(obj, True) + toc_md = '[🡨 Index](index.html) \n\n ' + toc_md # Add a link to index toc_html = markdown.markdown(toc_md, extensions=extensions) else: toc_html = '' diff --git a/doorstop/core/tests/files/index.html b/doorstop/core/tests/files/index.html index e3f0cce56..e4bbc302a 100644 --- a/doorstop/core/tests/files/index.html +++ b/doorstop/core/tests/files/index.html @@ -1,128 +1,8 @@ - + + diff --git a/doorstop/core/tests/files/index2.html b/doorstop/core/tests/files/index2.html index bbd0d211c..eb97d1af2 100644 --- a/doorstop/core/tests/files/index2.html +++ b/doorstop/core/tests/files/index2.html @@ -1,128 +1,8 @@ - + + @@ -144,39 +24,39 @@

Published Documents:

Item Traceability:

- -----+
+++++ - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + +
SYS HLR LLR HLT LLT SYS HLR LLR HLT LLT
KNOWN-001 KNOWN-001
UNKNOWN-002 UNKNOWN-002

diff --git a/doorstop/core/tests/files/published.html b/doorstop/core/tests/files/published.html index 2e85894af..ab163ca8c 100644 --- a/doorstop/core/tests/files/published.html +++ b/doorstop/core/tests/files/published.html @@ -17,9 +17,10 @@
-