dlang / ddox

Advanced D documentation engine
MIT License
63 stars 21 forks source link

Allow a custom postprocessor for FilterDocs #199

Open wilzbach opened 6 years ago

wilzbach commented 6 years ago

As we are rewriting the assert/writeln pipeline and avoid making a full copy of the entire directory, but do the rewrite before calling Ddoc, we needed to do the same for Ddox.

For now, https://github.com/dlang/dlang.org/pull/2069 does this, but still uses a lot of duplicated code from ddox.main.

The idea of this config object is to reduce the amount of duplication between dpl-docs and ddox.

s-ludwig commented 6 years ago

I feel like this should be part of GeneratorSettings instead. The filter command is meant to just remove unwanted parts of the documentation, not to alter it arbitrarily. It would of course also be nice to have a range based approach one day, but for now string based sounds fine.

wilzbach commented 6 years ago

I feel like this should be part of GeneratorSettings instead.

Ok. While I was at it, I added the ability to accept GeneratorSettings to the other commands too. Might come in handy to other people.

The filter command is meant to just remove unwanted parts of the documentation, not to alter it arbitrarily.

Yeah, I felt like a hack, but the filter already rewrites the comment and searching for the generated output of this felt hacky too :/

last_decl["comment"] ~= format("Example:\n%s$(DDOX_UNITTEST_HEADER %s)\n---\n%s\n---\n$(DDOX_UNITTEST_FOOTER %s)\n", comment.strip, name, source, name);

It would of course also be nice to have a range based approach one day, but for now string based sounds fine.

I had the same thoughts :/

wilzbach commented 6 years ago

@s-ludwig so anything missing from this?