RosettaCodeData/Task/Calendar/Mathematica/calendar-4.math

27 lines
1.1 KiB
Plaintext

MonthGrid[
finalSpacings:{_Integer,_Integer},
finalBorderWidths:{{_Integer,_Integer},{_Integer,_Integer}},
finalOptions_Association,
titleGridder_Function,
monthName_String,
monthSpacings:{_Integer,_Integer},
monthBorderWidths:{{_Integer,_Integer},{_Integer,_Integer}},
monthOptions_Association,
headerCellGridder_Function,
weekdayNames:{__String},
dayCellGridder_Function,
dayOffset_Integer,
days:{__String}]:=
DataGrid[{2,1},finalSpacings,finalBorderWidths,finalOptions,
{titleGridder[List/@List/@Characters[monthName]],
HeadedGrid[monthSpacings,monthBorderWidths,monthOptions,headerCellGridder,weekdayNames,dayCellGridder,ArrayPad[days,{dayOffset,0},""]]}];
(*A compact example:*)
MonthGrid[{0, 0}, {{0, 0}, {0, 0}}, <||>,
DataGrid[{1, Length@#}, {0, 1}, {{1, 1}, {0, 0}}, <||>,ToUpperCase@#] &,
"September", {0, 1}, {{0, 0}, {0, 0}}, <||>,
DataGrid[{1}, {2}, {0, 0}, {{0, 0}, {0, 0}}, <||>, #] &,
{"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"},
DataGrid[{1}, {2}, {0, 0}, {{0, 0}, {0, 0}}, <|"alignment" -> {-1, 1}|>, #] &,
2, ToString /@ Range[31]]//AsString