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

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

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.

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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

1,787 views 25 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you