pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/py-blosxom Make sure the readmore plugin produces ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d5ba69802ea3
branches:  trunk
changeset: 333483:d5ba69802ea3
user:      hauke <hauke%pkgsrc.org@localhost>
date:      Tue May 07 14:26:06 2019 +0000

description:
Make sure the readmore plugin produces valid html - browsers are not
as tolerant as they used to be.

The current version does not yet support python3, so mandate 2.7.

diffstat:

 www/py-blosxom/Makefile                                    |  10 ++--
 www/py-blosxom/distinfo                                    |   4 +-
 www/py-blosxom/patches/patch-Pyblosxom_plugins_readmore.py |  30 +++++++++++++-
 3 files changed, 35 insertions(+), 9 deletions(-)

diffs (89 lines):

diff -r 4278e07999da -r d5ba69802ea3 www/py-blosxom/Makefile
--- a/www/py-blosxom/Makefile   Tue May 07 14:24:09 2019 +0000
+++ b/www/py-blosxom/Makefile   Tue May 07 14:26:06 2019 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.24 2019/04/26 13:14:20 maya Exp $
+# $NetBSD: Makefile,v 1.25 2019/05/07 14:26:06 hauke Exp $
 
 PYBLOXSOMVERS= 1.5.3
 DISTNAME=      pyblosxom-${PYBLOXSOMVERS}
 PKGNAME=       ${PYPKGPREFIX}-blosxom-${PYBLOXSOMVERS}
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    www
 MASTER_SITES=  http://pyblosxom.github.com/download/
 
@@ -23,11 +23,11 @@
 
 BUILD_DEPENDS+=        ${PYPKGPREFIX}-docutils>=0.12:../../textproc/py-docutils
 
-INSTALLATION_DIRS=     ${DOC_SUBDIR}
+INSTALLATION_DIRS=             ${DOC_SUBDIR}
 
-REPLACE_PYTHON=                Pyblosxom/data/pyblosxom.cgi
+REPLACE_PYTHON=                        Pyblosxom/data/pyblosxom.cgi
 
-PYTHON_VERSIONS_INCOMPATIBLE=   36 37
+PYTHON_VERSIONS_ACCEPTED=       27
 
 pre-configure:
        cd ${WRKSRC} && ${FIND} Pyblosxom -type f -name '*.orig' \
diff -r 4278e07999da -r d5ba69802ea3 www/py-blosxom/distinfo
--- a/www/py-blosxom/distinfo   Tue May 07 14:24:09 2019 +0000
+++ b/www/py-blosxom/distinfo   Tue May 07 14:26:06 2019 +0000
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.9 2015/11/04 02:47:24 agc Exp $
+$NetBSD: distinfo,v 1.10 2019/05/07 14:26:06 hauke Exp $
 
 SHA1 (pyblosxom-1.5.3/pyblosxom-1.5.3.tar.gz) = 62c7b178a5aa3a9df660bf6c357e0336ff473b9d
 RMD160 (pyblosxom-1.5.3/pyblosxom-1.5.3.tar.gz) = fcf6be7c8d9c9fa1ec4e59d34b11afe173ced382
 SHA512 (pyblosxom-1.5.3/pyblosxom-1.5.3.tar.gz) = d7829cc5fbcf7a277087bc3cd372bf7ad9f3c98429642d1304047b2b3a80473180c9a7694f9c691b57aa858a2f067a5e8fd07c2935c93861cb41ea851c107e26
 Size (pyblosxom-1.5.3/pyblosxom-1.5.3.tar.gz) = 210669 bytes
-SHA1 (patch-Pyblosxom_plugins_readmore.py) = e699b9b9193c540e88727cf297e6e52d59fe1fc9
+SHA1 (patch-Pyblosxom_plugins_readmore.py) = 768a7fa63e11cd971668ee4a493eb968395e7ce5
diff -r 4278e07999da -r d5ba69802ea3 www/py-blosxom/patches/patch-Pyblosxom_plugins_readmore.py
--- a/www/py-blosxom/patches/patch-Pyblosxom_plugins_readmore.py        Tue May 07 14:24:09 2019 +0000
+++ b/www/py-blosxom/patches/patch-Pyblosxom_plugins_readmore.py        Tue May 07 14:26:06 2019 +0000
@@ -1,10 +1,30 @@
-$NetBSD: patch-Pyblosxom_plugins_readmore.py,v 1.1 2015/05/22 14:01:16 hauke Exp $
+$NetBSD: patch-Pyblosxom_plugins_readmore.py,v 1.2 2019/05/07 14:26:06 hauke Exp $
+
+Try to make sure the truncated text is valid HTML
 
 Use the current flavour before the default one, if available.
 
 --- Pyblosxom/plugins/readmore.py.orig 2013-07-31 00:53:58.000000000 +0000
 +++ Pyblosxom/plugins/readmore.py
-@@ -209,7 +209,11 @@ def cb_story(args):
+@@ -194,8 +194,15 @@ def cb_story(args):
+     breakpoint = config.get("readmore_breakpoint", READMORE_BREAKPOINT)
+     template = config.get("readmore_template", READMORE_TEMPLATE)
+ 
+-    # check to see if the breakpoint is in the body.
+-    match = re.search(breakpoint, entry["body"])
++    """
++    Check to see if the breakpoint is in the body.
++
++    Since it might have been wrapped in html tags by a markdown
++    plugin, grab everything from the end of breakpoint up to, but
++    excluding, either the first opening tag, or newline.
++    """
++    match = re.search('(' + breakpoint + ')(.*?)(<[ ]*?[^/].+|[\n])',
++                      entry["body"])
+ 
+     # if not, return because we don't have to do anything
+     if not match:
+@@ -209,7 +216,11 @@ def cb_story(args):
      # otherwise we replace the breakpoint with the template
      base_url = config["base_url"]
      file_path = entry["file_path"]
@@ -17,3 +37,9 @@
      url = '%s/%s.%s' % (base_url, file_path, flavour)
  
      link = (template % {"url": url,
+@@ -218,4 +229,4 @@ def cb_story(args):
+                         "flavour": flavour})
+ 
+     entry["just_summary"] = 1
+-    entry["body"] = entry["body"][:match.start()] + link
++    entry["body"] = entry["body"][:match.start(1)] + link + str(match.group(2))



Home | Main Index | Thread Index | Old Index