[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: What I'm going to do: Was: RFC: Description text in packages



On Thu, 2008-12-18 at 14:09 +0000, Richard Hughes wrote:
> On Wed, 2008-12-17 at 13:04 -0800, Toshio Kuratomi wrote:
> > In that case, you're going to have a lot of problems with adding
> > Markdown in PackageKit upstream.
> 
> http://www.packagekit.org/pk-faq.html#markup
> 
> > I doubt heavily that we'll be able to
> > get people within Fedora to agree to format their %descriptions as
> > markdown let alone the larger community of distributions.
> 
> I don't want people to change anything.

% cat ../pkg.description2markdown-html.py     
#! /usr/bin/python -tt

import os, sys, markdown2, yum

yb = yum.YumBase()
yb.conf.cache = os.geteuid() != 0

for pkg in yb.pkgSack.returnPackages(patterns=sys.argv[1:]):
  sep = "\n" + "-" * 79
  print "=" * 79
  print pkg, pkg.repoid, sep
  print pkg.description, sep
  print markdown2.markdown(pkg.description), sep

...after a quick search the following package descriptions will need to
be changed:

perl-Regexp-Shellish-0.93-4.fc9
txt2tags-2.5-4.fc9
geeqie-1.0-0.4.alpha1.fc9
tinyca2-0.7.5-3.fc7
moreutils-0.28-3.fc9
alpine-2.00-1.fc9
FEDORA-2008-5191

...the biggest problem seems to be parsing lists, for instance lists
with a "large" indent like "       * item 1" which markdown parses as a
<pre><code> block or using lists but using '-' or 'o' etc. instead of
'*', so markdown again fails to parse them as lists (I also assume it'll
fail to parse • too).

 I'm actually somewhat impressed by how well it does, but it still
requires a change in behaviour for a known tag ... and obviously doesn't
work anywhere near as well as what we have in yum (which just does
wrapping).

> > The problem is that Markdown and other non-intrusive formats (like
> > reStructuredText) don't have enough information to tell if it's
> > "invalid".  For instance, if my Bodhi comments have:
> > 
> > # Fix an issue with char *foobar and all void* on gcc-5
> > # Fix call to __init__ in python bindings.
> 
> Then you're going to get two titles. Seriously - who does that? If you
> follow what 99% of other people are doing and either do:
> 
> * lists
>  * that
>  - most
> - people
>  +   use
>
> Then it'll just work.

 Not quite. For instance:

msg = """\
If you follow what x% of other people are doing and do:

* lists
 * that
 - most
- people
 +   use

Then it'll just work.
"""

msg = """\
If you follow what y% of other people are doing and do:
* lists
 * that
 - most
- people
 +   use

Then it'll just fail.
"""

...it also seems to pass &blah; straight through to the html output,
although maybe that's a bug in the module?

-- 
James Antill <james fedoraproject org>
Fedora


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]