[cpl-plugin-sinfo] 11/18: New paragraphs for input and output files if possible; remove parameter description

Ole Streicher olebole-guest at alioth.debian.org
Sat Oct 26 12:55:46 UTC 2013


This is an automated email from the git hooks/post-receive script.

olebole-guest pushed a commit to branch debian
in repository cpl-plugin-sinfo.

commit 8ece9115f936ecc5a08bc3245bed1d288065a9b2
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Sat Oct 26 12:50:59 2013 +0200

    New paragraphs for input and output files if possible; remove parameter description
---
 debian/create_sphinx.py |   49 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 45 insertions(+), 4 deletions(-)

diff --git a/debian/create_sphinx.py b/debian/create_sphinx.py
index df17013..7818ac7 100644
--- a/debian/create_sphinx.py
+++ b/debian/create_sphinx.py
@@ -3,17 +3,27 @@
 import cpl
 import os
 import sys
+import re
 
 rst_template = '''{recipe}
 ====================================================
 
 .. data:: {recipe}
 
+Synopsis
+--------
+
 {synopsis}
 
-{description}
+Version
+-------
 
-Current version is {recipe}-{version}.
+Current version: **{recipe}-{version}**.
+
+Description
+-----------
+
+{description}
 
 Constructor
 -----------
@@ -133,16 +143,47 @@ def par(recipe, template, delimiter = "", count = None):
         recipe = recipe.__name__,
         par = p.name.replace("-","_"),
         type = p.type.__name__,
-        description = p.__doc__,
+        description = p.__doc__.replace("\n", "  "),
         default = '"{0}"'.format(p.default) if p.type is str else p.default
     ) for i, p in enumerate(recipe.param) if count is None or i < count)
 
+def get_description(s):
+    o = []
+    l = s.splitlines()
+    enabled = True
+    for i, s in enumerate(l):
+        if "BASIC PARAMETERS" in s:
+            enabled = False
+        elif "Examples:" in s:
+            enabled = False
+        elif "Input files" in s:
+            enabled = True
+            o += ["Input files", "^^^^^^^^^^^^", "::"]
+            if len(l[i+1]) != 0:
+                 o += [""]
+        elif "Output files" in s:
+            enabled = True
+            o += ["Output files", "^^^^^^^^^^^^", "::"]
+            if len(l[i+1]) != 0:
+                 o += [""]
+        elif not enabled:
+            continue
+        elif "-"*40 in s:
+            pass
+        elif len(s) == 0:
+            o += [ s ]
+        elif s[-1] == ".":
+            o += [ s, "" ]
+        else:
+            o += [ s ]
+    return "\n".join(o)
+
 def rstpage(recipe, template):
     return template.format(
         recipe = recipe.__name__,
         version = recipe.__version__,
         synopsis = recipe.description[0],
-        description = recipe.description[1].replace('.\n', '.\n\n'),
+        description = get_description(recipe.description[1]),
         email = recipe.__email__,
         author = recipe.__author__,
         license = recipe.__copyright__,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cpl-plugin-sinfo.git



More information about the debian-science-commits mailing list