From: Karim Mohammadi <s.karim.mohammadi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Writing custom filter in python to remove non-breaking spaces
Date: Wed, 2 Aug 2017 21:55:35 -0700 (PDT) [thread overview]
Message-ID: <cc13bbea-06e5-422b-bcdd-cd9ba1c4cf95@googlegroups.com> (raw)
In-Reply-To: <20170802140916.GF38349-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 2910 bytes --]
Thanks but i'm on windows.
Can you guide me about making the desired custom filter?
On Wednesday, August 2, 2017 at 6:39:32 PM UTC+4:30, John MacFarlane wrote:
>
> Probably easier just to preprocess:
>
> sed e 's/ / /g' input.html | pandoc -f html -t latex
>
> +++ Karim Mohammadi [Aug 02 17 02:05 ]:
> > Hi. I want to convert html file file1.html to file1.tex. The html file
> > contains .
> > How can i write an python script as a filter to remove non-breaking
> > space ( )?
> > This is my code:
> > #!/usr/bin/env python
> >
> > """
> > Pandoc filter to removing string from the text
> > """
> >
> > from pandocfilters import toJSONFilter, Para
> >
> > def debug(content):
> > file = open('debug.txt', 'w')
> > for item in content:
> > file.write("%s\n" % item)
> >
> > def nbsp(key, value, format, meta):
> > uniString = unicode(value, "UTF-8")
> > uniString = value.replace(" ", " ")
> >
> > return uniString
> >
> > if __name__ == "__main__":
> > toJSONFilter(nbsp)
> > but calling command:
> > pandoc file1.html --filter ./nbsp.py -o file1.tex
> > give me some errors.
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
> > To post to this group, send email to
> > [2]pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
> > To view this discussion on the web visit
> > [3]
> https://groups.google.com/d/msgid/pandoc-discuss/3be5ee09-90dc-41ad-
> > a368-9298b965dfaa%40googlegroups.com.
> > For more options, visit [4]https://groups.google.com/d/optout.
> >
> >References
> >
> > 1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>
> > 2. mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>
> > 3.
> https://groups.google.com/d/msgid/pandoc-discuss/3be5ee09-90dc-41ad-a368-9298b965dfaa-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
> > 4. https://groups.google.com/d/optout
>
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/cc13bbea-06e5-422b-bcdd-cd9ba1c4cf95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 6535 bytes --]
next prev parent reply other threads:[~2017-08-03 4:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 9:05 Karim Mohammadi
[not found] ` <3be5ee09-90dc-41ad-a368-9298b965dfaa-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-08-02 14:09 ` John MacFarlane
[not found] ` <20170802140916.GF38349-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org>
2017-08-03 4:55 ` Karim Mohammadi [this message]
[not found] ` <cc13bbea-06e5-422b-bcdd-cd9ba1c4cf95-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-08-03 6:11 ` Andrew Dunning
2017-08-03 22:29 ` Kolen Cheung
[not found] ` <f0bb6fae-6104-4efc-840d-34fd19b02840-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-08-04 18:58 ` Melroch
[not found] ` <CADAJKhBEZ8-BdJTQRJE4M2nettrGKhf1xYzqBYs=pe=_DAodpA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-04 22:03 ` Kolen Cheung
2017-08-04 22:09 ` Kolen Cheung
[not found] ` <4abb2571-34b8-4e49-a189-05632083aab9-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-08-05 8:45 ` Melroch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc13bbea-06e5-422b-bcdd-cd9ba1c4cf95@googlegroups.com \
--to=s.karim.mohammadi-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).