1. scope
  2. hob

Commits

Jan Borsodi  committed 33c313b Merge

Merged with 0.3.3

  • Participants
  • Parent commits ecedf3d, 3e8afef
  • Branches repo-manager

Comments (0)

Files changed (7)

File .hgignore

View file
  • Ignore whitespace
 js-out/
 mako-py/
 glob:*.bat
+.tox
+tox.ini

File .hgtags

View file
  • Ignore whitespace
 cfac3c5a1fbacb5f4fef68fa513a4aae2929e6cc 0.2.1
 ccb42024943b2a679ca969becfda1bd0866c86e3 0.3
 687e298c15eb56f4dccebf6bce893df2d212b9a7 0.3.1
+0c1f48ab832ae93802a6ed66996a55b4e9f0a139 0.3.2
+095039008b45b625d3a02e3e3b365e723ac5af69 0.3.3

File CHANGELOG

View file
  • Ignore whitespace
+0.3.3 - 2011-01-25
+------------------
+
+hob
+~~~
+
+* Fixed issue 2: Incorrect parsing of documentation blocks
+  Now it only removes the initial whitespace + asterisk from doc blocks and
+  keeps the rest as it is.
+
+0.3.2 - 2011-01-25
+------------------
+
+* Fixed manifest to include templates in the new location, 0.3 and 0.3.1 was
+  released without any template files because of this.
+
+hob
+~~~
+
+* Fixed reading of command options and arguments from config file to only
+  occur on the current command in use. Earlier it would read from all
+  commands which would overwrite values for options/arguments with same
+  name but from a different command.
+
 0.3.1 - 2010-12-01
 ------------------
 

File MANIFEST.in

View file
  • Ignore whitespace
 include LICENSE
 include favicon.ico
 recursive-include hob *.py
-recursive-include templates *.mako *.js *.css *.proto
+recursive-include hob/templates *.mako *.js *.css *.proto

File hob/__init__.py

View file
  • Ignore whitespace
 """A multi-language code generator for the Opera Scope Protocol. Code is generated from Google Protocol Buffer definitions.
 """
 
-__version_num__ = (0, 3, 1)
+__version_num__ = (0, 3, 3)
 __version__ = ".".join(map(str, __version_num__))
 __author__ = "Jan Borsodi, Christian Krebs"
 __author_email__ = "jborsodi@opera.com, chrisk@opera.com"

File hob/utils.py

View file
  • Ignore whitespace
     if re.match("///", cmt):
         cmt = cmt[3:]
     elif cmt.startswith("/**") and cmt.endswith("*/"):
-        m = re.match(r"/\*\*(?:\w*[\n])?(.+)(?:\w+)?\*/", cmt, re.DOTALL | re.MULTILINE)
+        m = re.match(r"/\*\*(?:\w*[\n])?(.+)/$", cmt, re.DOTALL | re.MULTILINE)
         cmt = m.group(1)
-        cmt = "".join([re.sub("[ \t]*[*]", "", line) for line in cmt.splitlines(True)])
+        cmt = "".join([re.sub("^[ \t]*[*]", "", line, flags=re.MULTILINE) for line in cmt.splitlines(True)])
     return textwrap.dedent(cmt)
 
 words_re = re.compile("([A-Z][A-Z0-9]*(?=[A-Z][a-z0-9]))|([A-Z][A-Z0-9]*$)|([A-Z][a-z0-9]*)|([a-z][a-z0-9]*)")

File tests/test_utils.py

View file
  • Ignore whitespace
+import difflib
+from hob.utils import parse_docblock
+
+def compareOutput(out, expected):
+    if out != expected:
+        for line in difflib.unified_diff(expected.splitlines(True), out.splitlines(True), "a", "b"):
+            print line,
+    assert out == expected
+
+def test_parse_docblock():
+    doc = """/**
+ * **DocTc** is a fake service designed to test the doucmentation generator.
+ *
+ * Inline markup (this is a subtitle)
+ * ----------------------------------
+ * This sentence uses *italic* text. This sentence uses **bold**.
+ *
+ * We also have ``monospace text``. Does monospace also work next to an edge?
+ * ``Maybe``.
+ *
+ * This interpreted text: `DocTc` should probably link to the service. So should
+ * `DocTc::PerformSomeAction`. That's probably some amount of work, though.
+ *
+ * Lists
+ * -----
+ *
+ * - First way
+ * - Of doing lists
+ *
+ * * Second way
+ * * Meh, don't use this way. But it should work.
+ *
+ * Enumerated list:
+ *
+ * #. One
+ * #. Two
+ *
+ * Escaping
+ * --------
+ *
+ * \*not bold*, \``not monospace``, a backslash should be visible: \\
+ *
+ * Line blocks
+ * -----------
+ *
+ * | These
+ * | words
+ * | should
+ * | be
+ * | on
+ * | different
+ * | lines
+ */"""
+
+    expected = """**DocTc** is a fake service designed to test the doucmentation generator.
+
+Inline markup (this is a subtitle)
+----------------------------------
+This sentence uses *italic* text. This sentence uses **bold**.
+
+We also have ``monospace text``. Does monospace also work next to an edge?
+``Maybe``.
+
+This interpreted text: `DocTc` should probably link to the service. So should
+`DocTc::PerformSomeAction`. That's probably some amount of work, though.
+
+Lists
+-----
+
+- First way
+- Of doing lists
+
+* Second way
+* Meh, don't use this way. But it should work.
+
+Enumerated list:
+
+#. One
+#. Two
+
+Escaping
+--------
+
+\*not bold*, \``not monospace``, a backslash should be visible: \\
+
+Line blocks
+-----------
+
+| These
+| words
+| should
+| be
+| on
+| different
+| lines
+"""
+    result = parse_docblock(doc)
+    compareOutput(result, expected)
+
+def test_parse_docblock2():
+    doc = """/**
+     *   RST
+     *   ---
+     *
+     *   Is whitespace
+     *   preserved (in rst)?
+     *
+     *   Everything except the first space after the asterisk should be preserved. IMO.
+     *
+     *              MIxed
+     *             WhItespace
+     *   This is horrIble
+     *               I am aligned (in rst)
+     */"""
+
+    expected = """RST
+---
+
+Is whitespace
+preserved (in rst)?
+
+Everything except the first space after the asterisk should be preserved. IMO.
+
+           MIxed
+          WhItespace
+This is horrIble
+            I am aligned (in rst)
+"""
+
+    result = parse_docblock(doc)
+    compareOutput(result, expected)