Commit graph

43 commits

Author SHA1 Message Date
John MacFarlane
d1e78d96b6 UTF8: export fromText, fromTextLazy. 2017-06-10 16:05:56 +02:00
John MacFarlane
c691b97506 UTF8: export toText, toTextLazy.
Define toString, toStringLazy in terms of them.
2017-06-10 15:54:35 +02:00
Stefan Dresselhaus
6b8240fc2f Add --eol flag and writer option to control line endings.
* Add `--eol=crlf|lf` CLI option.
* Add `optEol` to `WriterOptions` [API change]
* In `Text.Pandoc.UTF8`, add new functions parameterized on `Newline`:
  `writeFileWith`, `putStrWith`, `putStrLnWith`, `hPutStrWith`,
  `hPutStrLnWith`. [API change]
* Document option in MANUAL.txt.

Closes #3663.
Closes #2097.
2017-05-18 11:55:45 +02:00
Albert Krewinkel
965f1ddd4a
Update dates in copyright notices
This follows the suggestions given by the FSF for GPL licensed software.
<https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-05-13 23:30:13 +02:00
John MacFarlane
e256c8ce17 Stylish-haskell automatic formatting changes. 2017-03-04 13:03:41 +01:00
Jesse Rosenthal
c613dbde01 Remove unnecessary CPP condition in UTF8
Base 4.4 is ghc 7.2, so we don't have to worry about getting a lower version.
2016-09-02 09:18:09 -04:00
John MacFarlane
499985c1a3 Updated copyright dates to include 2016. 2016-03-22 17:20:39 -07:00
John MacFarlane
d19a347fd5 UTF8: Better handling of bare CRs in input files.
Previously we just stripped them out; now we convert
other line ending styles to LF line endings.

Closes #2132.
2015-05-05 12:42:50 -07:00
John MacFarlane
1868cb5e42 Updated copyright notices to -2015. Closes #2111. 2015-04-26 10:18:29 -07:00
John MacFarlane
22ab3367c6 Removed unneeded CPP. 2014-08-12 22:50:51 -07:00
John MacFarlane
8d04c821aa Avoid import Prelude hiding (catch).
See #1309.
2014-05-19 09:45:00 -07:00
Albert Krewinkel
8fdbef841d Update copyright notices for 2014, add missing notices 2014-05-09 00:46:08 +02:00
John MacFarlane
2d6e0b1530 Remove CPP from default-extensions; add pragmas to modules as needed. 2013-08-04 14:12:13 -07:00
John MacFarlane
aab4c47da5 Text.Pandoc.UTF8: Use strict bytestrings in reading.
The use of lazy bytestrings seemed to cause problems using
pandoc on Windows 7/8 64-bit machines.

Closes #874.
2013-07-04 15:43:42 -07:00
John MacFarlane
7998587810 Added CPP directives to avoid warnings.
For 'import Prelude hiding (catch)'.  catch is no longer in
Prelude starting with base 4.6.
2013-05-29 20:21:32 -07:00
John MacFarlane
3465ba2f61 UTF8: Strip off BOM if present.
Closes #743.
2013-02-08 09:45:25 -08:00
John MacFarlane
c7f4333f83 UTF8 module: Remove \r when reading.
This should prevent problems with extra CRs on windows.
2013-01-06 16:35:59 -08:00
John MacFarlane
c416ff98bc UTF8: Removed unneeded imports. 2012-09-29 09:56:47 -04:00
John MacFarlane
c80ffe9171 UTF8: Better error message for invalid UTF8.
Read bytestring and use Text's decodeUtf8 instead of using System.IO's
hGetContents.  This way you get a message saying "invalid UTF-8 stream"
instead of "invalid byte sequence."  You are also told which byte caused
the problem.
2012-09-26 09:04:21 -07:00
John MacFarlane
6ad7ac1239 Removed need for utf8-string package.
* Depend on text.
* Expose Text.Pandoc.UTF8.
* Text.Pandoc.UTF8 now exports toString, fromString,
  toStringLazy, fromStringLazy.
* These are used instead of the old utf8-string functions.
2012-09-25 19:54:21 -07:00
John MacFarlane
833977416f UTF8: use universalNewlineMode in reading.
This treats both '\r\n' and '\n' as '\n' on input, no matter
what platform we're running on.
2012-09-25 14:55:12 -07:00
John MacFarlane
12045d84b6 Revert "More intelligent handling of text encodings."
This reverts commit 7272735b3d.
2012-09-23 22:53:34 -07:00
John MacFarlane
7272735b3d More intelligent handling of text encodings.
Previously, UTF-8 was enforced for both input and output.

The new system:

* For input, UTF-8 is tried first; if an error is raised, the
  locale encoding is tried.
* For output, the locale encoding is always used.
2012-09-23 22:12:21 -07:00
John MacFarlane
31107741f0 Removed unneeded CPP conditional.
Removed code that was conditional on base < 4.2, since
now we require base >= 4.2.
2012-09-23 21:43:11 -07:00
John MacFarlane
4d65063592 UTF8: Export decodeArg. 2012-09-23 11:01:09 -07:00
John MacFarlane
51178dda97 Export encodePath/decodePath from UTF8.
Removed duplicate code in src/pandoc.hs.
2012-09-23 10:43:03 -07:00
John MacFarlane
6d7f0a1b81 Fixed whitespace errors. 2012-07-26 22:32:53 -07:00
John MacFarlane
4cf3aaecde Test for base 4.4.0 instead of 4.5.0 for argument/filename encoding. 2012-06-25 14:27:22 -07:00
John MacFarlane
cc39c313c5 Don't encode/decode file paths if base >= 4.5.
Prior to base 4.5 (and perhaps earlier - check), filepaths and command
line arguments were treated as unencoded lists of bytes, not unicode
strings, so we had to work around that by encoding and decoding
them.  This commit adds CPP checks for base 4.5 that disable the
encoding/decoding.

Fixes a bug with multilingual filenames when pandoc was compiled
with ghc 7.4. Closes #540.
2012-06-24 10:58:15 +02:00
John MacFarlane
37fa6df612 UTF8: Encode filenames.
(This is still needed, even with recent base.)

Partially resolves Issue #286 (though now there is a
new markdown2pdf problem).
2011-02-11 18:55:14 -08:00
John MacFarlane
cf0a843239 UTF8: Use #if instead of #ifdef. 2011-01-30 17:01:50 -08:00
John MacFarlane
b1b6d0f859 UTF8 module: Use base 4.2 IO if available.
This gives us proper line endings on windows, and some speed
improvements.

We fall back to the old functions if base < 4.2.

hGetContents is now exported.
2011-01-30 16:01:31 -08:00
John MacFarlane
ca5217881d Encode filenames as UTF8.
Resolves Issue #252 (pandoc doesn't properly handle unicode filenames).
2010-09-10 19:53:45 -07:00
John MacFarlane
4c88ecaeca Changed to using strict bytestrings in UTF8 module.
This avoids a problem on Windows reading from stdin.
Previously we'd get an error from hGetBufNonBlocking.
2010-07-21 15:14:20 -07:00
John MacFarlane
7d20ffe3e0 UTF8: Modified readFile and getContents to strip BOM if present. 2010-05-06 23:04:44 -07:00
John MacFarlane
7be82b4536 Added Text.Pandoc.UTF8 for portable UTF8 string IO. 2010-05-06 20:27:10 -07:00
fiddlosopher
9a67a486c2 Moved everything from src into the top-level directory.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1104 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-29 02:02:34 +00:00
fiddlosopher
fe684764e6 Reverted back to state as of r1062. The template haskell changes
are more trouble than they're worth.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@1064 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-03 23:27:58 +00:00
fiddlosopher
4a841bfc54 Use template haskell to avoid the need for templates:
+ Added library Text.Pandoc.Include, with a template haskell
  function $(includeStrFrom fname) to include a file as a string
  constant at compile time.
+ This removes the need for the 'templates' directory or Makefile
  target.  These have been removed.
+ The base source directory has been changed from src to .
+ A new 'data' directory has been added, containing the ASCIIMathML.js
  script, writer headers, and S5 files.
+ The src/wrappers directory has been moved to 'wrappers'.
+ The Text.Pandoc.ASCIIMathML library is no longer needed, since
  Text.Pandoc.Writers.HTML can use includeStrFrom to include the
  ASCIIMathML.js code directly.  It has been removed.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@1063 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-03 22:14:03 +00:00
fiddlosopher
65a5db2d41 Modified fromUTF8 to strip out the BOM (byte order marker)
wherever it is present.  See
http://en.wikipedia.org/wiki/Byte_Order_Mark and
http://six.pairlist.net/pipermail/markdown-discuss/2007-October/000874.html.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@1054 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-10-27 22:55:40 +00:00
fiddlosopher
30375bb847 Changed encodeUTF8 to toUTF8, decodeUTF8 to fromUTF8,
for clarity.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@692 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-07-13 06:34:33 +00:00
fiddlosopher
dc9c6450f3 + Added module data for haddock.
+ Reformatted code consistently.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@252 788f1e2b-df1e-0410-8736-df70ead52e1b
2006-12-20 06:50:14 +00:00
fiddlosopher
df7b682251 initial import
git-svn-id: https://pandoc.googlecode.com/svn/trunk@2 788f1e2b-df1e-0410-8736-df70ead52e1b
2006-10-17 14:22:29 +00:00