Hi, I'm about to upload the new version of the 3.4 wikihelp. These are the patches I am using to generate that, would be great to get them in the repository :-) - can anybody sign-off & push them for me? They are all against the help repository.
Thank you, Kendy
>From 1a2123c6b92692f14734c4cb953fd9222f99a0bb Mon Sep 17 00:00:00 2001 From: Jan Holesovsky <[email protected]> Date: Thu, 19 May 2011 22:04:00 +0200 Subject: [PATCH 1/5] hid.lst is not used any more. --- helpcontent2/to-wiki/wikiconv2.py | 21 +-------------------- 1 files changed, 1 insertions(+), 20 deletions(-) diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py index 6a3d766..7d5cc3e 100755 --- a/helpcontent2/to-wiki/wikiconv2.py +++ b/helpcontent2/to-wiki/wikiconv2.py @@ -13,9 +13,6 @@ titles = [] # map of id -> localized text localization_data = {} -# content of the hid.lst file for easier searching -hid_lst = {} - # to collect a list of pages that will be redirections to the pages with nice # names redirects = [] @@ -118,16 +115,6 @@ replace_text_list = \ ["$PRODUCTNAME", "{{ProductName}}"] ] -def load_hid_lst(): - global hid_lst - hid_lst = {} - file = codecs.open("helpers/hid.lst", "r", "utf-8") - for line in file: - ids = line.strip().split(" ") - if len(ids) == 2: - hid_lst[ids[0].upper()] = ids[1] - file.close() - def get_link_filename(link, name): text = link.strip() fragment = '' @@ -397,12 +384,7 @@ class Bookmark(ElementBase): self.app = parser.current_app_raw self.target = parser.wiki_page_name self.authoritative = parser.follow_embed - if name.find('.uno:') == 0 or name.find('.HelpId:') == 0: - self.redirect = name - elif name.upper() in hid_lst: - self.redirect = hid_lst[name.upper()] - #else: - # sys.stderr.write('Unhandled redirect "%s"\n'% name) + self.redirect = name def get_all(self): global redirects @@ -1281,7 +1263,6 @@ def convert(generate_redirects, lang, sdf_file): global images images = set() - load_hid_lst() loadallfiles("alltitles.csv") if lang != '': -- 1.7.3.1
>From b5f8b25f45e057d46089fcb3de8a4378dae806ce Mon Sep 17 00:00:00 2001 From: Jan Holesovsky <[email protected]> Date: Thu, 1 Sep 2011 00:08:45 +0200 Subject: [PATCH 2/5] Adapt to the translations repository. --- helpcontent2/help-to-wiki.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helpcontent2/help-to-wiki.py b/helpcontent2/help-to-wiki.py index ca3b774..d25cb99 100755 --- a/helpcontent2/help-to-wiki.py +++ b/helpcontent2/help-to-wiki.py @@ -94,11 +94,11 @@ os.system( "python to-wiki/getalltitles.py source/text > alltitles.csv" ) try: sdf_path = args[0] except: - sdf_path = '../../l10n/l10n/source' + sdf_path = '../../translations/unxlngx6.pro/misc/sdf-l10n' sys.stderr.write('Path to the .sdf files not provided, using "%s"\n'% sdf_path) # do the work for lang in langs: - wikiconv2.convert(generate_redirects, lang, '%s/%s/localize.sdf'% (sdf_path, lang)) + wikiconv2.convert(generate_redirects, lang, '%s/%s.sdf'% (sdf_path, lang)) # vim:set shiftwidth=4 softtabstop=4 expandtab: -- 1.7.3.1
>From 2613378842796f999a35be4727739c78db8908ad Mon Sep 17 00:00:00 2001 From: Korrawit Pruegsanusak <[email protected]> Date: Fri, 2 Dec 2011 22:27:03 +0700 Subject: [PATCH 3/5] fdo#42924 don't ignore empty TableCell Element, also check if it's a header Checking whether an empty TableCell Element is a header row is now in 2 cases: * | e | h | h | h | h | ... => The empty cell should be a header This case occurs when this row is the first row in the table. * | h | p | p | e | p | ... => The empty cell should not be a header This case occurs when this row is not the first row in the table, but the first column is the row header. where | is a column seperator, e is an empty cell, h is a header cell (which has role="tablehead" attribute), and p is not a header cell. Note that parsing occurs left-to-right, so isTableHeader depends on the last TableCell Element in that row. I assume that if the last element is a header, that row should be a header row. Currently this code gives correct behaviour, but checking whether a row is the first row might be more correct. --- helpcontent2/to-wiki/wikiconv2.py | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py index 7d5cc3e..0ad5038 100755 --- a/helpcontent2/to-wiki/wikiconv2.py +++ b/helpcontent2/to-wiki/wikiconv2.py @@ -472,8 +472,10 @@ class Text: class TableCell(ElementBase): def __init__(self, attrs, parent): ElementBase.__init__(self, 'tablecell', parent) + self.cellHasChildElement = False def start_element(self, parser, name, attrs): + self.cellHasChildElement = True if name == 'bookmark': self.parse_child(Bookmark(attrs, self, 'div', parser)) elif name == 'comment': @@ -489,6 +491,18 @@ class TableCell(ElementBase): else: self.unhandled_element(parser, name) + def get_all(self): + text = '' + if not self.cellHasChildElement: # an empty element + if self.parent.isTableHeader: # get from TableRow Element + role = 'tablehead' + else: + role = 'tablecontent' + text = text + replace_paragraph_role['start'][role] + text = text + replace_paragraph_role['end'][role] + text = text + ElementBase.get_all(self) + return text + class TableRow(ElementBase): def __init__(self, attrs, parent): ElementBase.__init__(self, 'tablerow', parent) @@ -1086,6 +1100,10 @@ class TableContentParagraph(Paragraph): self.role = 'tablecontentcode' else: self.role = 'tablecontent' + if self.role == 'tablehead': + self.parent.parent.isTableHeader = True # self.parent.parent is TableRow Element + else: + self.parent.parent.isTableHeader = False class ParserBase: def __init__(self, filename, follow_embed, embedding_app, current_app, wiki_page_name, lang, head_object, buffer): -- 1.7.3.1
>From 3ea3bb2a7140f9b27f0f5226de4826cb1d831fec Mon Sep 17 00:00:00 2001 From: Korrawit Pruegsanusak <[email protected]> Date: Sun, 25 Dec 2011 11:59:50 +0700 Subject: [PATCH 4/5] wikihelp: change table default to class="wikitable" Signed-off-by: Jan Holesovsky <[email protected]> --- helpcontent2/to-wiki/wikiconv2.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py index 0ad5038..6bbe80e 100755 --- a/helpcontent2/to-wiki/wikiconv2.py +++ b/helpcontent2/to-wiki/wikiconv2.py @@ -531,7 +531,7 @@ class Table(ElementBase): def get_all(self): # + ' align="left"' etc.? - text = '{| border="1"\n' + \ + text = '{| class="wikitable"\n' + \ ElementBase.get_all(self) + \ '|}\n\n' return text -- 1.7.3.1
>From d4bb6c21ad32881f166d6cdca1198adfc45402da Mon Sep 17 00:00:00 2001 From: Jan Holesovsky <[email protected]> Date: Thu, 19 May 2011 22:06:29 +0200 Subject: [PATCH 5/5] Hardcode 3.4 version - it will be available as help.libreoffice.org/3.4 --- helpcontent2/help-to-wiki.py | 3 ++- helpcontent2/to-wiki/getalltitles.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/helpcontent2/help-to-wiki.py b/helpcontent2/help-to-wiki.py index d25cb99..7bc3029 100755 --- a/helpcontent2/help-to-wiki.py +++ b/helpcontent2/help-to-wiki.py @@ -41,13 +41,14 @@ def create_wiki_dirs(): try: os.mkdir( "wiki" ) + os.mkdir( "wiki/3.4" ) except: sys.stdout.write( "wiki already generated - the wiki/ subdir exists\n" ) sys.exit( 1 ) for i in dirs: try: - os.mkdir( "wiki/" + i ) + os.mkdir( "wiki/3.4/" + i ) except: pass diff --git a/helpcontent2/to-wiki/getalltitles.py b/helpcontent2/to-wiki/getalltitles.py index 18a2dc0..6e939d2 100755 --- a/helpcontent2/to-wiki/getalltitles.py +++ b/helpcontent2/to-wiki/getalltitles.py @@ -123,7 +123,7 @@ def parsexhp(filename): title = tp.get_title() if len(title) > 0: readable_title = readable_text(title) - title = module + '/' + wiki_text(title) + title = '3.4/' + module + '/' + wiki_text(title) title = title.replace(' ', '_') title = title.replace('___', '_') title = title.replace('__', '_') -- 1.7.3.1
_______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
