@@ -631,18 +631,35 @@ bool less(T)(ref T a, ref T b)
631631 return lessImpl (a, b);
632632}
633633
634+ enum BugzillaOrGithub {
635+ bugzilla,
636+ github
637+ }
638+
634639/**
635640Writes the fixed issued from Bugzilla in the ddoc format as a single list.
636641
637642Params:
638643 changes = parsed InputRange of changelog information
639644 w = Output range to use
640645*/
641- void writeBugzillaChanges (Entries, Writer )(Entries entries, Writer w)
646+ void writeBugzillaChanges (Entries, Writer )(BugzillaOrGithub bog, Entries entries, Writer w)
642647 if (isOutputRange! (Writer , string ))
643648{
644649 immutable components = [" DMD Compiler" , " Phobos" , " Druntime" , " dlang.org" , " Optlink" , " Tools" , " Installer" ];
645650 immutable bugtypes = [" regression fixes" , " bug fixes" , " enhancements" ];
651+ const string macroTitle = () {
652+ final switch (bog) {
653+ case BugzillaOrGithub.bugzilla: return " BUGSTITLE_BUGZILLA" ;
654+ case BugzillaOrGithub.github: return " BUGSTITLE_GITHUB" ;
655+ }
656+ }();
657+ const string macroLi = () {
658+ final switch (bog) {
659+ case BugzillaOrGithub.bugzilla: return " BUGZILLA" ;
660+ case BugzillaOrGithub.github: return " GITHUB" ;
661+ }
662+ }();
646663
647664 foreach (component; components)
648665 {
@@ -652,11 +669,11 @@ void writeBugzillaChanges(Entries, Writer)(Entries entries, Writer w)
652669 {
653670 if (auto bugs = bugtype in * comp)
654671 {
655- w.formattedWrite(" $(BUGSTITLE_BUGZILLA %s %s,\n\n " , component, bugtype);
672+ w.formattedWrite(" $(%s %s %s,\n\n " , macroTitle , component, bugtype);
656673 alias lessFunc = less! (ElementEncodingType! (typeof (* bugs)));
657674 foreach (bug; sort! lessFunc(* bugs))
658675 {
659- w.formattedWrite(" $(LI $(BUGZILLA %s): %s)\n " ,
676+ w.formattedWrite(" $(LI $(%s %s): %s)\n " , macroLi ,
660677 bug.id, bug.summary.escapeParens());
661678 }
662679 w.put(" )\n " );
@@ -842,11 +859,11 @@ Please supply a bugzilla version
842859 // print the entire changelog history
843860 if (revRange.length)
844861 {
845- bugzillaChanges. writeBugzillaChanges(w);
862+ writeBugzillaChanges(BugzillaOrGithub.bugzilla, bugzillaChanges, w);
846863 }
847864 if (revRange.length)
848865 {
849- githubChanges. writeBugzillaChanges(w);
866+ writeBugzillaChanges(BugzillaOrGithub.github, githubChanges, w);
850867 }
851868 }
852869
0 commit comments