discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] GNU Radio Wikis


From: Martin Dvh
Subject: Re: [Discuss-gnuradio] GNU Radio Wikis
Date: Sun, 25 Feb 2007 15:21:52 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20070113)

Eric Blossom wrote:
> On Mon, Nov 20, 2006 at 10:35:19AM -0500, Lamar Owen wrote:
> 
>>On Saturday 18 November 2006 19:54, Berndt Josef Wulf wrote:
>>
>>>where did the old GNU Radio Wiki go? I'm looking for the pages containing
>>>information on user applications, sample data files, howto files etc. I
>>>can't find them on www.gnuradio.org/trac/wiki anymore.
>>
>>There are a number of pages gone now, like the docs on multiple synced 
>>USRP's, 
>>syncing clocks, and such.  I did find some bookmarks I had, though, that 
>>still work as of this morning:
>>http://comsec.com/wiki?UniversalSoftwareRadioPeripheral
>>http://comsec.com/wiki?DaughterboardReleaseNotes
>>and others reachable from those pages.
> 
> 
>>I've made local copies of those pages (among others) in case the
>>comsec wiki goes away.
> 
>   
> I have complete copies of the comsec wiki pages (the ascii usemod
> source format), and some code that does a partial conversion from the
> usemod format into the trac format.  It still needs some work, and I'm
> not likely to get back to it any time soon.
> 
> If someone would like to complete the conversion, I'd be delighted to
> upload the converted files into the new wiki.
> 
> The code that does part of the conversion is here:
> 
>   $ svn co http://gnuradio.org/trac/usemod2trac
>
> (convert_usemod_to_trac.py is the file that needs work)
To get more of the old wiki pages available I extended the 
convert_usemod_to_trac.py a bit.
It should now handle lists (****) and : better.
(my new version is attached)
I also put a few more pages in the new trac wiki, converted with this script.
(e.g. USRPClockingNotes and MultiUsrp)


The old wiki used to have categories which were handy for finding what you need.
The new Wiki only has a quite bare homepage.
You must know you have to click at TitleIndex to see all documents.
And then you only get a flat list.

I think it would be a good idea to give the TitleIndex a more prominent place 
in the WIKI homepage.
(somewhere at the top)
It would also be nice to have some Category System.
(CategoryInstall, CategorySignals, CategoryExamples, CategoryLinks)
Can this be done easy?



Greetings,

Martin




> 
> The latest usemod pages (extracted from the wiki using
> extract_pages_from_usemod.py ) are here:
> 
>   http://comsec.com/data/usemod-pages.tar.gz
> 
> Let me know if you've got any questions.  It would really be great if
> someone can find the time to complete the conversion.  Then we'd have
> a single (editable) wiki!
> 
> Eric
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 

#!/usr/bin/env python
#
# Copyright 2006 Free Software Foundation, Inc.
# 
# This file is part of GNU Radio
# 
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

import sys
import os
import os.path
import re
from optparse import OptionParser

# field separator
FS = '\xb3'

text_stash = []

def dequote(s):
    s = s.replace('&',  '&')
    s = s.replace('&lt;' ,  '<')
    s = s.replace('&gt;' ,  '>')
    s = s.replace('&quot;', '"')
    return s


def mo_group(n, f):
    return lambda match_object: f(match_object.group(n))


def store_raw(text):
    r = len(text_stash)
    text_stash.append(text)
    return FS + str(r) + FS
    

def store_pre(text):
    return store_raw('{{{' + text + '}}}')


def restore_saved_text(s):
    pat = re.compile(FS + r'(\d+)' + FS)
    while 1:
        s, n = pat.subn(mo_group(1, lambda digits: text_stash[int(digits)]), s)
        if n == 0:     # no substitutions made
            return s



nowiki_re = re.compile(r'<nowiki>(.*?)</nowiki>', re.IGNORECASE | re.DOTALL)
code_re   = re.compile(r'<code>(.*?)</code>',     re.IGNORECASE | re.DOTALL)
pre_re    = re.compile(r'<pre>(.*?)</pre>',       re.IGNORECASE | re.DOTALL)

def handle_multiline_markup(s):
    # The <nowiki> tag stores text with no markup
    s = nowiki_re.sub(mo_group(1, store_raw), s)
    # The <code> tag stores text with no {{{ markup }}}
    s = code_re.sub(mo_group(1, store_pre), s)
    # The <pre> tag stores text with no {{{ markup }}}
    s = pre_re.sub(mo_group(1, store_pre), s)

    s = re.sub(r'(?i)<b>(.*?)</b>', "'''\\1'''", s)
    s = re.sub(r'(?i)<i>(.*?)</i>', "''\\1''", s)
    s = re.sub(r'(?i)<strong>(.*?)</strong>', "'''\\1'''", s)
    s = re.sub(r'(?i)<em>(.*?)</em>', "''\\1''", s)
    s = re.sub(r'(?i)<br>', lambda mo: store_raw('[[BR]]'), s)
    
    return s


def handle_single_line_markup(page):
    r = []
    for s in page.split('\n'):
        r.append(handle_one_line(s))

    return '\n'.join(r)
    
    
def handle_one_line(s):
    # check for "definition list"
    #mo = re.match(r'^(;+)([^:]+):', s)
    #if mo:
    #    depth = len(mo.group(1))
    #    tag = mo.group(2)
    s=re.sub('^:', '[[BR]]        ', s)

    s=re.sub('^\*\*\*\*\*\*\*', '      *', s)
    s=re.sub('^\*\*\*\*\*\*', '     *', s)
    s=re.sub('^\*\*\*\*\*', '    *', s)
    s=re.sub('^\*\*\*\*', '   *', s)
    s=re.sub('^\*\*\*', '  *', s)
    s=re.sub('^\*\*', ' *', s)
    return s


def convert_1(input_filename, output_filename):
    ifile = open(input_filename, 'r')
    ofile = open(output_filename, 'w')
    s = ifile.read()
    s = dequote(s)

    # join lines with a backslash at the end
    s = re.sub(r'\\ *\n', ' ', s)

    s = handle_multiline_markup(s)
    s = handle_single_line_markup(s)
    
    s = restore_saved_text(s)
    ofile.write(s)


def main():
    usage = '%prog: [options] [file1.um]...'
    parser = OptionParser()
    parser.add_option('-o', '--output-directory', default='trac',
                      help='specify output directory [default=%default]')
    (options, args) = parser.parse_args()

    output_directory = options.output_directory
    if not os.path.isdir(output_directory):
        try:
            os.mkdir(output_directory, 0775)
        except:
            sys.stderr.write('failed to create directory \'%s\'' % (
                output_directory,))
            raise
            
    for input_filename in args:
        convert_1(input_filename,
                  os.path.join(output_directory,
                               
os.path.basename(os.path.splitext(input_filename)[0])))

if __name__ == '__main__':
    main()
    

reply via email to

[Prev in Thread] Current Thread [Next in Thread]