Closed ridgeworks closed 8 months ago
Thanks. I forgot merging before creating a release :cry: Merged, but changed the implementation. sort/4 can sort lists on specific arguments of a compound or fields of a dict, avoiding the need for keying, keysort and pairs_values.
Very nice. I think sort/4 could also be used in pldoc_html:doc_file_objects/5
to order the module file predicates:
Pos = File:Line,
findall(Line-doc(Obj,Pos,Comment),
doc_comment(Obj, Pos, _, Comment), Pairs),
sort(Pairs, Pairs1), % remove duplicates
keysort(Pairs1, ByLine),
pairs_values(ByLine, Objs0),
A bit more complicated. There is only one level of selection. Well, possibly we can sort on the entire File:Line and that might be a good idea. Code predates sort/4 and I tend not to change things that are not broken ...
?? File
is instantiated, so why wouldn't something like this work:
doc_file_objects(FileSpec, File, Objects, FileOptions, Options) :-
absolute_file_name(FileSpec, File,
[ file_type(prolog),
access(read)
]),
source_file(File),
!,
ensure_doc_objects(File),
Pos = File:_,
findall(doc(Obj,Pos,Comment), doc_comment(Obj, Pos, _, Comment), MObjs),
sort(2, @=<, MObjs, Objs0), % MObjs = doc(PI,Pos,Comment)
% i.e., sort on Pos
reply_file_objects(File, Objs0, Objects, FileOptions, Options).
MObjs
only contains doc objects from the file in question so only one level of selection required.
If file is instantiated, it should work as before. I didn't read that far. I only change details like this if I'm working on that particular code. Too much hassle otherwise.
pldoc for "re-exported" predicates are now ordered by position, i.e., file name and line number.