Need RegEx help for making the latest version of User Manual

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Need RegEx help for making the latest version of User Manual

Postby narayan » 2012 Apr 18, 07:45

Hi all,

I have finished writing the latest manual. Now I need to provide different character styles to the various types of text (e.g. user input, menu paths, keyboard shortcuts, etc.).

For this, I am going to use LibreOffice with an Addon called AltSearch.
This addon is capable of running find-and-replace operations with extended RegEx (for example, it can search within frames, footnotes, etc.).

I need RegEx patterns to search for the following:

1. Menu paths

These are typically enclosed by two words: "the" on the left and "menu" on the right. Check for other patterns in the User Manual v 1800 (pdf).

2. Keyboard shortcuts

These involve terms such as CTRL, SHFT, ALT, UpArrow, DownArrow, LeftArrow, RightArrow, ENTER, ESC, the + sign and a letter. This could be a single key (e.g. ESC or ENTER), or a combination (e.g. "CTRL+SHFT+D", "CTRL+LeftArrow").

Those who are good in composing RegEx patterns may please come forward and post the "find" patterns.

*****
I also need help from those of you who have experience in  OpenOffice/LibreOffice in general and AltSearch in particular.

Please drop a line here, and I will post further topics of discussion.

Thanks in advance!
narayan
Platinum Member
Platinum Member
 
Posts: 3479
Joined: 2002 Jun 04, 07:01

Re: Need RegEx help for making the latest version of User Ma

Postby Tuxman » 2012 Apr 21, 00:35

narayan wrote:I need RegEx patterns to search for the following

"RegEx", oh dear. There are a plenty of RegEx syntaxes around. (Is "syntaxes" a word at all?)

You'd need PCRE, I presume?

narayan wrote:1. Menu paths

These are typically enclosed by two words: "the" on the left and "menu" on the right.

Code: Select all
the (.*?) menu


narayan wrote:2. Keyboard shortcuts

These involve terms such as CTRL, SHFT, ALT, UpArrow, DownArrow, LeftArrow, RightArrow, ENTER, ESC, the + sign and a letter. This could be a single key (e.g. ESC or ENTER), or a combination (e.g. "CTRL+SHFT+D", "CTRL+LeftArrow").

Code: Select all
((CTRL|SHFT|ALT|UpArrow|DownArrow|LeftArrow|RightArrow|ENTER|ESC)\+)+\w+


No warranties, I'd recommend testing them in something like the Regex Tester ("Preg" setting) first.
Tux. ; tuxproject.de ; Windows 8.1 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Tuxman
Platinum Member
Platinum Member
 
Posts: 1170
Joined: 2009 Aug 19, 07:49

Postby kunkel321 » 2012 Apr 22, 16:06

The hotkey regex seems to work.  
Here's a shot of expresso:
Image

Also regarding Expresso...  
It's free http://www.ultrapico.com/ExpressoDownload.htm  I'm pretty sure it used to be quite expensive.
User avatar
kunkel321
Gold Member
Gold Member
 
Posts: 445
Joined: 2008 Jan 05, 18:58

Postby kunkel321 » 2012 Apr 22, 16:18

I've tinkered with other ways to retain the font styles of the Usber Manual, while also converting the text to raw TXT.

One is to use the LibreWriter ability of "finding styles." For example if the RTF text is "To  jump  to  the quick bookmark,  press  CTRL+F1  (or use  the  Go  to Quick Bookmark menu option)."  

You could have LO search for
Font = Bold AND Text = any text string

Then replace with the HTML code
Text = < b > any text string < / b >

resulting in "To  jump  to  the quick bookmark,  press  CTRL+F1  (or use  the  [ b ] Go  to Quick Bookmark [ / b ] menu option)."

That when you strip all formatting, the HTML markers are still there, and you use the same process to convert it back.  

I am able to get LO to look for Font = Bold, but I can only get it to find one word at a time.  I can't get it to find multiple words separated by spaces.  Also, I can't get it to remember the 'any text string' and put it back in the replace box.  (I can do this with MS Word).
User avatar
kunkel321
Gold Member
Gold Member
 
Posts: 445
Joined: 2008 Jan 05, 18:58

Postby Tuxman » 2012 Apr 22, 16:21

kunkel321 wrote:Also regarding Expresso...  
It's free http://www.ultrapico.com/ExpressoDownload.htm  I'm pretty sure it used to be quite expensive.

Not sure, I've been using it for years now without "pls buy me" - however, it seems to be dead.
Tux. ; tuxproject.de ; Windows 8.1 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Tuxman
Platinum Member
Platinum Member
 
Posts: 1170
Joined: 2009 Aug 19, 07:49

Postby narayan » 2012 Apr 23, 08:48

Thanks!

I need these RegEx patterns to use with AltSearch, a macro addon for LibreOffice (the successor for OpenOffice, in case you haven't heard of it).

This macro can do some pretty neat tricks with find-and-replace operations.
It uses some extended notations too.

I will be using it to find the matching text and apply a different character style to make it stand out.

In other words, the idea is to find keyboard shortcuts and menu paths and make them bold, sans serif, etc.
narayan
Platinum Member
Platinum Member
 
Posts: 3479
Joined: 2002 Jun 04, 07:01

Postby Tuxman » 2012 Apr 23, 10:23

I know (and use) both AltSearch and LibreOffice. :)
Tux. ; tuxproject.de ; Windows 8.1 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Tuxman
Platinum Member
Platinum Member
 
Posts: 1170
Joined: 2009 Aug 19, 07:49

Postby narayan » 2012 Apr 23, 10:39

That's good, because Steve (Kunkel) originally volunteered but is going to be unavailable for some months for personal reasons... :party:

I contacted Tom, the Czech author of AltSearch, about our needs.

He has modified AltSearch to extract bookmark links from a document. (AFAIK, he has not implemented extraction of headings so far.)

He sent a beta to me for testing, with instructions. But there may be some communication gaps, because I am not getting the results we expected.

We are supposed to give proper feedback to Tom so that he can make further changes to AltSearch, to make this work.

Can I share the mails from Tom with you? (If so, please send your email ID through a pm). Thanks!
narayan
Platinum Member
Platinum Member
 
Posts: 3479
Joined: 2002 Jun 04, 07:01

Postby Tuxman » 2012 Apr 23, 10:50

If you feel like it...
Tux. ; tuxproject.de ; Windows 8.1 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Tuxman
Platinum Member
Platinum Member
 
Posts: 1170
Joined: 2009 Aug 19, 07:49

Postby narayan » 2012 Apr 23, 10:50

Steve,

Our problem is reverse now: To avoid any crashes, I have already stripped all character attributes and now I am going to rely on styles alone.

(LO literature insists on that approach, but I had the old MSO habit of highlighting any text and hitting a shortcut like CTRL+U/I/B.)

So now the document does not have any character attributes like bold or underlined. On the contrary, I have to find the shortcuts and menu paths (using RegEx patterns), and then apply a distinctive character style.
narayan
Platinum Member
Platinum Member
 
Posts: 3479
Joined: 2002 Jun 04, 07:01

Postby Tuxman » 2012 Apr 23, 12:32

I'll look at your mail later, I'm at work now. But I received it. :)
Tux. ; tuxproject.de ; Windows 8.1 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Tuxman
Platinum Member
Platinum Member
 
Posts: 1170
Joined: 2009 Aug 19, 07:49


Return to xplorer² Professional

Who is online

Users browsing this forum: No registered users and 0 guests