Page 1 of 1

Confused about Content Rewriter

Posted: Fri Jan 14, 2005 9:57 pm
by VeinoM
So I'm confused how to use content rewriter... I don't understand the example given for the "Rewrite String"

Say everytime I have the word "test" always changed to "testing, one two" or something like that... (i don't want this, just a hypothetical situation) what would I put in each of the fields?

Thanks.

Re: Confused about Content Rewriter

Posted: Sat Jan 15, 2005 3:31 pm
by garvinhicking
Rewrite String: "{to}"
Rewrite Char: ""
New Title ({from}): "test"
New Description ({to}): "testing, one two"

So you can see, the "Rewrite String" can make use of {to} and {from} variables. The "New Title" value allows you to enter what is the source of your rewrite ({from}, "test"). The "New Description" value is the {to} variable and says what your wording shall be rewritten to ("testing, one two").

So you use the Rewrite String usually to add any special HTML markup using {from} and {to}.

Now, everytime Serendipity finds your word "test" it will save the word 'test' in the temporary variable {from}. It will then look up in which word it shall be transfered to and saves that in the variable {to}. Then it will look up your Rewrite String and replace "test" with the parsed contents of the Rewrint String. As this is set to "{to}" only, the {from} variable will completely vanish.

HTH,
Garvin

Posted: Sat Feb 04, 2006 5:40 pm
by lauterunfug
I made manually a new blog entry with the word 'test' in the text.
Then I went to the RewritePlugin and tried what you wrote:
Rewrite String: "{to}"
Rewrite Char: ""
New Title ({from}): "test"
New Description ({to}): "testing, one two"
But nothing happens. And I tried to use {ziel} instead of {to} because my blog is in german. But this does not work too...

What am I doing wrong???

Posted: Sat Feb 04, 2006 10:28 pm
by garvinhicking
The rewriter has problems if the words you want to translate are in between word boundaries. Try to enter "test test test test" into your blog entry?

It might also be that if you've enabled the entryproperties cache, that this is interfering?

Plus, you should try to avoid using the same {from} value in youer {to} string. So instead of "testing, one two" better use "experiment, one two" ;)

HTH,
Garvin

Posted: Sat Feb 04, 2006 10:51 pm
by lauterunfug
thanks for that. seems that it works now. but not 100%...
will do further experiments...
cu
tom

Posted: Sun Feb 19, 2006 10:19 am
by mbirth
Garvin, is it possible to change the plugin so that you don't have to add each search/replace-pair manually but enter them all into one big textarea?

Idea behind this: I migrated from MovableType and there I had this nice acronym-plugin which read all entries from a textfile. The textfile looked like this:

Code: Select all

FTP:File Transfer Protocol
FYI:For Your Information
GAU:Größter Anzunehmender Unfall (worst case scenario)
GB:Gigabyte (1 GB = 1024 MB)
GBA:Nintendo Gameboy Advance
GCC:GNU Compiler Collection
GCN:Nintendo GameCube
Maybe you could use another separator so that the versatility isn't harmed.

Cheers,
-mARKUS

P.S.: I'd do it myself, but since I don't have access to your SVN, it would be complicated to integrate the changes into the final S9Y. Also it's your plugin so I thought I might ask you first. ;-)

Posted: Mon Feb 20, 2006 12:18 pm
by garvinhicking
Hi!

It would be possible, yes. I would suggest adding a textarea as an alternative of entering the values.

The SVN is accessible publically, so you can get the latest sources easily and then create a patch file against SVN so that I can include your patch. I'd very much appreciate this, so have a go! :-)

Best regards,
Garvin