Skip to content

Commit

Permalink
Merge pull request #226 from jacebrowning/release/v1.2
Browse files Browse the repository at this point in the history
Release v1.2
  • Loading branch information
jacebrowning authored Feb 12, 2017
2 parents 1caf917 + 1776ff3 commit 1005c69
Show file tree
Hide file tree
Showing 46 changed files with 356 additions and 186 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Revision History

## 1.2 (2017/02/11)

- Disabled excessive text cleanup in items. (credit: [@michaelnt](https://github.com/michaelnt))
- Running `doorstop review all` will be required due to whitespace changes.
- Added `--no-levels={all,body}` publishing options. (credit: [@michaelnt](https://github.com/michaelnt))
- Removed unnecessary line breaks (`<br>`) in generated HTML. (credit: [@michaelnt](https://github.com/michaelnt))
- **DEPRECATION WARNING:** `--no-body-levels` will not be supported in a future release.

## 1.1 (2017/01/09)

- Added '--strict-child-check' option to ensure links from every child document.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ifndef TRAVIS
endif

# Test settings
UNIT_TEST_COVERAGE := 98
UNIT_TEST_COVERAGE := 97
INTEGRATION_TEST_COVERAGE := 98

# System paths
Expand Down
2 changes: 1 addition & 1 deletion doorstop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

__project__ = 'Doorstop'
__version__ = '1.1'
__version__ = '1.2'

CLI = 'doorstop'
GUI = 'doorstop-gui'
Expand Down
13 changes: 7 additions & 6 deletions doorstop/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,17 +496,18 @@ def run_publish(args, cwd, error, catch=True):

# Write to output file(s)
if args.path:
path = os.path.abspath(os.path.join(cwd, args.path))
if whole_tree:
msg = "publishing tree to '{}'...".format(args.path)
msg = "publishing tree to '{}'...".format(path)
utilities.show(msg, flush=True)
path = publisher.publish(tree, args.path, ext, **kwargs)
published_path = publisher.publish(tree, path, ext, **kwargs)
else:
msg = "publishing document {} to '{}'...".format(document,
args.path)
path)
utilities.show(msg, flush=True)
path = publisher.publish(document, args.path, ext, **kwargs)
if path:
utilities.show("published: {}".format(path))
published_path = publisher.publish(document, path, ext, **kwargs)
if published_path:
utilities.show("published: {}".format(published_path))

# Or, display to standard output
else:
Expand Down
3 changes: 3 additions & 0 deletions doorstop/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ def _publish(subs, shared):
sub.add_argument('-C', '--no-child-links', action='store_true',
help="do not include child links on items")
sub.add_argument('-L', '--no-body-levels', action='store_true',
default=None,
help="do not include levels on non-heading items")
sub.add_argument('--no-levels', choices=['all', 'body'],
help="do not include levels on heading and non-heading or non-heading items")


if __name__ == '__main__': # pragma: no cover (manual test)
Expand Down
4 changes: 3 additions & 1 deletion doorstop/cli/test/docs/HLT001.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ links:
- TUT002: 3a4234ca2b58212fa1bd6052b113daa7
- TUT004: 81b4d9e74572f0a91b46c924de931c36
- TUT008: 2dbd9266fa287cc3f765c2a81aa57a91
- TUT017: adde6f14a8ab86bee61ba88db6960815
- TUT019: 85c96dfa447540b5433a67f1e1114c61
normative: true
ref: test_tutorial_section_1
reviewed: cef0e4c932ef5fe6a13e66fcafb8c8b8
reviewed: 2e4702d52e9ab2fd24b9d22270bcc4dc
text: |
Tutorial Section 1.0:
15 changes: 13 additions & 2 deletions doorstop/cli/test/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from doorstop.cli.test import ENV, REASON, ROOT, FILES, REQS, TUTORIAL
from doorstop.cli.test import SettingsTestCase

REQ_COUNT = 14
ALL_COUNT = 46
REQ_COUNT = 17
ALL_COUNT = 49


class TempTestCase(unittest.TestCase):
Expand Down Expand Up @@ -702,6 +702,17 @@ def test_publish_document_without_body_levels(self):
self.assertIs(None, main(['publish', 'tut', '--no-body-levels']))
self.assertFalse(settings.PUBLISH_BODY_LEVELS)

def test_publish_document_no_body_levels(self):
"""Verify 'doorstop publish' can create output without body levels."""
self.assertIs(None, main(['publish', 'tut', '--no-levels=body']))
self.assertFalse(settings.PUBLISH_BODY_LEVELS)

def test_publish_document_no_body_or_heading_levels(self):
"""Verify 'doorstop publish' can create output without heading or body levels."""
self.assertIs(None, main(['publish', 'tut', '--no-levels=all']))
self.assertFalse(settings.PUBLISH_BODY_LEVELS)
self.assertFalse(settings.PUBLISH_HEADING_LEVELS)

def test_publish_document_error_empty(self):
"""Verify 'doorstop publish' returns an error in an empty folder."""
os.chdir(self.temp)
Expand Down
12 changes: 11 additions & 1 deletion doorstop/cli/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import ast
from argparse import ArgumentTypeError
import logging
import warnings

from doorstop import common
from doorstop import settings
Expand Down Expand Up @@ -79,6 +80,7 @@ def configure_logging(verbosity=0):

def configure_settings(args):
"""Update settings based on the command-line options."""

# Parse common settings
if args.no_reformat is not None:
settings.REFORMAT = args.no_reformat is False
Expand All @@ -104,16 +106,24 @@ def configure_settings(args):
settings.WARN_ALL = args.warn_all is True
if args.error_all is not None:
settings.ERROR_ALL = args.error_all is True

# Parse `add` settings
if hasattr(args, 'server') and args.server is not None:
settings.SERVER_HOST = args.server
if hasattr(args, 'port') and args.port is not None:
settings.SERVER_PORT = args.port

# Parse `publish` settings
if hasattr(args, 'no_child_links') and args.no_child_links is not None:
settings.PUBLISH_CHILD_LINKS = args.no_child_links is False
if hasattr(args, 'no_body_levels') and args.no_body_levels is not None:
settings.PUBLISH_BODY_LEVELS = args.no_body_levels is False
warnings.simplefilter('default')
msg = "'--no-body-levels' option will be removed in a future release"
warnings.warn(msg, DeprecationWarning)
settings.PUBLISH_BODY_LEVELS = not args.no_body_levels
if hasattr(args, 'no_levels') and args.no_levels is not None:
settings.PUBLISH_BODY_LEVELS = False
settings.PUBLISH_HEADING_LEVELS = args.no_levels != 'all'


def literal_eval(literal, error=None, default=None):
Expand Down
28 changes: 19 additions & 9 deletions doorstop/core/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from doorstop.core.types import iter_documents, iter_items, is_tree, is_item
from doorstop import settings

EXTENSIONS = [
'markdown.extensions.extra',
'markdown.extensions.sane_lists',
]
CSS = os.path.join(os.path.dirname(__file__), 'files', 'doorstop.css')
INDEX = 'index.html'

Expand Down Expand Up @@ -39,7 +43,7 @@ def publish(obj, path, ext=None, linkify=None, index=None, **kwargs):
ext = ext or os.path.splitext(path)[-1] or '.html'
check(ext)
if linkify is None:
linkify = is_tree(obj) and ext == '.html'
linkify = is_tree(obj) and ext in ['.html', '.md']
if index is None:
index = is_tree(obj) and ext == '.html'

Expand Down Expand Up @@ -91,7 +95,7 @@ def _index(directory, index=INDEX, extensions=('.html',), tree=None):
if filenames:
path = os.path.join(directory, index)
log.info("creating an {}...".format(index))
lines = _lines_index(filenames, tree=tree)
lines = _lines_index(sorted(filenames), tree=tree)
common.write_lines(lines, path)
else:
log.warning("no files for {}".format(index))
Expand Down Expand Up @@ -212,7 +216,10 @@ def _lines_text(obj, indent=8, width=79, **_):
if item.heading:

# Level and Text
yield "{l:<{s}}{t}".format(l=level, s=indent, t=item.text)
if settings.PUBLISH_HEADING_LEVELS:
yield "{l:<{s}}{t}".format(l=level, s=indent, t=item.text)
else:
yield "{t}".format(t=item.text)

else:

Expand Down Expand Up @@ -275,12 +282,15 @@ def _lines_markdown(obj, linkify=False):
level = _format_level(item.level)

if item.heading:

text_lines = item.text.splitlines()
# Level and Text
standard = "{h} {l} {t}".format(h=heading, l=level, t=item.text)
if settings.PUBLISH_HEADING_LEVELS:
standard = "{h} {l} {t}".format(h=heading, l=level, t=text_lines[0])
else:
standard = "{h} {t}".format(h=heading, t=item.text)
attr_list = _format_md_attr_list(item, linkify)
yield standard + attr_list

yield from text_lines[1:]
else:

# Level and UID
Expand Down Expand Up @@ -336,7 +346,7 @@ def _format_level(level):

def _format_md_attr_list(item, linkify):
"""Create a Markdown attribute list for a heading."""
return " {{: #{u} }}".format(u=item.uid) if linkify else ''
return " {{#{u} }}".format(u=item.uid) if linkify else ''


def _format_text_ref(item):
Expand Down Expand Up @@ -400,7 +410,7 @@ def _format_md_label_links(label, links, linkify):
return "*{lb} {ls}*".format(lb=label, ls=links)


def _lines_html(obj, linkify=False, charset='UTF-8'):
def _lines_html(obj, linkify=False, extensions=EXTENSIONS, charset='UTF-8'):
"""Yield lines for an HTML report.
:param obj: Item, list of Items, or Document to publish
Expand Down Expand Up @@ -428,7 +438,7 @@ def _lines_html(obj, linkify=False, charset='UTF-8'):
yield '</head>'
yield '<body>'
text = '\n'.join(_lines_markdown(obj, linkify=linkify))
html = markdown.markdown(text, extensions=['extra', 'nl2br', 'sane_lists'])
html = markdown.markdown(text, extensions=extensions)
yield from html.splitlines()
if document:
yield '</body>'
Expand Down
2 changes: 1 addition & 1 deletion doorstop/core/test/docs/LLT001.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ active: true
derived: false
level: 1.1
links:
- REQ003: 64964eaf0252a2fc0bf1509f1bcd4b09
- REQ003: 1f33605bbc5d1a39c9a6441b91389e88
normative: true
ref: Verify an item can be added to a document.
reviewed: c87f21066512a269d35f83944607893c
Expand Down
6 changes: 3 additions & 3 deletions doorstop/core/test/docs/LLT007.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ active: true
derived: false
level: 2.1
links:
- REQ009: 2bc459e9afb3ac656fb94ba680b799ff
- REQ009: 6c23761dd907de37c62614155cca22cc
- REQ011: e58a22974b6610a0698866fce6c1ad14
- REQ012: 456cf6a9040c790588ca8c78e1ed350f
- REQ013: 349b2ab15cc29256da564fd7b4fac3a4
- REQ013: 3dce36a426be6e9901feac6de75c1d71
- REQ014: 634e782d9c7ec27a279e4fd303afe05f
- REQ015: 5057c48dd88b53fe5e639e1e33126714
normative: true
ref: ''
reviewed: caef4185ae89672f87a9daa3815feaf6
reviewed: e865230b7f344df2b0122ca90e278fce
text: |
These checks ensure the version control system (VCS) meets the needs of
requirements management:
Expand Down
2 changes: 1 addition & 1 deletion doorstop/core/test/docs/LLT008.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ links:
- REQ015: 5057c48dd88b53fe5e639e1e33126714
normative: true
ref: ''
reviewed: 4d93196743f8385e752efddd8ca6e672
reviewed: 05bcc369bcf9b1869049674546b41dba
text: |
These checks ensure the Python package is distributed properly:
Expand Down
9 changes: 8 additions & 1 deletion doorstop/core/test/files/exported.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
uid,level,text,ref,links,active,derived,normative,reviewed
REQ001,1.2.3,"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",,"SYS001
REQ001,1.2.3,"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.",,"SYS001
SYS002:abc123",True,False,True,
REQ003,1.4,Unicode: -40° ±1%,REF123,REQ001,True,False,True,
REQ004,1.6,"Hello, world!",,,True,False,True,
Expand Down
9 changes: 8 additions & 1 deletion doorstop/core/test/files/exported.tsv
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
uid level text ref links active derived normative reviewed
REQ001 1.2.3 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. "SYS001
REQ001 1.2.3 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum." "SYS001
SYS002:abc123" True False True
REQ003 1.4 Unicode: -40° ±1% REF123 REQ001 True False True
REQ004 1.6 Hello, world! True False True
Expand Down
Binary file modified doorstop/core/test/files/exported.xlsx
Binary file not shown.
9 changes: 8 additions & 1 deletion doorstop/core/test/files/published.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,14 @@
</head>
<body>
<h3 id="REQ001">1.2.3 REQ001</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.</p>
<p><em>Parent links:</em> <a href="SYS.html#SYS001">SYS001</a>, <a href="SYS.html#SYS002">SYS002</a></p>
<h2 id="REQ003">1.4 REQ003</h2>
<p>Unicode: -40° ±1%</p>
Expand Down
9 changes: 8 additions & 1 deletion doorstop/core/test/files/published.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
### 1.2.3 REQ001

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.

*Parent links: SYS001, SYS002*

Expand Down
16 changes: 10 additions & 6 deletions doorstop/core/test/files/published.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
1.2.3 REQ001

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia
deserunt mollit anim id est laborum.

Parent links: SYS001, SYS002

Expand Down
9 changes: 8 additions & 1 deletion doorstop/core/test/files/published2.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,14 @@
</head>
<body>
<h3>1.2.3 REQ001</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.</p>
<p><em>Links: SYS001, SYS002</em></p>
<h2>1.4 REQ003</h2>
<p>Unicode: -40° ±1%</p>
Expand Down
9 changes: 8 additions & 1 deletion doorstop/core/test/files/published2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
### 1.2.3 REQ001

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.

*Links: SYS001, SYS002*

Expand Down
Loading

0 comments on commit 1005c69

Please sign in to comment.