summaryrefslogtreecommitdiff
path: root/bk_text.c (follow)
Commit message (Collapse)AuthorAge
* Change plain text output formattingHEADmasterFranklin Wei2018-03-18
| | | | | | | Uses a # to mark section titles, and a >> to indicate code sections, which otherwise had no formatting to distinguish them from the rest of the text. This helps with the conversion of the puzzles help text to a format the sgt-puzzles rockbox port can use.
* Silence compiler warnings on OS X 10.9.Simon Tatham2014-03-30
| | | | [originally from svn r10166]
* Add \s for 'strong' text, i.e. bold rather than italics. I've missedSimon Tatham2013-03-10
| | | | | | | | | | | | | | this a couple of times in Halibut markup recently (in particular, it's handy to have a typographical distinction between 'this term is emphasised because it's new' and 'this term is emphasised because I want you to pay attention to it'), so here's an implementation, basically parallel to \e. One slight oddity is that strong text in headings will not be distinguished in some output formats, since they already use bolded text for their headings. [originally from svn r9772]
* Revamp of the Halibut error handling mechanism.Simon Tatham2012-08-29
| | | | | | | | | | | | | | | | I'm not quite sure why I ever thought it was a good idea to have a central variadic error() function taking an integer error code followed by some list of arguments that depend on that code. It now seems obvious to me that it's a much more sensible idea to have a separate function per error, so that we can check at compile time that the arguments to each error call are of the right number and type! So I've done that instead. A side effect is that the errors are no longer formatted into a fixed-size buffer before going to stderr, so I can remove all the %.200s precautions in the format strings. [originally from svn r9639]
* Now that you can specify negative indents in Halibut text mode, it'sSimon Tatham2012-05-04
| | | | | | | | | | possible to specify an indent which is _overall_ negative, i.e. intended to be off the left-hand side of the text file. There's no nice way to handle this, but printing O(2^32) spaces in a while (n--) loop is particularly bad. Fix the loop to read while (n-- > 0), so that at least it doesn't get _that_ badly confused. [originally from svn r9491]
* Allow a hastily selected subset of the output formats to also acceptSimon Tatham2009-10-24
| | | | | | | | | | | | | | | | | | | | "-" as a special file name meaning standard output. I've restricted it to just those output formats which can predictably output only one file, just for the sake of not having to faff too much with the others. Probably what I should have done for all of this would have been to write a set of wrappers around fopen, fclose and everything in between, and use them everywhere. Those wrappers would uniformly detect "-" and convert it into stdin or stdout as appropriate, would avoid fclosing those files for real when told to close them, and would also be able to handle reading a little bit of data from the start of a file and then pushing it all back even if the file were not seekable (which would allow input.c to lose the ugly special case whereby it can't currently read font files from standard input). [originally from svn r8729]
* Use of \lcont in the document preamble caused an assertion failure.Simon Tatham2009-01-20
| | | | | | Fix it. [originally from svn r8421]
* New option *-section-shownumber, alongside *-section-numeric and inSimon Tatham2008-02-25
| | | | | | | | | both the back ends which currently support that, to leave out chapter and section numbers totally in section headings. Can be useful for publishing man pages (which don't normally want section numbers) on the web. [originally from svn r7892]
* Sort out error handling everywhere a charset name is converted intoSimon Tatham2004-06-27
| | | | | | an integer charset ID. [originally from svn r4317]
* Switch the memory allocation macros from the Halibut onesSimon Tatham2004-06-12
| | | | | | | | | | | | | (mknew/mknewa/resize) to the PuTTY ones (snew/snewn/sresize). snewn and mknewa have their arguments opposite ways round; this may make the change initially painful but in the long term will free me of a nasty context switch every time I move between codebases. Also sresize takes an explicit type operand which is used to cast the return value from realloc, thus enforcing that it must be correct, and arranging that if anyone tries to compile Halibut with a C++ compiler there should be a lot less pain. [originally from svn r4276]
* Ahem; that only didn't cause a segfault by sheer luck.Simon Tatham2004-04-23
| | | | [originally from svn r4130]
* Enhance the text backend to support configurable quote characters,Simon Tatham2004-04-23
| | | | | | | | | | | configurable emphasis characters, various other configurable bits which have been marked FIXME in the code for a while, and also to warn when a code paragraph line is too long (because that was the only other thing labelled FIXME). Fallback options are implemented, and defaults set accordingly. A UTF-8 text output file now looks like proper UTF-8. [originally from svn r4128]
* bk_text and bk_info both need to know the on-screen width ofSimon Tatham2004-04-22
| | | | | | | | | | | | characters in order to wrap and align them properly. Therefore, they should be using wcwidth(). So here are a couple of wrappers on wcwidth(), one which filters out the Unicode characters not representable in the target charset, and one which converts _from_ a charset to Unicode before calling wcwidth(). bk_text and bk_info should now align correctly even in the face of unsupported characters and Japanese. [originally from svn r4116]
* Charset support for the info backend (\cfg{info-charset}). (ThisSimon Tatham2004-04-21
| | | | | | | checkin touches other files because a function in bk_text.c turned out to be of more general use so I moved it out into ustring.c.) [originally from svn r4111]
* Text backend is now charset-enabled: the entire text file is builtSimon Tatham2004-04-20
| | | | | | | from the ground up in Unicode, and a single charset conversion pass is done over the data as it's output. [originally from svn r4100]
* Infrastructure changes for character set support. ustrtoa,Simon Tatham2004-04-20
| | | | | | | | | | | ustrfroma, utoa_dup and ufroma_dup now take a charset parameter, and also have a variety of subtly distinct forms. Also, when a \cfg directive is seen in the input file, the precise octet strings for each parameter are kept in their original form as well as being translated into Unicode, so that when they represent filenames they can be used verbatim. [originally from svn r4097]
* Better robustness when backends encounter a Unicode character notSimon Tatham2004-04-19
| | | | | | representable in the output character set. [originally from svn r4094]
* Initial work on PS and PDF output. Because these two backends shareSimon Tatham2004-04-13
| | | | | | | | | | | | | | | | | | | an enormous amount of preprocessing and differ only in their final output form, I've introduced a new type of layer called a `pre-backend' (bk_paper.c is one). This takes all the information passed to a normal backend and returns an arbitrary void *, which is cached by the front end and passed on to any backend(s) which state a desire for the output of that particular pre-backend. Thus, all the page layout is done only once, and the PS and PDF backends process the same data structures into two output files. Note that these backends are _very_ unfinished; all sorts of vital things such as section numbers, list markers, and title formatting are missing, the paragraph justification doesn't quite work, and advanced stuff like indexes and PDF interactive features haven't even been started. But this basic framework generates valid output files and is a good starting point, so I'm checking it in. [originally from svn r4058]
* Arrange a mechanism whereby each backend can be passed a filenameSimon Tatham2004-04-01
| | | | | | | | | from its command-line option (`--text=foo.txt') and automatically convert it into one or more notional \cfg directives. In the HTML case this mechanism enables single-file mode as well as setting the filename. [originally from svn r4018]
* Add \cfg / -C directives to allow the user to choose the output fileSimon Tatham2004-04-01
| | | | | | name (or name schema, in HTML). [originally from svn r4017]
* Fix a couple of memory leaks in backends.Simon Tatham2004-04-01
| | | | [originally from svn r4016]
* Simplify treatment of the copyright notice, now I've also simplifiedSimon Tatham2004-03-30
| | | | | | | | | the preamble: \copyright paragraphs are now treated identically to normal paragraphs (so they appear precisely where they're put instead of in a fixed location), _except_ that the Windows Help backend also copies their text into the help file's copyright slot. [originally from svn r4001]
* Obsoleted the `\preamble' command. Preamble text is now taken to beSimon Tatham2004-03-25
| | | | | | | | | | any ordinary displayable paragraph(s) appearing before the first chapter heading, meaning in particular that you can put lists, code paragraphs etc in preambles. Of course, `\preamble' is still supported for backwards compatibility, but it's now a zero-effect paragraph marker. [originally from svn r3981]
* Add a \quote{...} directive, working like <blockquote> in HTML.Simon Tatham2004-03-25
| | | | [originally from svn r3978]
* Man-page back end for Halibut. Also, a couple of additional markupSimon Tatham2004-03-23
| | | | | | | | | features commonly used in man pages: (a) the ability to nest paragraph breaks, code paragraphs and other lists inside list items, and (b) description lists as normally used in man pages to describe command-line options. [originally from svn r3954]
* Of course, when I start freeing things in response to valgrind'sSimon Tatham2002-09-03
| | | | | | | | complaints, it would probably help if I arranged that those things had been _allocated_ in all cases, otherwise we merely exchange a memory leak for a core dump. Duh. [originally from svn r1916]
* Just had a play with this newfangled `valgrind' memory debuggerSimon Tatham2002-08-23
| | | | | | | thingy, which seems moderately cool and has reported a few very small memory leaks. Now apparently fixed. [originally from svn r1863]
* Add configurability for the suffix after the section number andSimon Tatham2002-08-12
| | | | | | before the section title (the ": " in "Section 1: Introduction"). [originally from svn r1838]
* Fix the bug in the text back end whereby bulletted paragraphs' widthSimon Tatham2002-08-11
| | | | | | failed to be decreased to compensate for the additional indent. [originally from svn r1834]
* Rename Buttress to Halibut. I _think_ I've caught everything in this pass.Simon Tatham2002-08-05
| | | | [originally from svn r1800]
* This update should bring the Windows Help back end up toSimon Tatham2001-12-04
| | | | | | | near-complete functionality. All that's missing now is indexing and horizontal rules. [originally from svn r1449]
* Improve handling of versionids - now every HTML file contains allSimon Tatham2001-11-25
| | | | | | | | | | | versionids. I thought it might be nice to include only the versionid(s) from the .but file(s) that gave rise to a particular chapter file, but actually this is very badly defined (that information is thrown away very early on in the front end) and in any case thanks to cross-references every file _does_ depend on its fellows. Better to put them all in throughout. [originally from svn r1417]
* Fixes to allow the text back end to wrap long headings. (These soundSimon Tatham2001-10-25
| | | | | | | like a typographical Bad Plan, but they work OK in some types of document such as a FAQ.) [originally from svn r1324]
* Initial checkin of xhtml backend.James Aylett2000-12-21
| | | | [originally from svn r828]
* First stab at text backend configurabilitySimon Tatham1999-11-07
| | | | [originally from svn r276]
* Added \q{...} for quoted textSimon Tatham1999-11-07
| | | | [originally from svn r274]
* Added \rule for a horizontal ruleSimon Tatham1999-10-22
| | | | [originally from svn r248]
* Introduce word types for attributed spaces, so backends can distinguishSimon Tatham1999-10-22
| | | | | | between emphasis _like_ _this_ and _like this_ [originally from svn r245]
* First backend! Text output now pretty much works.Simon Tatham1999-10-20
[originally from svn r240]