<div dir="ltr"><div dir="ltr">On Sat, Nov 6, 2021 at 10:34 AM Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com">patrick.sanan@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Fr., 5. Nov. 2021 um 19:18 Uhr schrieb Lawrence Mitchell <<a href="mailto:wence@gmx.li" target="_blank">wence@gmx.li</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
> On 5 Nov 2021, at 15:25, Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com" target="_blank">patrick.sanan@gmail.com</a>> wrote:<br>
> <br>
> Good question. We don't have any that start at specific line numbers, currently, as it is indeed too brittle - I suspect I removed some that were there at one point.  <br>
> <br>
> The inclusions essentially all use :start-at: to specify a line to match. Ideally you'd also use :end-at: to specify where to stop, but some short snippets do instead specify a number of lines. Note that a practically handy option is :append:, as in this example where you are trying to excerpt the function PetscError(), and you can match on the PetscFunctionReturn(0) and then re-add the closing brace.<br>
> <br>
> .. literalinclude::/../src/sys/error/err.c<br>
> :start-at: PetscErrorCode PetscError(<br>
> :end-at: PetscFunctionReturn(0)<br>
> :append: }<br>
<br>
FWIW, this feels a bit like trying to reinvent WEB.<br></blockquote><div>I don't know what WEB is, but if you're saying that this is kinda clunky, yes it definitely is - my only contention is that it's better than copy-pasting code and output.  I'm not sure if there's an easier and/or better way with Sphinx.<br></div></div></div></blockquote><div><br></div><div>WEB was the futuristic documentation idea of Don Knuth.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Doing actual literate documentation of key tutorial programs would be a nice way of doing this, but I realise that's a lot more effort.<br></blockquote><div>This is still a hope/plan to go into doc/tutorials - follow the deal.ii model for a small number of key examples. Matt has done a couple of pages there already, in this direction. <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Lawrence</blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>