summaryrefslogtreecommitdiff
path: root/bk_html.c (follow)
Commit message (Collapse)AuthorAge
* Fix a segfault on bad input files.Simon Tatham2017-12-27
| | | | | | I ran into this as a knock-on effect from having misspelled a section name identifier (i.e. I had a \k{nonexistent-name} in my document). Before I fix the document, I should fix the segfault!
* Fix crash in CHM output if a document has no title.Simon Tatham2017-05-15
| | | | | | Naturally, after calling the previous commit '1.2', someone had to instantly find a bug that shows up in the simplest possible example Halibut invocation :-(
* New output mode to write CHM files directly.Simon Tatham2017-05-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I became aware a few months ago that enough is known about CHM files that free software _can_ write them without benefit of the MS HTML Help compiler - in particular there's a thing called 'chmcmd' in the Free Pascal Compiler software distribution which is more or less a drop-in replacement for hhc.exe itself. But although depending on chmcmd would be a bit nicer than depending on hhc.exe, Halibut has always preferred to do the whole job itself if it can. So here's my own from-scratch code to generate CHM directly from Halibut source. The new output mode is presented as a completely separate top-level thing independent of HTML mode. Of course, in reality, the two back ends share all of the HTML-generation code, differing only in a few configuration defaults and the minor detail of what will be _done_ with each chunk of HTML as it's generated (this is what the recent refactoring in b3db1cce3 was in aid of). But even so, the output modes are properly independent from a user-visible-behaviour perspective: they use parallel sets of config directives rather than sharing the same ones (you can set \cfg{html-foo} and \cfg{chm-foo} independently, for a great many values of 'foo'), and you can run either or neither or both as you choose in a given run of Halibut. The old HTML Help support, in the form of some config directives for HTML mode to output the auxiliary files needed by hhc.exe, is still around and should still work the same as it always did. I have no real intention of removing it, partly for the reasons stated in the manual (someone might find it useful to have Halibut generate the .HHP file once and then make manual adjustments to it, so that they can change styling options that the direct CHM output doesn't permit), and mostly because it wouldn't save a great deal of code or complexity in any case - the big two of the three auxiliary files (the HHC and HHK) have to be generated _anyway_ to go inside the .CHM, so all the code would have to stay around regardless.
* Reorganise prefix-independence in htmlconfig().Simon Tatham2017-05-13
| | | | | | | | No functional change, but this opens the way to have further sets of config directives that parallel the \cfg{html-foo} family but with different prefixes in place of 'html'. The previous code to treat prefixes 'html' and 'xhtml' the same was not general enough because it depended on the coincidence that the former is a suffix of the latter.
* Remove a spurious %s from the XHTML header.Simon Tatham2017-05-12
| | | | | | | | | I introduced this in commit b3db1cce3, which I hadn't really meant to push at all yet (it's groundwork for a new feature that's still in development), but which I had absentmindedly left lying around in my usual checkout directory when the time came to do 84ed4f994, and which got pushed as a side effect without having been quite fully tested yet. Ahem.
* Refactor so we can redirect HTML output to an internal buffer.Simon Tatham2017-05-02
|
* Make HTML Help files display a font-size change button on the toolbar.Simon Tatham2015-03-19
| | | | | | | | I had no idea that was a thing HTML Help could do at all, let alone that .chm files could enable or disable it via a flag! But Tino Reichardt sent in a patch which sets one extra bit in a flags word in the .hhp file, and despite 'chmspec' not mentioning that bit at all, it does indeed seem to do something useful.
* Remove an overzealous assertion in HTML href processing.Simon Tatham2014-12-16
| | | | | | Turns out we can get a null pointer passed through from the front end, if the input file was erroneous in some way, so we should do fallback processing if so (exactly what doesn't matter much) rather than crash.
* Permit tables of contents in HTML single-file mode.Simon Tatham2014-08-02
| | | | | | | | | | | | | | | | Patch due to J. Lewis Muir, who points out that the HTML backend's current policy of _always_ disabling the TOC in single-file mode is excessively harsh: in a long or formal enough document, you might still want a TOC to make navigating around within the file easier, even if it's not necessary to use it to get between multiple files. So this change removes the unconditional prohibition against TOCs in single-file documents, but they're still disabled by default, because a single file counts as a leaf file and the existing default settings disable TOCs in leaf files anyway. So if you do want a TOC in a single file, you can reconfigure 'html-leaf-contains-contents' to true. [originally from svn r10212]
* 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]
* Escape &<> when they appear in href text.Simon Tatham2009-11-10
| | | | [originally from svn r8743]
* 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]
* Fix cut'n'paste error which had the effect of making the default forJacob Nevins2008-03-19
| | | | | | \cfg{html-section-shownumber}{n} undefined. [originally from svn r7929]
* 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]
* Add an `Up' link to the HTML navigation bar of sufficiently deep documents.Jacob Nevins2007-01-31
| | | | | | | | (This doesn't affect any of the source texts I know about.) Also add <link rel="up">, even in the cases where it's just the same as <link rel="ToC">. (This does.) [originally from svn r7193]
* I haven't found any browsers that do anything disgusting withJacob Nevins2007-01-31
| | | | | | | \cfg{html-rellinks}, and it generally seems to be a Good Thing, so I've turned it on by default. (The lurkers support me in u2u.) [originally from svn r7188]
* Minimal support for <LINK REL="next"> etc machine-readable navigation links.Jacob Nevins2007-01-28
| | | | | | | | | | | | | Off by default for now, but I don't intend that it should stay this way; they seem useful and harmless. I just want to check a few more browsers to ensure they don't do anything obnoxious with them. So far I've only seen lynx and links do something with them (provide toolbars). iCab and some Mozilla derivatives/extensions are also alleged to do this; Opera is said to allow PgDn type browsing through the entire set of pages; and Mozilla is rumoured to use the "next" link for prefetching. [originally from svn r7177]
* Tweak the HTML Help output to enable Previous/Next navigation in the generatedJacob Nevins2007-01-28
| | | | | | | | | | | | | | | | CHM, and added the toolbar buttons for this. Also rationalised the other options a bit: - added Forward button (since we have Back); - removed Locate/Sync (since we have auto-sync enabled for the ToC); - removed Stop and Refresh (mostly a waste of space for help, but still available from the Options menu if users really want them); - enabled advanced facilities on the Search tab (search within results, etc). All this seems to have had no obvious ill effects (tested on Win98), although the resulting CHM file is slightly bigger (~3kbyte, <1%). [originally from svn r7176]
* These HHP window dimensions seem to be rubbish. Better off withoutSimon Tatham2006-12-12
| | | | | | any, I reckon. [originally from svn r6994]
* Support for the MS HTML Help system in the HTML back end. As yet ISimon Tatham2006-12-11
| | | | | | | | don't know how to write out a .CHM directly, but I am at least able to have the HTML back end write out the three auxiliary files which enable a .CHM to be generated using the MS HTML Help compiler. [originally from svn r6991]
* Introduce global (cross-backend) \cfg{contents} and \cfg{index}Simon Tatham2006-06-02
| | | | | | | commands, allowing the fixed words "Contents" and "Index" generated in various output formats to be reconfigured into other languages. [originally from svn r6724]
* Missing error handling: the HTML and WinHelp back ends would bothSimon Tatham2006-05-18
| | | | | | segfault if they were unable to open their output files. [originally from svn r6704]
* Also, while I'm wandering past here, I've just noticed thatSimon Tatham2005-03-10
| | | | | | | `anonfrag' should be a char[] rather than a char *, or else lenof() will give the wrong answer. [originally from svn r5477]
* Explicitly constify a bunch of static data declarations which wereSimon Tatham2005-03-10
| | | | | | | | | conceptually const but not declared as such. Halibut is now back to the practically-speaking-pointless but rather satisfying status of having no global writable data whatsoever :-) [originally from svn r5476] [this svn revision also touched charset,filter,timber]
* Ability to specify multiple arguments to \cfg{html-template-fragment};Jacob Nevins2005-03-08
| | | | | | | | | | | | | | | Halibut will output fragment names in all specified formats. (I forget now precisely why I thought this was necessary, but it seems potentially useful.) Also ensure that legal fragment names are generated even if none of the characters from the original turn out to be legal (e.g., %k with an entirely numeric keyword), and correct an untruth I inserted in the documentation of this. (This commit hits more than just the HTML backend as I've generalised an error message, and fixed a fault in the info backend's error handling while there.) [originally from svn r5457]
* In contents lists, put <ul> inside <li> to make validator.w3.org happier (forJacob Nevins2005-03-07
| | | | | | | | | all HTML flavours). Also add newlines to the contents output so that the source is vaguely legible. Couple of extra comments in the code. [originally from svn r5453]
* Formatting fix if no indexJacob Nevins2005-02-18
| | | | [originally from svn r5350]
* Comment in template codeJacob Nevins2005-02-18
| | | | [originally from svn r5348]
* Replace crash with assertion failure if we attempt to xref a non-existentJacob Nevins2005-02-17
| | | | | | name. [originally from svn r5336]
* Shouldn't consider para_Title to be a heading when going throughSimon Tatham2005-01-24
| | | | | | sections looking for local configuration data. [originally from svn r5196]
* Added a new config directive `html-local-head', which permits me toSimon Tatham2005-01-24
| | | | | | put an AppleTitle tag in only one of a set of output HTML files. [originally from svn r5192]
* Fix for an uninitialised structure member spotted by valgrind (probably didn'tJacob Nevins2004-08-04
| | | | | | have any real effect). [originally from svn r4401]
* Avoid generating an index section if there actually is no index.Simon Tatham2004-07-02
| | | | [originally from svn r4321]
* Sort out error handling everywhere a charset name is converted intoSimon Tatham2004-06-27
| | | | | | an integer charset ID. [originally from svn r4317]
* Free up all the data we allocated during the HTML backend.Simon Tatham2004-06-27
| | | | [originally from svn r4316]
* Support non-breaking spaces.Simon Tatham2004-06-27
| | | | [originally from svn r4315]
* Config directives for all the extra configurable things in the newSimon Tatham2004-06-27
| | | | | | HTML backend. [originally from svn r4314]
* Fix up the restrict_charset and output_charset configuration for theSimon Tatham2004-06-27
| | | | | | | | | | | | | | HTML backend. After an argument with James in which it transpired that we each thought it was absolutely obvious which one \cfg{html-charset} ought to map to, and each of us was thinking of a different one, I've decided that this implies it _isn't_ obvious, and hence there is no single \cfg{html-charset} directive at all. Instead, we have \cfg{html-restrict-charset} and \cfg{html-output- charset}, and any naive user who `just wants to change character set' is just going to have to RTFM and figure out which one they mean. [originally from svn r4313]
* Various HTML backend cleanups.Simon Tatham2004-06-20
| | | | [originally from svn r4308]
* Introduce a configurable option to select the HTML flavour. AlsoSimon Tatham2004-06-20
| | | | | | | fiddle with various small aspects of the output so that it actually validates in all supported flavours. [originally from svn r4307]
* Improve the naming of fragment IDs for numbered list elements andSimon Tatham2004-06-20
| | | | | | bibliography entries. [originally from svn r4305]
* Add a batch of assertions to ensure no more index terms fail to haveSimon Tatham2004-06-19
| | | | | | | | | their anchors generated. Index bugs of this type can be terribly subtle and go unnoticed for ages; I'm lucky Jacob spotted the first one of the type, but I'm now going to be careful to avoid any further ones. [originally from svn r4293]
* I had somehow managed to leave index entry anchors out of sectionSimon Tatham2004-06-19
| | | | | | titles. Ahem. [originally from svn r4292]
* Add a clash-checking mechanism to ensure we never generate the sameSimon Tatham2004-06-19
| | | | | | fragment name twice for any reason. [originally from svn r4291]
* 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]
* Initial checkin of the shiny new rewritten-from-scratch HTML backSimon Tatham2004-06-12
end. There's a lot more _potentiality_ for new features than there are actual new features just yet, but future highlights include: configurable flavour of HTML (3.2, 4, XHTML Transitional or Strict), proper character set support (this is half way there already), and more flexible allocation of sections between multiple HTML files. Meanwhile, immediate benefits include correct handling of special characters within `author' and `description' strings, omission of the filename part in hyperlinks within the same HTML file (in particular, this means a single output file is now totally independent of its filename), and hyperlinks to the index from the top-level contents page (I'm amazed nobody has complained at the lack of this yet!). There are no doubt some shiny new bugs as well, but I'll never find them unless people start using the thing... [originally from svn r4275]