473,809 Members | 2,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Html tag removing but keeping <a href tag

7 New Member
By using Formatter.pm in perl we can remove all html tags. But I want to keep tag <a href and remove all other tags. Can any body help me to change Formatter.pm file to do this task.

Expand|Select|Wrap|Line Numbers
  1. sub a_start
  2. {
  3.     #shift->{anchor}++;
  4.     #1;
  5. }
  6.  
  7. sub a_end
  8. {
  9.     #shift->{anchor}--;
  10. }
Feb 6 '08 #1
3 2260
numberwhun
3,509 Recognized Expert Moderator Specialist
By using Formatter.pm in perl we can remove all html tags. But I want to keep tag <a href and remove all other tags. Can any body help me to change Formatter.pm file to do this task.

Expand|Select|Wrap|Line Numbers
  1. sub a_start
  2. {
  3.     #shift->{anchor}++;
  4.     #1;
  5. }
  6.  
  7. sub a_end
  8. {
  9.     #shift->{anchor}--;
  10. }
Just out of curiosity, is this a module that you or someone else you know, wrote? The only "Formatter" module I see is for report generation via a DBI query. There is nothing about HTML in it. If it is a specific module from CPAN, which one is it?

If it is your own, home grown module, then we don't have any clue what the code looks like or does.

Regards,

Jeff
Feb 6 '08 #2
alimsdb
7 New Member
Just out of curiosity, is this a module that you or someone else you know, wrote? The only "Formatter" module I see is for report generation via a DBI query. There is nothing about HTML in it. If it is a specific module from CPAN, which one is it?

If it is your own, home grown module, then we don't have any clue what the code looks like or does.

Regards,

Jeff
I have writtern all detail about this module i n your private messages box. It is actually CPAN module and also used for removing or some partially removing html tags from html file. Waiting for your response.
Regards

ALI
Feb 8 '08 #3
alimsdb
7 New Member
Title : yes it is CPAN Module Version: 2.04
--------------------------------------------------------------------------------
http://search.cpan.org/~sburke/HTML-...L/Formatter.pm

Aforementioned is the link of the CPAN formatter.pm file. When we use Formatter.pm and FormatText.pm files it removes all the Html tags present in Html file. What I want is to remove all the tags but keeping the tags which starts with <a href .

So following is a part of that formatter.pm file code we have to change to keep <a href tags by leaving all the code in Formatter.pm file as it is.
Expand|Select|Wrap|Line Numbers
  1. sub a_start
  2. {
  3.     shift->{anchor}++;
  4.     1;
  5. }
  6.  
  7. sub a_end
  8. {
  9.     shift->{anchor}--;
  10. }
  11.  
I have tried to change it but I am not good in writing code in perl so I cant do so.

Because you are expert and I am sure you can do it in very short time. This is why I need your help.

If you still have any question related to it please email me XXXXXXXXXX
I am waiting for you warm response.
Feb 8 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3893
by: Gregor Horvath | last post by:
Hi, Before I reinvent the wheel I`d like to ask if someone has done this before since I did not find an advice at Google. The goal is to create a dynamic Tree View in HTML. Say I have a data strucure like this: structList =
2
10572
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
2
2701
by: Raja Kannan | last post by:
Is there a way to remove text portion from the HTML keeping the HTML Tags using the browser, say javascript RegEx or something ? I have seen lot of examples removing HTML tags to get the text but how the reverse of it ? any sample code or any suggestion would be appreciated.
2
2456
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the XML file will get their row content from there. The rows may look some thing similar to this: - Added <a>mailing list</a> functionality to <a>homepage</a> - Competition winners announced, click <a>here</a>
6
5527
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp; DataBinder.Eval(Container.DataItem,"StoreEmail") &amp; "&amp;Subject=" &amp; DataBinder.Eval(Container.DataItem,"ProductName") ....
7
5103
by: mark | last post by:
Hi All, Apologies for the newbie question but I've searched and tried all sorts for a few days and I'm pulling my hair out ; Please feel free to teach me to suck eggs because it's all new to me :) Thanks in advance, Mark.
1
2253
by: John | last post by:
Hi var poster="<html><head..... etc .... </html>"; var animal='dog'; The string contains images and text that changes. Originally I wanted to do something like print "<a href=" + poster + ">Choose Poster of a " + animal + "</a>";
26
25621
by: webrod | last post by:
Hi, I have some php pages with a lot of HTML code. I am looking for a HTML validator tool (like TIDY). TIDY is not good enough with PHP tags (it removes a lot of php code). Do you have any idea? Thanks you very much
3
3593
by: Jason7899 | last post by:
Hello Everyone, I have been searching tirelessly and cannot find a way to convert this text into html text= &amp;lt;p&amp;gt;LONDRES (Reuters) - Cientistas descobriram tr&amp;ecirc;s importantes elos gen&amp;eacute;ticos ligados ao mal de Alzheimer que afetam at&amp;eacute; 20% dos pacientes da doen&amp;ccedil;a e disseram neste domingo que foi a mais importante revela&amp;ccedil;&amp;atilde;o na &amp;aacute;rea nos &amp;uacute;ltimos 15 anos ...&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&amp;lt;a...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10637
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10379
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.