Mediawiki sections translated as headers except title sections (was: UWC header parser not translating Mediawiki headers correctly)

Moriah Chandler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2013

EDIT: these aren't headers, they are sections. See: http://meta.wikimedia.org/wiki/Help:Section

However, the UWC is translating them as headers (a good thing if I can get it to recognize title sections!)

------------------------

The converter is working (after using the UWC exporter to create the files) except for one thing, only h2 and below headers are being converted. The syntax for h2 headers looks like this:

== Header 2 ==

This gets turned into a Confluence h1 tag ... so each header is pushed down a level and h1 isn't recognized. When I convert a file with "= Header 1 =" it is rendered as straight text:

= Header 1 =

Any ideas on how to fix this?

2 answers

1 accepted

0 votes
Answer accepted
Moriah Chandler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2013

I am clearly not a developer - I finally found where this translation is taking place. The regex was wrong and luckily I have developers that can correct these types of things. The resulting regex was:

Mediawiki.0540-re_title.java-regex=(?s)[^=]?=\s*(.*?)\s*=(?!([=])){replace-with}h1. $1

instead of

Mediawiki.0540-re_title.java-regex=(^|\n)={1}([^=]+)={1}(\n|$){replace-with}h1. $1

Works like a charm now.

Moriah Chandler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2013

I also bumped all of the headings up one so that they go to h5.

0 votes
Moriah Chandler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 19, 2013

I figured out that it is translating the Mediawiki sections into headers. The syntax described above looks like headers but is actually to define sections so that you can edit a specific section (or link to).

However, I can't find anywhere in the code that actually does this translation. I can only find where the headers are translated.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events