Hi,
I need to add a topic-variable to each topic in a project with the contents of the <title>.
The variable is used multiple times within the topic for figure and image labels.
Previously the text was just entered as-is, but that is a pain when translating and is also not necessary.
I cannot use the topic-title variable as other projects link to this project and thus the topic-title of the linked project would overwrite the labels in the linked project.
Adding a variable to multiple topics can't be done from within HnM -- there is another topic in the forum mentioning regex for adding variables with static contents.
Does anyone have any other solutions for this sort of thing?
I have a little PowerShell script which works, but it borks the whitespace in the xml and makes a few other unwelcome formatting changes.
Add a variable to every topic
Moderators: Alexander Halser, Tim Green
- Tim Green
- Site Admin
- Posts: 23184
- Joined: Mon Jun 24, 2002 9:11 am
- Location: Bruehl, Germany
- Contact:
Re: Add a variable to every topic
If you want to add anything to the content of lots of topics, use Notepad++ directly on the topic XML files. It won't mess with anything else in the file or change things like encoding or whitespace or line endings without you actually wanting to do it, as Microsoft tends to do.
If you want an even better solution, get the Regex Buddy and PowerGREP combo from JG Software. Regex Buddy helps you to build and test Regexes before using them and is also the best course in Regex you can find anywhere. PowerGREP is the best multi-file search and replace tool anywhere, on any platform, at any price. It may seem a little pricey, but if you do things like this even more than once you will feel that it has already paid for itself in a single afternoon.
If you want an even better solution, get the Regex Buddy and PowerGREP combo from JG Software. Regex Buddy helps you to build and test Regexes before using them and is also the best course in Regex you can find anywhere. PowerGREP is the best multi-file search and replace tool anywhere, on any platform, at any price. It may seem a little pricey, but if you do things like this even more than once you will feel that it has already paid for itself in a single afternoon.
Regards,
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
-
- Posts: 305
- Joined: Mon Aug 21, 2017 7:35 pm
Re: Add a variable to every topic
Hi Tim,
I actually used Notepad++ to insert the topic-variable in each topic with a regular expression.
And after a little playing around, it is now as desired
I actually used Notepad++ to insert the topic-variable in each topic with a regular expression.
And after a little playing around, it is now as desired