[kde-doc-english] Error replacing help:foo (local links) on doc.kde.org

Burkhard Lück lueck at hube-lueck.de
Sat Oct 25 21:01:37 UTC 2014


Am Freitag, 24. Oktober 2014, 12:25:18 schrieb Jack:
> On 2014.10.24 12:13, Burkhard Lück wrote:
> > Hi,
> > 
> > with Revision 1276619 I applied a patch from T.C. Hollingsworth to
> > generator
> > script to replace local links with links to d.k.o
> > 
> > The expression we use is:
> >  sed -r -i "s|help:/*((kioslave/\|kcontrol/)?[A-Za-
> > 
> > z]+)/*|/?branch=$branch\&language=$lang\&application=\1\&path=
> > |g" *.html
> > 
> > But that does not work properly with underscores in names, e.g
> > "help:/akonadi_sendlater_agent"
> > is replaced with
> > https://docs.kde.org/?branch=stable&language=en&application=akonadi&path=_
> > sendlater_agent but it should be
> > https://docs.kde.org/?branch=stable&language=en&application=akonadi_sendla
> > ter_agent
> > 
> > Anyone knows a solution, my regxexpr fu is really limited?
> 
> What about just adding an underscore to the part that recognizes the
> doc (change [A-Za-z] to [A-Za-z_]):
> 
> sed -r -i "s|help:/*((kioslave/\|kcontrol/)?[A-Za-
> z_]+)/*|/?branch=$branch\&language=$lang\&application=\1\&path=|
> g" *.html
> 
Yes that works :)

> However, the regexp looks like it should append "&path=" to that.  My
> change will make it append instead of inserting, but it's not clear to
> me where the path part should be, or if it is conditional on something
> else?

The "&path=" is appended, that is correct and the path can be empty.

Some examples all working properly using your regexpr:

"/?branch=stable&language=en&application=akonadi_sendlater_agent&path="

"/?branch=stable&language=en&application=fundamentals&path=config.html#shortcuts"

"/?branch=stable&language=en&application=kate&path="

Thanks a lot

-- 
Burkhard Lück



More information about the kde-doc-english mailing list