summaryrefslogtreecommitdiff
path: root/bk_text.c (unfollow)
Commit message (Collapse)Author
2018-03-18Change plain text output formattingHEADmasterFranklin Wei
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.
2014-03-30Silence compiler warnings on OS X 10.9.Simon Tatham
[originally from svn r10166]
2013-03-10Add \s for 'strong' text, i.e. bold rather than italics. I've missedSimon Tatham
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]
2012-08-29Revamp of the Halibut error handling mechanism.Simon Tatham
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]
2012-05-04Now that you can specify negative indents in Halibut text mode, it'sSimon Tatham
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]
2009-10-24Allow a hastily selected subset of the output formats to also acceptSimon Tatham
"-" 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]
2009-01-20Use of \lcont in the document preamble caused an assertion failure.Simon Tatham
Fix it. [originally from svn r8421]
2008-02-25New option *-section-shownumber, alongside *-section-numeric and inSimon Tatham
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]
2004-06-27Sort out error handling everywhere a charset name is converted intoSimon Tatham
an integer charset ID. [originally from svn r4317]
2004-06-12Switch the memory allocation macros from the Halibut onesSimon Tatham
(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]
2004-04-23Ahem; that only didn't cause a segfault by sheer luck.Simon Tatham
[originally from svn r4130]
2004-04-23Enhance the text backend to support configurable quote characters,Simon Tatham
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]
2004-04-22bk_text and bk_info both need to know the on-screen width ofSimon Tatham
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]
2004-04-21Charset support for the info backend (\cfg{info-charset}). (ThisSimon Tatham
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]
2004-04-20Text backend is now charset-enabled: the entire text file is builtSimon Tatham
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]
2004-04-20Infrastructure changes for character set support. ustrtoa,Simon Tatham
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]
2004-04-19Better robustness when backends encounter a Unicode character notSimon Tatham
representable in the output character set. [originally from svn r4094]
2004-04-13Initial work on PS and PDF output. Because these two backends shareSimon Tatham
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]
2004-04-01Arrange a mechanism whereby each backend can be passed a filenameSimon Tatham
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]
2004-04-01Add \cfg / -C directives to allow the user to choose the output fileSimon Tatham
name (or name schema, in HTML). [originally from svn r4017]
2004-04-01Fix a couple of memory leaks in backends.Simon Tatham
[originally from svn r4016]
2004-03-30Simplify treatment of the copyright notice, now I've also simplifiedSimon Tatham
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]
2004-03-25Obsoleted the `\preamble' command. Preamble text is now taken to beSimon Tatham
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]
2004-03-25Add a \quote{...} directive, working like <blockquote> in HTML.Simon Tatham
[originally from svn r3978]
2004-03-23Man-page back end for Halibut. Also, a couple of additional markupSimon Tatham
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]
2002-09-03Of course, when I start freeing things in response to valgrind'sSimon Tatham
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]
2002-08-23Just had a play with this newfangled `valgrind' memory debuggerSimon Tatham
thingy, which seems moderately cool and has reported a few very small memory leaks. Now apparently fixed. [originally from svn r1863]
2002-08-12Add configurability for the suffix after the section number andSimon Tatham
before the section title (the ": " in "Section 1: Introduction"). [originally from svn r1838]
2002-08-11Fix the bug in the text back end whereby bulletted paragraphs' widthSimon Tatham
failed to be decreased to compensate for the additional indent. [originally from svn r1834]
2002-08-05Rename Buttress to Halibut. I _think_ I've caught everything in this pass.Simon Tatham
[originally from svn r1800]
2001-12-04This update should bring the Windows Help back end up toSimon Tatham
near-complete functionality. All that's missing now is indexing and horizontal rules. [originally from svn r1449]
2001-11-25Improve handling of versionids - now every HTML file contains allSimon Tatham
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]
2001-10-25Fixes to allow the text back end to wrap long headings. (These soundSimon Tatham
like a typographical Bad Plan, but they work OK in some types of document such as a FAQ.) [originally from svn r1324]
2000-12-21Initial checkin of xhtml backend.James Aylett
[originally from svn r828]
1999-11-07First stab at text backend configurabilitySimon Tatham
[originally from svn r276]
1999-11-07Added \q{...} for quoted textSimon Tatham
[originally from svn r274]
1999-10-22Added \rule for a horizontal ruleSimon Tatham
[originally from svn r248]
1999-10-22Introduce word types for attributed spaces, so backends can distinguishSimon Tatham
between emphasis _like_ _this_ and _like this_ [originally from svn r245]
1999-10-20First backend! Text output now pretty much works.Simon Tatham
[originally from svn r240]