Some urls are not fixed by script fix-urls.sh during build.

Bug #570111 reported by Leo Iannacone
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-docs (Ubuntu)
Won't Fix
Wishlist
Unassigned

Bug Description

Binary package hint: ubuntu-docs

Hi all,

there are some urls that are not fixed by fix-urls.sh script.

If I build doc and then run:

lucid/build $ grep -ir 'ghelp' *

I receive:

newtoubuntu/C/updates.html: <p>For further reading on keeping your computer up to date and other computer safety tips, see <a class="ulink" href="ghelp:keeping-safe" target="_top">Keeping Your Computer Safe</a>. Further reading on how applications are managed in Ubuntu can be found in <a class="ulink" href="../../add-applications/C/" target="_top">Adding, Removing and Updating Applications</a>.</p>
newtoubuntu/C/music-video.html: <p>For more instructions about playing music and videos, see <a class="ulink" href="ghelp:musicvideophotos" target="_top">Music, Video and Photos</a>.</p>
newtoubuntu/C/welcome.html: <p>For more information about Ubuntu, see <a class="ulink" href="ghelp:about-ubuntu" target="_top">About Ubuntu</a>.</p>
newtoubuntu/C/connecting.html: <p>For further reading or troubleshooting see <a class="ulink" href="ghelp:internet" target="_top">Internet and Networks</a>.</p>
switching/go01.html: To setup a fax modem, see <a class="ulink" href="ghelp:printing#faxing" target="_top">Faxing</a>.

So, there are some strings to add at fix-urls.sh.

Anyway, this is just a my opinion, I think that fix-urls.sh is not the best way to translate urls. I think that a python script could do a better work in less code lines, and could be also better to support in next releases without dreadful static sed expressions.

Tags: script
Leo Iannacone (l3on)
summary: - Some urls are not fixed by script.
+ Some urls are not fixed by script fix-urls.sh during build.
description: updated
Revision history for this message
Connor Imes (ckimes) wrote :

For now we will need to fix the URLs, perhaps in the future we will find a better way to maintain this as you suggested. If you have anything solid you can present as an alternative to our current method, we would certainly be interested in seeing it. Thank you for your report.

Changed in ubuntu-docs (Ubuntu):
importance: Undecided → High
Revision history for this message
Matthew East (mdke) wrote :

Leo - we're not very good at making scripts, so feel free to propose a different solution which could work better.

Changed in ubuntu-docs (Ubuntu):
status: New → Confirmed
Revision history for this message
Leo Iannacone (l3on) wrote :

In this morning I saw in deep the script and I realize that is impossibile make any dynamic functions to fix urls.

For example, take a look at this sed line:

sed -i build/$y/$lang/*.html -e "s#ghelp:musicvideophotos\#photos-printing#\.\./\.\./musicvideophotos/$lang/photos.html\#photos-printing#g"

There is no apparent link between "ghelp:musicvideophotos#photos-printing" ghelp url and "musicvideophotos/$lang/photos.html#photos-printing" html url.

Or am I missing it?

Anyway, we can make a py script that at least replace the dreadful sed escape characters with readable strings.
A dictionary, for example, could be definied:
url_to_fix = {
  "ghelp:musicvideophotos#photos-printing": "musicvideophotos/%s/photos.html#photos-printing",
}

Revision history for this message
Leo Iannacone (l3on) wrote :

This is the script I wrote.

It's very similar at old fix-urls.sh.

The only benefits are:
 * present urls are more clear (withoud escape characters)
 * seems to be faster during excecution

Revision history for this message
Leo Iannacone (l3on) wrote :

I'm continuing to find broken urls:

Page: newtoubuntu/it/applications.html
Broken icons.

And a lot of '.html-' in href that are clearly broken:

desktop-effects/C/compiz-default-plugins.html: <p>The Viewport Switcher is used to switch <a class="ulink" href="http://library.gnome.org/users/user-guide/stable/overview.html-workspaces" target="_top">workspaces</a>
hardware/C/input-devices.html: <a class="ulink" href="http://library.gnome.org/users/user-guide/stable/prefs.html-mouse" target="_top">Mouse Preferences</a>
hardware/C/input-devices.html: <a class="ulink" href="http://library.gnome.org/users/user-guide/stable/prefs.html-keyboard" target="_top">Keyboard Preferences</a>
keeping-safe/C/backup-files.html: <p>By default, restored files and directories are owned by root. This is because Simple Backup Suite runs with root priveleges. You need to <a class="ulink" href="http://library.gnome.org/users/user-guide/stable/nautilus.html-permissions" target="_top">change these file or folder permissions</a> using <span class="application"><strong>File Browser</strong></span>.
musicvideophotos/C/music-listen.html: <p>See the <a class="ulink" href="http://library.gnome.org/users/user-guide/stable/nautilus.html-preferences" target="_top">
newtoubuntu/C/music-video.html: <p>To add support for all frequently used music and video files, <a class="ulink" href="apt:ubuntu-restricted-extras" target="_top">install the ubuntu-restricted-extras package</a>. This will also add support for <a class="ulink" href="../../musicvideophotos/C/video.html-playback-flash" target="_top">websites which use Flash video</a>.</p>
serverguide/C/mysql.html: The documentation is in HTML format, to view them enter <span class="command"><strong>file:///usr/share/doc/mysql-doc-5.0/refman-5.0-en.html-chapter/index.html</strong></span>

Revision history for this message
Leo Iannacone (l3on) wrote :
Download full text (5.6 KiB)

Ok, I understood why there are a lot of '.html-' href.

This occurs because if you have these strings to translate:
'aaa': 'www'
'aaa#bbb': 'www#zzz'

If you execute the replacing of the first one, you'll have every aaa translated:
href="www"
href="www#bbb"

So when you looking for second one you'll never match.

The solution at this problem is simple, in fix-urls.sh you could replace all urls in this way:
OLD ONES:
s#url1#url2#g

NEW ONES:
s#"url1"#"urls"#g

This make sure that when you replace some urls like:
href="aaa"
You'll translate just it, and an href="aaa#bbb" will remains the same.

There is a more simple solution in fix-urls.py, just remplace this line:
            body = body.replace(""url, urls[url] % {'lang' : language})
in this one:
            body = body.replace('\"%s\"' % url , '\"%s\"' % (urls[url] % {'lang' : language}))

So, after a rebuild I saw several untraslated urls:

add-applications/C/installing.html: <p>For more information about using the <span class="application"><strong>Ubuntu Software Center</strong></span>, consult the <a class="ulink" href="ghelp:software-center" target="_top">Ubuntu Software Center Manual</a>.</p>
add-applications/C/removing.html: <p>For more information about using the <span class="application"><strong>Ubuntu Software Center</strong></span>, consult the <a class="ulink" href="ghelp:software-center" target="_top">Ubuntu Software Center Manual</a>.</p>
desktop-effects/C/compiz-default-plugins.html: <p>The Viewport Switcher is used to switch <a class="ulink" href="ghelp:user-guide#overview-workspaces" target="_top">workspaces</a>
hardware/C/disks.html: <a class="ulink" href="ghelp:add-applications#removing" target="_top">
internet/C/email.html: <p>The <span class="application"><strong>Evolution</strong></span> groupware suite is the default email client, and can handle all of your <a class="ulink" href="http://library.gnome.org/users/evolution/stable/usage-mail.html" target="_top">email</a>, <a class="ulink" href="ghelp:evolution#usage-contact" target="_top">contact lists</a>, <a class="ulink" href="ghelp:evolution#usage-calendar-todo" target="_top">tasks</a> and <a class="ulink" href="http://library.gnome.org/users/evolution/stable/usage-calendar.html" target="_top">calendar</a> needs. It also integrates with the <a class="ulink" href="http://library.gnome.org/users/clock/stable/" target="_top">panel clock</a>, giving you one-click access to your task list.</p>
internet/C/modem-connect.html: If you have no working Internet connection, then you will need to obtain this package and install it, see <a class="ulink" href="ghelp:add-applications#installing-deb" target="_top">Downloading and installing a .deb package</a> for more information.</p>
keeping-safe/C/backup-files.html: <p>By default, restored files and directories are owned by root. This is because Simple Backup Suite runs with root priveleges. You need to <a class="ulink" href="ghelp:user-guide#nautilus-permissions" target="_top">change these file or folder permissions</a> using <span class="application"><strong>File Browser</strong></span>.
music...

Read more...

Revision history for this message
Matthew East (mdke) wrote :

I think the fix-urls.sh script has been updated so that all urls are currently fixed during the build (except those for which we don't have a good alternative link).

Leo - your suggestion to improve and simplify the script is still a valid bug so I'll leave this bug open and reduce the importance to "Wishlist". It's not clear to me from your previous comments whether you have a working alternative - could you clarify?

Changed in ubuntu-docs (Ubuntu):
importance: High → Wishlist
Revision history for this message
Leo Iannacone (l3on) wrote : Re: [Bug 570111] Re: Some urls are not fixed by script fix-urls.sh during build.
  • fix-urls.py Edit (11.4 KiB, text/x-python; name="fix-urls.py"; charset="UTF-8")

Il giorno dom, 15/08/2010 alle 13.35 +0000, Matthew East ha scritto:
> Leo - your suggestion to improve and simplify the script is still a
> valid bug so I'll leave this bug open and reduce the importance to
> "Wishlist". It's not clear to me from your previous comments whether you
> have a working alternative - could you clarify?

Hi Matt,
sorry for delay.

Try this script (see attached), should work fine.

Note that urls are old (script is based on lucid doc branch) and need to
be upgrade to work in maverick one.

--
Ubuntu Member - http://launchpad.net/~l3on
Home Page - http://leoiannacone.com
GPG Key Id - 0xD59257A9

Revision history for this message
Leo Iannacone (l3on) wrote :

Hi Matt,
sorry for delay.

Try this script (see attached). Pay attention that urls are based on lucid doc branch, you need to upgrade them in order to make script work fine in maverick doc.

John Kim (kotux)
tags: added: script
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

No longer applicable. Closing.

Changed in ubuntu-docs (Ubuntu):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.