diff options
author | Karl Berry <karl@freefriends.org> | 2023-04-26 19:35:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-04-26 19:35:21 +0000 |
commit | 62bac7bb7d52d91532e93307f692f0e6167a7465 (patch) | |
tree | c58ebfeb5a2df679fd2e31dea0defc52ca69a9b3 /Master/texmf-dist | |
parent | 13ae8787f9d33680dd86fe338284693195b642d2 (diff) |
context-calendar-examples (26apr23)
git-svn-id: svn://tug.org/texlive/trunk@66947 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
9 files changed, 1843 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/context/third/calendar-examples/LICENSE b/Master/texmf-dist/doc/context/third/calendar-examples/LICENSE new file mode 100644 index 00000000000..a7a158b93c3 --- /dev/null +++ b/Master/texmf-dist/doc/context/third/calendar-examples/LICENSE @@ -0,0 +1 @@ +Public Domain
\ No newline at end of file diff --git a/Master/texmf-dist/doc/context/third/calendar-examples/README.md b/Master/texmf-dist/doc/context/third/calendar-examples/README.md new file mode 100644 index 00000000000..bd90a4df06b --- /dev/null +++ b/Master/texmf-dist/doc/context/third/calendar-examples/README.md @@ -0,0 +1,16 @@ +## A Collection of Calendars + +# Intro +There is a module called t-pocektdiary which contains numerous calculations for day, week, month and year tables. The module also comes with the possibility to calculate sunrise and sunset data as well as moon-cycle data. + +This collection of calendars shows the the mechanisms implemented in the PocketDiary module can also be used outside of its structures. + +# The examples +- Planner in the format A5 with 1 day per page +- Planner in the format A5 or A6 with 1 week on two facing pages +- Planner for menus +- Photo calendar + +# Author +Willi Egger +License Public Domain
\ No newline at end of file diff --git a/Master/texmf-dist/doc/context/third/calendar-examples/VERSION b/Master/texmf-dist/doc/context/third/calendar-examples/VERSION new file mode 100644 index 00000000000..4689b28be54 --- /dev/null +++ b/Master/texmf-dist/doc/context/third/calendar-examples/VERSION @@ -0,0 +1 @@ +2023.04.25 diff --git a/Master/texmf-dist/doc/context/third/calendar-examples/calendar-examples.md b/Master/texmf-dist/doc/context/third/calendar-examples/calendar-examples.md new file mode 100644 index 00000000000..a14e407ad2b --- /dev/null +++ b/Master/texmf-dist/doc/context/third/calendar-examples/calendar-examples.md @@ -0,0 +1,38 @@ +# Calendar examples + +The module provides different examples of calendars, made-up using the machinery provided in the t-pocketdiary module. + +The user is completely free to change and adapt the examples to his needs. The examples are in the Public Domain. + +## A5-day_per_page.tex + +This calendar produces single page day-calendars for the whole year. The page carries in the header the month's name and the year. +On the next line it places the the day-number of the month with the day-name. This is followed by the week-number and the the day-number of the year. In the following field the name of the Christian holiday is typeset. In the last block data concerning the moon-cycle and sun data are provided. +The page is filled with a hourly schedule from 06:00 to 22:00 +The footer displays information according to the setup established in the variable set. + +This example has different modes for the production either an A5 or an A6 sized calendar. The A5 sized calendar is arranged A4 landscape paper for sections of 16 pages consisting out of 4 sheets each carrying 2 pages recto and verso. The A6 version is also arranged for sections of 16 pages typeset on A4 portrait paper. The sections consist out of 2 sheets carrying 4 pages recto and 4 pages verso. + +## A6-1week_per_2pages.tex + +The calendar is made up as a table for one week, spread over two pages. +The header displays the month's name and to the right the week-number and the year. +The table is split in two parts after Thursday. Friday and the weekend is placed on the second page. The Weekend is split into two cells on one row. +On Tuesdays moon- and sun-data are desplayed. If the day is Chrstian holiday, it is printed in red and the name of the holiday is typeset. + + +## Menu-calendar.tex + +The menu-calendar is based on week-number, i.e. in years, where the first of January is not in the first week, those days are left out. Each week is spread over two pages. +The header shows the month's name and to the right the week-number. +The year is typeset in the footer. +Each day shows the day-number and the name of the day. Christian holidays are marked red and the name of the holiday is typeset right to the day-name. There is a larger space for notes concerning the menu and each day has a "Comment" line. + +## Photocalendar.tex + +The Phoro calendar is made-up on A4 paper. It contains a title page with one picture, followed by 12 pages each reserved for one month. On each of those pages there is a picture and at the bottom a month-table is placed. Centered above the table the month's name and the year is typeset. This example is set-up such, that one can only put either landscape or portrait pictures. + +## Sundata-calendar.tex + +This calendar puts the moon- and sun-data per day in a table. It is arranged as a A6-booklet consisting out of two sections. Sewn together and set into a cover this gives a handy brochure to keep track of moon-cycle and the daily sunrise, sunset and day-light hours. + diff --git a/Master/texmf-dist/tex/context/third/calendar-examples/A5-day_per_page.mkiv b/Master/texmf-dist/tex/context/third/calendar-examples/A5-day_per_page.mkiv new file mode 100644 index 00000000000..44d48f6cf8d --- /dev/null +++ b/Master/texmf-dist/tex/context/third/calendar-examples/A5-day_per_page.mkiv @@ -0,0 +1,426 @@ +%D \module +%D [ file=t-calendar-examples.tex +%D version=2023.04.15, +%D title=Calendar examples based on PocketDiary, +%D subtitle=A5 format 1 day per page calendar, +%D author=W. Egger, +%D date=\currentdate, +%D copyright=W. Egger, +%D license=Public Domain] + +%D This is an example of how to use the PocketDiary-module outside the built-in +%D structure of a PocketDiary. +%D In order to use this example you need to have the PocketDiary-module +%D installed from: +%D https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 +%D If you want collating marks placed on the outermost sheet of a section, +%D then you need to install also the Collatingmarks-module from: +%D https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 +%D The used imposition scheme is contained in the \CONTEXT\ distro. + +%D This is an example how to prepare a calendar, where each page contains one +%D day. On the left side there is a time-schedule starting at 06:00 ending +%D at 22:00. The header contains left the month and right the year. Below the +%D header there is a table showing left the day and the short dayname followed +%D by +%D the weeknumber and the daynumber of the year. If the day in question is a +%D Chrstian holiday, then the name of it is stated in the center. +%D To the right astronomical data +%D are shown: Lunar days/moonphase, sun rise, sun set and light hours. +%D In order to have complete sections a number of pages with lines are added. + +\usemodule[pocketdiary] +\usemodule[collatingmarks][Collatingmarks=yes] + +%D Setup the language to be used: EN,DE,NL,FR,IT,ES + +\mainlanguage[en] + +%D The variable sets for the PocketDiary module: + +\setvariables + [PocketDiary] + [Year=2023, + Week=1, + Day=1, + Month=1, + Nextyear=yes, + Yearnext=2024] + +\setvariables + [PocketDiaryFooter] + [Lefttext={\jobname .pdf}, + Centertext=\pagenumber, + Righttext=] + +\setvariables + [PocketDiaryColors] + [Separatorline=blue, + Gridline={s=.75}] + +\setvariables %Koziegłowy 52.467860 16.981240 + [PocketDiaryGeoPosition] + [lat=52.467860, + lon=16.981240, + timezoneoffset=1, + continent=US] % EU, US or empty for no Daylight Saving Time (DST) + +\setvariables + [PocketDiaryAddress] + [Familyname={\bf YourFamilyName}, + Forename=YourName, + Street=YourStreet and Number, + Zipcode=YourPostalCode, + City=YourPlace, + Country=YourCountry, + Phone=YourPhoneNumber, + Mobile=YourMobilePhoneNumber, + E-mail=YourEmail@YourProvider, + Web=YourWWW] + +\setupbodyfont[ibmplex,ss,10pt] + +\definefontfeature[f:Tabular][tnum=yes] + +\addfeature[f:Tabular] + +%D The document is double sided printed, the page number will be set in the +%D \setupfootertexts: + +\setuppagenumbering[alternative=doublesided,location=] + +\setuppapersize[A5][A4,landscape] +% \setuppapersize[A5][A5] + +%D Adapt the page layout to the size of the page: + +\setuplayout + [topspace=.6cm, + backspace=1.5cm, + header=2\bodyfontsize, + headerdistance=.5\bodyfontsize, + footer=1.2\bodyfontsize, + footerdistance=.5\bodyfontsize, + margin=0pt, + height=middle, + width=middle, + location=middle] + +%D Enable the imposition: 2 pages recto and verso using 4 sheets of A4 for forming one section + +\setuparranging[2*2*4] + + +%D Setup of the Collating marks module: + +\setupMPvariables % for collatingmarks + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=-0.5mm] + + +% \showframe + +%D Let Lua do the work: + +\startluacode + + local report = logs.reporter("Calendar-1-day-per-page") + + function thirddata.diary.year_of_monthtables( + year,lat,lon,timeoffset,continent) + + report("Working in function: diary.year_of_monthtables") + + for i = 1,12 do + local monthname = string.lower(os.date + ("%B",os.time{year=year,month=i,day=1})) + + thirddata.diary.header_text(monthname,year) + + thirddata.diary.monthblock(i,year,lat,lon,timeoffset,continent) + end + end + + function thirddata.diary.monthblock(month,year,lat,lon,timeoffset,continent) + + report("Working in function diary.monthblock") + + local nofdays = 1 + + local monthname = thirddata.calendar.select_nameofmonth(month,year) + local yeardays = thirddata.calendar.isleapyear(year) + + if month == 2 and yeardays == 366 then + nofdays = thirddata.calendar.nofdays_month(month,year) + 1 + else + nofdays = thirddata.calendar.nofdays_month(month,year) + end + + --report("Number of days in month: %s", nofdays) + + for i = 1,nofdays do + local ordinalday = thirddata.calendar.ordinalday(i,month,year) + local weeknumber = thirddata.calendar.weeknumber(i,month,year) + local dayname = string.lower(os.date ("%a",os.time{day=i,month=month,year=year})) + local holiday = thirddata.calendar.checkchristianfeast(i,month,year) + local moondata = thirddata.moonphase.lunardays(year,month,i) + local dst_start,dst_stop = thirddata.diary.DST(year,continent) + local sunrise,sunset,lighthours = + thirddata.srss.sundata( + i,month,year,lat,lon,timeoffset,dst_start,dst_stop) + + if holiday ~= "" then + report("Holiday: %s", holiday) + report("Day number: %s", i) + end + + context.bTABLE({setups="table:dayblock"}) + context.bTR() + context.bTD() + context.starttabulate{"|lw(0.1\\textwidth)|p(0.06\\textwidth)|p|"} + context.NC() + context("\\bf") + --report("Daynumber: %s Month %s", i,month) + if dayname == "sun" or holiday ~= "" and holiday ~= "ashw" + then local dnu = i + local dna = dayname + context.color({"red"}, + function() context(dnu) end) --day number + context("~") + context.color({"red"}, + function() context.labeltext(dna) end)--dayname + else + context(i) --day + context("~") + context.labeltext(dayname) --dayname + end + context.NC() + context.switchtobodyfont{"6pt"} + context.labeltext("week") + context(":") + context.par() + context(weeknumber) + context.NC() + context.switchtobodyfont{"6pt"} + context.labeltext("day") + context(":") + context.par() + context(ordinalday) + context("/") + context(yeardays) + context.NC() + context.NR() + context.stoptabulate() + context.eTD() + context.bTD() + context.starttabulate{"|lw(0.2\\textwidth)|p|p|p|p|"} + context.NC() + if holiday == "" then + context.strut() + else + context.labeltext(holiday) + end + context.NC() + if tonumber(moondata) then + context.labeltext("moondays") + else + context.labeltext("moon") + end + context(":~") + context.par() + context(moondata) + context.NC() + context("\\SunA[background=Sunrise]{}") + context.par() + context(sunrise) + context.NC() + context("\\SunA[background=Sunset]{}") + context.par() + context(sunset) + context.NC() + context("\\SunB[background=Light]{}") + context.par() + context(lighthours) + context.NC() + context.NR() + context.stoptabulate() + context.eTD() + context.eTR() + context.eTABLE() + context.page() + end + end + + function thirddata.diary.header_text(monthname,year) + context.setupheadertexts( + {function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + {function() + context(year) + return true + end + }, + {function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + {function() + context(year) + return true + end + }) + end + +\stopluacode + +%D Setup the tab;e for the day page + +\startsetups[table:dayblock] + \setupTABLE[each][each][frame=off] + \setupTABLE[r][each][offset=0pt,loffset=3pt,roffset=3pt,align=lohi] + \setupTABLE[c][1][width=0.35\textwidth,align=lohi] + \setupTABLE[c][2][style={\switchtobodyfont[6pt]},width=0.65\textwidth] \stopsetups + +%D Define the macro for invoking the lua calculations + +\define[5]\Yearofmonthtables{% + \ctxlua{thirddata.diary.year_of_monthtables(#1,#2,#3,#4,#5)}} + +%D Create a buffer containing the contents of the variables to be used + +\startbuffer[Yearofmonthtables] + \Yearofmonthtables %Year,lat,lon,timeoffset,continent + {\getvariable{PocketDiary}{Year}} + {\getvariable{PocketDiaryGeoPosition}{lat}} + {\getvariable{PocketDiaryGeoPosition}{lon}} + {\getvariable{PocketDiaryGeoPosition}{timeoffset}} + {"\getvariable{PocketDiaryGeoPosition}{continent}"} +\stopbuffer + +%D Create a time-table in \METAFUN\ as a background to the page + +\startreusableMPgraphic{Time-Lines} + numeric w; w:= OverlaytWidth; + numeric h; h:= (OverlayHeight-2cm)/18; + numeric t; + path p,q; + p := unitsquare xscaled OverlayWidth yscaled (OverlayHeight-2cm); + + q:= llcorner p -- lrcorner p; + draw q withpen pencircle scaled .5pt + withcolor \MPcolor{Grid}; + for i = 1 upto 17: + draw q shifted (0,i*h) withpen pencircle scaled .5pt + withcolor \MPcolor{Grid}; + t := 24 - 1 - i ; + label.top(textext(""& decimal t & ":00"),point 0 of q) shifted (15pt,((i-1)*h)+1pt); + endfor; +\stopreusableMPgraphic + +%D Make the timetable available as a background on the page + +\defineoverlay[Textbackground][\reuseMPgraphic{Time-Lines}] + +%D Implement international interface: +\setuplabeltext[en][title=Title] +\setuplabeltext[nl][title=Titel] +\setuplabeltext[de][title=Titel] +\setuplabeltext[fr][title=Titre] +\setuplabeltext[it][title=Titolo] +\setuplabeltext[es][title=Título] + +\setuplabeltext[en][author=Author] +\setuplabeltext[nl][author=Auteur] +\setuplabeltext[de][author=Autor] +\setuplabeltext[fr][author=Auteur] +\setuplabeltext[it][author=autore] +\setuplabeltext[es][author=Autor] + +\setuplabeltext[en][typography=Typography] +\setuplabeltext[nl][typography=Typografie] +\setuplabeltext[de][typography=Typographie] +\setuplabeltext[fr][typography=Typographie] +\setuplabeltext[it][typography=Tipografia] +\setuplabeltext[es][typography=Tipografía] + +\setuplabeltext[en][compilation=Compilation date] +\setuplabeltext[nl][compilation=Compilatie datum] +\setuplabeltext[de][compilation=Kompilationsdatum] +\setuplabeltext[fr][compilation=Date de compilation] +\setuplabeltext[it][compilation=Dato di compilazione] +\setuplabeltext[es][compilation=Fecha de compilación] + +%D Setup the TeX side of the document: + +\starttext + +%D Create the title pages + + \startstandardmakeup[page=yes,doublesided=no] + \strut + \startalignment [middle] + \godown[.3\textheight] + {\bfa \labeltext{calendar}} + \vfil + {\bf \getvariable{PocketDiary}{Year}} + \stopalignment + \stopstandardmakeup + + \startstandardmakeup[page=yes,doublesided=no] + \starttabulate[|l|p|] + \NC \labeltext{title} + \EQ {\bf \labeltext{calendar}} \NC\NR + \NC \labeltext{author} + \EQ \getvariable{PocketDiaryAddress}{Forename} + \getvariable{PocketDiaryAddress}{Familyname} \NC\NR + \NC \labeltext{typography} + \EQ \CONTEXT\ with \LUAMETATEX \NC\NR + \NC \labeltext{compilation} + \EQ \currentdate \NC\NR + \stoptabulate + \stopstandardmakeup + +%D Load the Lost-Returnto template + + \getbuffer[Lost-Returnto] + + \setupbackgrounds[text][background=] + + \setupbackgrounds[text][background=Textbackground] + +%D Insert all day pages + + \getbuffer[Yearofmonthtables] + + \setupbackgrounds[text][background=] + +%D Add a year table with all months + + \getbuffer[Yearcurrentplan] + + \setupheadertexts[\bfa \getvariable{PocketDiary}{Yearnext}] + +%D Insert a year table with all months of the following year + + \getbuffer[Yearnextplan] + +%D Add some todo-lists + + \dorecurse + {3} + {\getbuffer[Todo]} + +%D Add notes pages + + \dorecurse + {10} + {\getbuffer[Lines]} + +\stoptext diff --git a/Master/texmf-dist/tex/context/third/calendar-examples/A6-1week_per_2pages.mkiv b/Master/texmf-dist/tex/context/third/calendar-examples/A6-1week_per_2pages.mkiv new file mode 100644 index 00000000000..eaee939c4c9 --- /dev/null +++ b/Master/texmf-dist/tex/context/third/calendar-examples/A6-1week_per_2pages.mkiv @@ -0,0 +1,387 @@ +%D \module +%D [ file=t-calendar-examples.tex, +%D version=2023.04.15, +%D title=Calendar examples based on PocketDiary, +%D subtitle=A5/A6 format, 1 week per 2 facing pages, +%D author=W. Egger, +%D date=\currentdate, +%D copyright=W. Egger, +%D license=Public Domain] + +%D This is an example of how to use the PocketDiary-module outside the built-in +%D structure of a PocketDiary. +%D In order to use this example you need to have the PocketDiary-module +%D installed from: +%D https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 +%D If you want collating marks placed on the outermost sheet of a section, +%D then you need to install also the Collatingmarks-module from: +%D https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 +%D The used imposition scheme is contained in the \CONTEXT\ distro. + +%D This is an example how to prepare a calendar, where two facing pages carry +%D one week as a table. Saturday and Sunday are placed together in one row. +%D The header contains the month name to the left and the week number and the +%D year to the right. +%D The footer contains three fields. The first contains the job-name, the center +%D field shows the page number, the right field is not filled. -- However +%D this can easily be changed in the variable set "PocketDiaryFooter". +%D Each row of the week-table shows top left the day number followed by the short +%D name of the day. Next to this the ordinal day number of the year is typeset. +%D If the day in question is a Christian holiday, then its name is placed next +%D to the general information. +%D This example supports 6 languages i.e. English, German, Dutch, French, +%D Italian and Spanish. The respective interface is activated by enabling the +%D respective mode +%D The original idea was to have an A6 calendar, where 4 pages are print on the +%D A4 paper. This is activated by enabling the mode "A6". By activating the mode +%D "A5" the calendar is prepared A5 sized on a A4 landscape paper. +%D Because there are astronomical data concerning the sun rise, sun set times it +%D is necessary to fill in the correct geo-positional data in the variable set +%D "PocketDiaryGeoPosition". + +%D Load the PocketDiary module + +\usemodule[pocketdiary] + +%D Load the Collating marks module + +\usemodule[collatingmarks][Collatingmarks=yes] + +%D Define the modes for the different formats + +\definemode[A5,A6][keep] + +%D Enable the desired format of the calendar + +\enablemode[A5] + +%D Set the interface language which includes EN,DE,NL,FR,IT,ES + +\mainlanguage[en] + +%D Setup the variable sets for the PocketDiary module + +\setvariables + [PocketDiary] + [Year=2020, + Week=1, + Day=1, + Month=1, + Nextyear=yes] + +\setvariables + [PocketDiaryFooter] + [Lefttext={\jobname .pdf}, + Centertext=\pagenumber, + Righttext=] + +\setvariables + [PocketDiaryColors] + [Separatorline=blue, + Gridline={s=.75}] + +\setvariables %Koziegłowy 52.467860 16.981240 + [PocketDiaryGeoPosition] + [lat=52.467860, + lon=16.981240, + timezoneoffset=1, + continent=EU] % Eu, US or empty for no Daylight Saving Time (DST) + +\setvariables + [PocketDiaryAddress] + [Familyname=YourFamilyName, + Forename=YourName, + Street=YourStreet and Number, + Zipcode=YourPostalCode, + City=YourPlace, + Country=YourCountry, + Phone=YourPhoneNumber, + Mobile=YourMobilePhoneNumber, + E-mail=YourEmail@YourProvider, + Web=YourWWW] + +%D Setup the desired font to be used + +\setupbodyfont[ibmplex,ss,10pt] + +\definefontfeature[f:Tabular][tnum=yes] + +\addfeature[f:Tabular] + +%D Make the document doublesided, switch off the page numbering. The latter +%D is done in the PocketDiary footer setup + +\setuppagenumbering[alternative=doublesided,location=] + +\setuplayout + [topspace=.6cm, + backspace=1cm, + header=2\bodyfontsize, + headerdistance=.5\bodyfontsize, + footer=1.2\bodyfontsize, + footerdistance=.5\bodyfontsize, + margin=0pt, + height=middle, + width=middle, + location=middle, + marking=on] + +%D Elaborate the definitions for the A6 format + +\startmode[A6] + \definepapersize[Agenda][width=100mm,height=140mm] + + \setuppapersize[Agenda][A4,portrait] + % \setuppapersize[Agenda][Agenda] + + % The vertical page-shift enables to make a 2.5mm cut at the head of the + % section + \definepageshift + [ver] + [vertical] + [2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm, + 2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm] + + \setuppageshift[paper][ver] + + \setuparranging[2*4*2] + + \setupMPvariables % for collatingmarks + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=-0.5mm] +\stopmode + +%D Elaborate the definition for the A5 format + +\startmode[A5] + \definepapersize[Agenda][width=148mm,height=210mm] + + \setuppapersize[Agenda][A4,landscape] + + \setuparranging[2SIDE] + %\setuparranging[2*2*4] + + \setupMPvariables % for collatingmarks + [pages=4, % pages per sheet of paper doublesided + sheets=4, % sheets of paper used per section + horpageshift=0mm] +\stopmode + +%D Let Lua the main work: + +\startluacode + + local report = logs.reporter("Calendar-1-week-per-2-pages") + + function thirddata.diary.year_of_weektables(year, + lat,lon,timeoffset,continent) + + local year = year + local lat = lat + local lon = lon + local timeoffset = timeoffset + local continent = continent + + report("Working in function: diary.year_of_weektables") + + for calendarmonth = 1,12 do + --for calendarmonth = 1,12 do + thirddata.diary.monthblock + (calendarmonth,year,lat,lon,timeoffset,continent) + end + end + + function thirddata.diary.monthblock(month,year, + lat,lon,timeoffset,continent) + + report("Working in function diary.monthblock: %s", month) + + local c = thirddata.calendar.month(month,year) --returns number of weeks in a given month + local wkf = thirddata.calendar.weeknumber(1,month,year) --weeknumber of 1st day of a given month + + report("First week in month %s of year %s is %s",month,year,wkf) + + local wkl = wkf + c - 1 -- last week of a given month based on wkf and c, is wrong for January + + report("Weeks in the selected month: %s", c) + report("First week of month: %s", wkf) + + if month == 1 and wkf > 51 then + + --report("Calculating in week number %s", wkf) + calcyear = year - 1 + thirddata.diary.setup_header_texts(wkf,month,calcyear) + + thirddata.diary.thisweek(wkf,month,year,lat,lon,timeoffset,continent) + + report("Week %s - Year %s",wkf,year) + + --year = year + 1 + wkf = 1 + wkl = wkf + c - 2 + + for i = wkf, wkl do + thirddata.diary.setup_header_texts(i,month,year) + thirddata.diary.thisweek(i,month,year,lat,lon,timeoffset,continent) + end + else + for i = wkf, wkl do + + report("Calculating in week number %s", i) + + thirddata.diary.setup_header_texts(i,month,year) + thirddata.diary.thisweek(i,month,year, + lat,lon,timeoffset,continent) + end + end + end + + + function thirddata.diary.setup_header_texts(week,month,year) + + local monthname = string.lower(os.date + ("%B",os.time{year=year,month=month,day=1})) + + context.setupheadertexts( + {function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + {function() + context.labeltext("week") + context(": ~") + context(week) + context("\\quad") + context(year) + return true + end + }, + {function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + {function() + context.labeltext("week") + context(": ~") + context(week) + context("\\quad") + context(year) + return true + end + }) + end + +\stopluacode + +%D Setup the table for the week calendar + +\startsetups[table:week] + \setupTABLE[split=yes] + \setupTABLE[each][each][frame=on] + \setupTABLE + [r] + [each] + [offset=0pt, + loffset=3pt, + roffset=3pt, + height=0.23\textheight] + \setupTABLE[c][1][width=0.5\textwidth] + \setupTABLE[c][2][width=0.5\textwidth] +\stopsetups + +%D Define the macro for invoking the calculations + +\define[5]\Yearofweektables{\ctxlua{thirddata.diary.year_of_weektables(#1,#2,#3,#4,#5)}} + +%D Create a buffer containing all variables for the calculations + +\startbuffer[Yearofweektables] + \Yearofweektables %Year,lat,lon,timeoffset,continent + {\getvariable{PocketDiary}{Year}} + {\getvariable{PocketDiaryGeoPosition}{lat}} + {\getvariable{PocketDiaryGeoPosition}{lon}} + {\getvariable{PocketDiaryGeoPosition}{timeoffset}} + {"\getvariable{PocketDiaryGeoPosition}{continent}"} +\stopbuffer + +%D Setup the \TEX\ side of the document + +\starttext + +%D Establish the content for the title pages + + \startstandardmakeup[page=yes,doublesided=no] + \strut + \godown[.3\textheight] + \startalignment [middle] + {\bfa \labeltext{calendar}} + \vfil + {\bf \getvariable{PocketDiary}{Year}} + \stopalignment + \stopstandardmakeup + + \startstandardmakeup[page=yes,doublesided=no] + \starttabulate[|l|p|] + \NC \translate[en=Title, + nl=Titel, + de=Titel, + fr=Titre, + it=Titolo] + \EQ {\bf \labeltext{calendar}} \NC\NR + \NC \translate[en=Author, + nl=Auteur, + de=Autor, + fr=Auteur, + it=autore, + es=Autor] + \EQ \getvariable{PocketDiaryAddress}{Forename} + \getvariable{PocketDiaryAddress}{Familyname} \NC\NR + \NC \translate[en=Typography, + nl=Typografie, + de=Typographie, + fr=Typographie, + it=Tipografia, + es=Tipografía] + \EQ \CONTEXT\ with \LUAMETATEX \NC\NR + \NC \translate[en=Compilation date, + nl=Compilatie datum, + de=Kompilationsdatum, + fr=Date de compilation, + it=Dato di compilazione, + es=Fecha de compilación] + \EQ \currentdate \NC\NR + \stoptabulate + \stopstandardmakeup + +%D Insert a page with lost-return-to information (PocketDiary +%D template) + + \getbuffer[Lost-Returnto] + +%D Add a year table with all months + + \getbuffer[Yearcurrentplan] + + \setupheadertexts[\bfa \getvariable{PocketDiary}{Yearnext}+1] + +%D Add a year table of the next year with all months + + \getbuffer[Yearnextplan] + + \setupheadertexts[] + +%D Insert all weektables by loading the buffer + + \getbuffer[Yearofweektables] + +%D Add pages for notes +\dorecurse + {4} + {\getbuffer[Lines]} + +\stoptext
\ No newline at end of file diff --git a/Master/texmf-dist/tex/context/third/calendar-examples/Menu-calendar.mkiv b/Master/texmf-dist/tex/context/third/calendar-examples/Menu-calendar.mkiv new file mode 100644 index 00000000000..23ae3f7017d --- /dev/null +++ b/Master/texmf-dist/tex/context/third/calendar-examples/Menu-calendar.mkiv @@ -0,0 +1,313 @@ +%D \module +%D [ file=t-calendar-examples.tex +%D version=2023.04.15 +%D title=Calendar examples based on PocketDiary +%D subtitle=Menu calendar, +%D author=W. Egger, +%D date=\currentdate +%D copyright=W. Egger +%D license=Public Domain + + +%D This is an example of how to use the PocketDiary-module outside the built-in +%D structure of a PocketDiary. +%D In order to use this example you need to have the PocketDiary-module +%D installed from: +%D https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 +%D +%D If you want collating marks placed on the outermost sheet of a section, +%D then you need to install also the Collatingmarks-module from: +%D https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 +%D The used imposition scheme is contained in the \CONTEXT\ distribution. + +%D Load the PocketDiary module + +\usemodule[pocketdiary] + +%D Load the Collating marks module + +\usemodule[collatingmarks][Collatingmarks=yes] + +%% Choose and setup the desired font + +\setupbodyfont[ibmplex,ss,10pt] + +%D Add a path to the picture placed on page 3: + +\setupexternalfigures + [directory=/Path-to-the-picture/] + +%D Choose the main language which determines the interface: + +\mainlanguage[en] + +%D This document will be doublesided, the pagenumber will be placed in the +%D footer by means of \type{\setupfootertexts}: + +\setuppagenumbering[alternative=doublesided,location=] + +%D The calendar has a pagesize of A6 and with the imposition 4 pages recto and +%D verso are placed on a A4. Two sheets of A4 form one section: + +%D Setup paper size and map it on the size of the print paper + +\setuppapersize[A6][A4] + +%D Invoke the arranging of the pages + +\setuparranging[2*4*2] + +%D Setup the appropriate information for the collating marks module: + +\setupMPvariables + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=0mm] + + +%D Adapt the layout of the page to the size of the page: + +\setuplayout + [topspace=.6cm, + backspace=.6cm, + header=2\bodyfontsize, + headerdistance=.5\bodyfontsize, + footer=1.2\bodyfontsize, + footerdistance=.5\bodyfontsize, + margin=0pt, + height=middle, + width=middle, + location=middle] + +%D Setup the variable sets from the PocketDiary module to be set: + +\setvariables + [PocketDiary] + [Year=2023] + +\setvariables + [PocketDiaryFooter] + [Lefttext=\labeltext{menu}-\labeltext{calendar}, + Centertext=\pagenumber, + Righttext=\getvariable{PocketDiary}{Year}] + +\setvariables + [PocketDiaryColors] + [Separatorline=blue, + Gridline={s=.75}] + +%D The data are presented in table form. The setup of the table is +%D as follows: + +\startsetups table:week + \setupTABLE[split=yes] + \setupTABLE[c][1][width=.35\textwidth,frame=off] + \setupTABLE[c][2][width=.65\textwidth,frame=off] + \setupTABLE[r][height=2\lineheight,align=lohi] + \setupTABLE[r][2,3,5,6,8,9,11,12,14,15,17,18,20,21][bottomframe=on] +\stopsetups + +%D There are currently 6 interfaces supported: EN,DE,NL,FR,IT,ES +%D Create some label texts for each language + +%D English interface + +\setuplabeltext[en][menu=Menu] +\setuplabeltext[en][comment=Comment] + +%D German interface + +\setuplabeltext[de][menu=Menü] +\setuplabeltext[de][comment=Kommentar] + +%D French interface + +\setuplabeltext[fr][menu=Menu] +\setuplabeltext[fr][comment=Commentaire] + +%D Dutch interface + +\setuplabeltext[nl][menu=Menu] +\setuplabeltext[nl][comment=Commentaar] + +%D Italian interface + +\setuplabeltext[it][menu=Menu] +\setuplabeltext[it][comment=Commento] + +%D Spanish interface + +\setuplabeltext[es][menu=Menú] +\setuplabeltext[es][comment=Comentario] + + +%D Let lua perform all the magic: + +\startluacode + + local report = logs.reporter("Menu calendar") + + function thirddata.calendar.menuweektable(mondaytimestamp,year,w) + local stamp = mondaytimestamp + local year = year + local week = w + local daynumber,dayname,monthname,holiday + + local day = stamp + 1 * 24 * 60 * 60 + + report("Working in function: thirddata.calendar.menuweektable") + + local monthname = string.lower(os.date("%B",day)) + + --report("Month: %s Week: %s", monthname,week) + + thirddata.calendar.myheadertext(monthname,week) + + context.bTABLE({setups="table:week"}) + + for i = 1,7 do + local day = stamp + i * 24 * 60 * 60 + + --report("Day-inloop: %s", day) + + daynumber = tonumber(os.date("%d",day)) --day number + dayname = string.lower(os.date("%a",day)) -- day name short + monthnumber = tonumber(os.date("%m",day)) -- month name + holiday = thirddata.calendar.checkchristianfeast(daynumber,monthnumber,year) -- Christian holida + + if holiday ~= "" then + report("Holiday (before table row): %s", holiday) + report("Day number (before table row): %s", daynumber) + report("Day name (before table row): %s",dayname) + end + + context.bTR() + context.bTD({style="bfa"}) + + if dayname == "sun" or holiday ~= "" and f ~= "ashw" then + local dnu = daynumber + local dna = dayname + context.color({"red"},function() context(dnu) end) + context("~") + context.color({"red"},function() context.labeltext(dna) end) + else + context(daynumber) + context("~") + context.labeltext(dayname) + end + context.eTD() + context.bTD() + context.labeltext(holiday) + context.eTD() + context.eTR() + context.bTR() + context.bTD({nx="2"}) + context.labeltext("menu") + context.eTD() + context.eTR() + context.bTR() + context.bTD({nx="2"}) + context.labeltext("comment") + context.eTD() + context.eTR() + end + context.eTABLE() + context.page({"yes"}) + end + + function thirddata.calendar.myheadertext(monthname,week) + + report("Working in function myheadertext") + + context.setupheadertexts{ + function() + context("\\bgroup\\bfa") + context.labeltext(monthname) + context("\\egroup") + context("\\hfill") + context.labeltext("week") + context(": ") + context(week) + return true + end} + end + + function thirddata.calendar.week(weeknumber,year) + local w = weeknumber + local year = year + local month = thirddata.calendar.select_month(1,w,year) + local mondaytimestamp = thirddata.calendar.weekcalendar(w,month,year) + + report("Working in function: thirddata.calendar.week") + --report("Mondaytimestamp %s", mondaytimestamp) + + thirddata.calendar.menuweektable(mondaytimestamp,year,w) + end + +\stopluacode + +%D We need a macro to call the lua-code: this macro has two parameters +%D week number and year + +\define[2]\MenuWeektable{\ctxlua{thirddata.calendar.week(#1,#2)}} + +% \showframe + +%D The setup of the document at the TeX-side: + +\starttext + +%D Add a title page + + \startstandardmakeup[page=yes,doublsided=yes] + \strut + \godown[.3\textheight] + \startalignment [middle] + {\bfc \labeltext{menu}-\labeltext{calendar}} + \vfill + {\tfa \getvariable{PocketDiary}{Year}} + \stopalignment + \vfil + \stopstandardmakeup + +%D Add a picture on page 3 + + \setupheadertexts[][] + + \strut\vfil + + \startplacefigure + [number=, + title=, + location=middle] + {\externalfigure[YourPicture.jpg][width=0.75\textwidth]} + \stopplacefigure + + \vfill + + \page + +%D Call the footer text setups + + \setups{Footertext} + +%D Place the week tables for the indicated year + + \dorecurse{52} + {\setvariables + [PocketDiary] + [Week=\recurselevel] + \MenuWeektable{\recurselevel}{\getvariable{PocketDiary}{Year}}\page} + + \page + +%D Add some empty pages for notes + + \setupheadertexts[\bf \labeltext{notes}] + + \dorecurse + {3} + {\strut\page} + +\stoptext + diff --git a/Master/texmf-dist/tex/context/third/calendar-examples/Photocalendar.mkiv b/Master/texmf-dist/tex/context/third/calendar-examples/Photocalendar.mkiv new file mode 100644 index 00000000000..59185f3840c --- /dev/null +++ b/Master/texmf-dist/tex/context/third/calendar-examples/Photocalendar.mkiv @@ -0,0 +1,222 @@ +%D \module +%D [ file=t-calendar-examples.tex +%D version=2023.04.14 +%D title=Calendar examples based on PocketDiary +%D subtitle=Photo calendar, +%D author=W. Egger, +%D date=\currentdate +%D copyright=W. Egger +%D license=Public Domain + +%D Mind you that Thomas Schmitz put on the \CONTEXT -wiki a lua-script, which +%D creates a tex-file which can be compiled with \CONTEXT\ already back in 2007 +%D for the preparation of a photo-calendar. +%D The nice thing about it is, that it uses a small number of formulae. Nice is, +%D that it also uses the Sohael Babwani formulae. See: +%D https://wiki.contextgarden.net/Calendar_script + +%D This eaxmple creates a photo calender. It has a front page with a photo and +%D the year. The following pages have a photo at the top and at the bottom a +%D month table. On top of the month table there is the month name and the year. +%D This photo calendar is based on the PocketDiary. + +%D Load the PocketDiary module + +% This example file creates a photo calendar based on the PocketDiary-module. +% In order to use this example you need to have the PocketDiary-module +% installed from: +% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 + +% The calendar is typeset on A4 portrait. The calendar is a flip-over type, +% where in the top-part is a photo and thereunder the month-table with +% indication of the month name and year. +% The pictures to be used are placed in a subdirectory. Each picture gets +% a symbolic name (number) to be used in the \dorecurse loop. +% For completing the calendar we need 13 pictures. The picture 13 is used on +% the title page. +% This file supports 6 languages, which are selected through the \mainlanguage[] + +%D Load the PockeDiary module + +\usemodule[pocketdiary] + +%D Choose and setup the font to be used + +\setupbodyfont[ibmplex,ss,12pt] + +%D Switch off the page numbering + +\setuppagenumbering[location=] + +%D Setup the paper size + +\setuppapersize[A4,portrait][A4,portrait] + +%D Adjust the layout of the page + +\setuplayout + [topspace=20mm, + backspace=8.6mm, + header=0pt, + footer=0pt, + height=middle, + width=middle] + +%% Supported languages: EN,DE,NL,FR,IT,ES +\mainlanguage[en] + +%D Setup the path where to find the calendar pictures +\setupexternalfigures + [directory=./MyPhotoDirectory] + +% Give pictures symbolic names for using in a loop +\useexternalfigure + [1] + [A.jpg] + +\useexternalfigure + [2] + [B.jpg] + +\useexternalfigure + [3] + [C.jpg] + +\useexternalfigure + [4] + [D.jpg] + +\useexternalfigure + [5] + [E.jpg] + +\useexternalfigure + [6] + [F.jpg] %[TV-Kasten-Flurin.jpg] + +\useexternalfigure + [7] + [G.jpg] + +\useexternalfigure + [8] + [H.jpg] + +\useexternalfigure + [9] + [I.jpg] + +\useexternalfigure + [10] + [J.jpg] + +\useexternalfigure + [11] + [K.jpg] + +\useexternalfigure + [12] + [L.jpg] + +\useexternalfigure + [13] + [M.jpg] + +%D Setup the variables for the Pocket diary, only year is used for the +%D calculations. + +\setvariables + [PocketDiary] + [Year=2023] + +%D Let the header and the footer be empty: + +\setupheadertexts[][] + +\setupfootertexts[][] + +%D Add some label texts for the international interfaces: + +\setuplabeltext[en][fotocal={Photo Calendar}] +\setuplabeltext[nl][fotocal=Fotokalender] +\setuplabeltext[de][fotocal=Fotokalender] +\setuplabeltext[fr][fotocal={Calendrier photo}] +\setuplabeltext[it][fotocal={Calendario fotografico}] +\setuplabeltext[es][fotocal={Calendario fotográfico}] + +%D Let lua is perform the magic: + +\startluacode + local report = logs.reporter("Photo calendar") + + function thirddata.calendar.Photo_calendar_page(y) + + report("Working in function: calendar.Foto_calendar_page") + + local year = y + --local path = file.dirname("./Fotokalender-fotos/") + for i = 1,12 do + + local monthname = string.lower(os.date("%B", + os.time{year=year,month=i,day=1})) + + context.startplacefigure({number="",title=""}) + context.externalfigure({i}, {width = "0.8\\textwidth"}) + context.stopplacefigure() + context.strut() + context("\\vfill") + context.startalign({"middle"}) + context("\\bfa") + context.labeltext(monthname) + context("~") + context(year) + context.stopalign() + context.blank() + + thirddata.diary.monthtableH(i,year) + + context.page() + end + end +\stopluacode + +% Setup of the month table + +\startsetups table:month + \setupTABLE[c] + [each] + [width=\dimexpr\textwidth/7, + frame=on, + style=\tfa] + \setupTABLE[r][each][height=1.8\lineheight,align={center,lohi}] + \setupTABLE[c][7][foregroundcolor=red] +\stopsetups + +%D Define the macro for calling lua + +\define[1]\Photocalendarpages + {\ctxlua{thirddata.calendar.Photo_calendar_page(#1)}} + +%D Setup the \TEX\ side of the document + +\starttext + +%D Add a title page + +\startstandardmakeup[page=yes,doublesided=yes] + \startplacefigure + [location=middle, + title=, + number=] + {\externalfigure[13][width=\paperwidth]} + \stopplacefigure + \midaligned{\bfc \labeltext{fotocal}~\getvariable{PocketDiary}{Year}} +\stopstandardmakeup + +%D Call the defined macro + +\Photocalendarpages{\getvariable{PocketDiary}{Year}} + +\stoptext + + diff --git a/Master/texmf-dist/tex/context/third/calendar-examples/Sundata-calendar.mkiv b/Master/texmf-dist/tex/context/third/calendar-examples/Sundata-calendar.mkiv new file mode 100644 index 00000000000..81c97e537e6 --- /dev/null +++ b/Master/texmf-dist/tex/context/third/calendar-examples/Sundata-calendar.mkiv @@ -0,0 +1,439 @@ +%D \module +%D [ file=t-calendar-examples.tex, +%D version=2023.04.15, +%D title=Calendar examples based on PocketDiary, +%D subtitle=Sun and moon data calendar, +%D author=W. Egger, +%D date=\currentdate, +%D copyright=W. Egger, +%D license=Public Domain] + +%D This examples creates a small calendar, containing the sunrise and +%D sunset time as well as the lunar days for each day of a given year. + +%D In order to create this calendar the PocketDiary module must be installed +%D on the computer + +%D For placing collating marks on the outside of the sections, the +%D Collating Marks module is required. + +%D Load the PocketDiary module + +\usemodule[pocketdiary] + +%D Load the Collating Marks module + +\usemodule[collatingmarks][Collatingmarks=yes] + +%D Setup the main language. This determines the interface to be used + +\mainlanguage[en] + + +% Setup of the variable sets for the PocketDiary module + +\setvariables + [PocketDiary] + [Year=2023, + Week=1, + Day=1, + Month=1, + Nextyear=no, + Place=Koziegłowy, + Country=PL] + +\setvariables + [PocketDiaryFooter] + [Lefttext={\jobname .pdf}, + Centertext=\pagenumber, + Righttext=] + +\setvariables + [PocketDiaryColors] + [Separatorline=blue, + Gridline={s=.75}] + +\setvariables + [PocketDiaryGeoPosition] + [lat=52.464588, + lon=16.981689, + timezoneoffset=1, + continent=EU] %EU, US or empty for no DST + + +%D Choose and setup the desired font to be used + +\setupbodyfont[ibmplex,ss,10pt] + +%D Make the document doublesided and switch off automatic page number placement + +\setuppagenumbering[alternative=doublesided,location=] + +%D Setup paper size + +\setuppapersize[A6][A4] + +%D Setup the layout of the page + +\setuplayout + [topspace=.6cm, + backspace=.6cm, + header=2\bodyfontsize, + headerdistance=.5\bodyfontsize, + footer=1.2\bodyfontsize, + footerdistance=.5\bodyfontsize, + margin=0pt, + height=middle, + width=88mm, + location=middle] + + +%D Setup page arrangement + +\setuparranging[2*4*2] + +% Setup the variables for the Collating Marks module + +\setupMPvariables % for collatingmarks + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=0mm] + +%D Let lua do the calculations + +\startluacode + +local report = logs.reporter("Sundata calendar") + +function thirddata.diary.year_of_monthtables( + year,lat,lon,timeoffset,continent) + + report("Working in function: diary.year_of_monthtables") + + local dst_start,dst_stop = thirddata.diary.DST(year,continent) + + report("DST start: %s, DST stop: %s",dst_start,dst_stop) + +-- for i= 1,12 do + for i= 4,4 do + local monthname = string.lower(os.date + ("%B",os.time{year=year,month=i,day=1})) + + context.setupheadertexts( + { + function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + { + function() + context(year) + return true + end + }, + { + function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + { + function() + context(year) + return true + end + }) + + thirddata.diary.monthblock(i,year,lat,lon,timeoffset,dst_start,dst_stop) + end +end + +function thirddata.diary.monthblock( + month,year,lat,lon,timeoffset,dst_start,dst_stop) + + report("Working in function diary.monthblock") + + local c = thirddata.calendar.month(month,year) --returns number of weeks in a given month + local wkf = thirddata.calendar.weeknumber(1,month,year) + + --report("Weeks in the selected month: %s", c) + --report("Week number : %s", wkf) + + local nofdays = 1 + + if month == 2 and thirddata.calendar.isleapyear(year) ~= 365 then + nofdays = thirddata.calendar.nofdays_month(month,year) + 1 + else + nofdays = thirddata.calendar.nofdays_month(month,year) + end + + report("Number of days in month: %s", nofdays) + + local wkl = thirddata.calendar.weeknumber(nofdays,month,year) + + local monthname = thirddata.calendar.select_nameofmonth(month,year) + + context.bTABLE({setups="table:monthblock"}) + + for i = 1,nofdays do + + local ordinalday = thirddata.calendar.ordinalday(i,month,year) + local weeknumber = thirddata.calendar.weeknumber(i,month,year) + local holiday = thirddata.calendar.checkchristianfeast(i,month,year) + local moondata = thirddata.moonphase.lunardays(year,month,i) + local sunrise,sunset,lighthours = + thirddata.srss.sundata( + i,month,year,lat,lon,timeoffset,dst_start,dst_stop) + + context.bTR() + context.bTD() + + local dayname = string.lower(os.date + ("%a",os.time{day=i,month=month,year=year})) + + --report("Dayname: %s",dayname) + context.starttabulate{"|lw(0.1\\textwidth)|lw(0.06\\textwidth)|l|"} + context.NC() + if dayname == "sun" or holiday ~= "" and holiday ~= "asw" then + local dnu = i + local dna = dayname + context.color({"red"}, + function() context(dnu) end) --day number + context("~") + context.color({"red"}, + function() context.labeltext(dna) end)--dayname + else + context(i) --day + context("~") + context.labeltext(dayname) --dayname + end + context.NC() + context.switchtobodyfont{"6pt"} + context.labeltext("week") + context(": ") + context(weeknumber) + context.NC() + context.switchtobodyfont{"6pt"} + context.labeltext("day") + context(": ") + context(ordinalday) + context.NC() + context.NR() + context.stoptabulate() + context.eTD() + context.bTD() + context.starttabulate{"|lw(0.2\\textwidth)|l|l|l|l|"} + context.NC() + if holiday == "" then + context.strut() + context.NC() + context.NC() + context.NC() + context.NC() + else + context.labeltext(holiday) + context.NC() + context.NC() + context.NC() + context.NC() + end + context.NR() + context.NC() + if tonumber(moondata) then + context.labeltext("moondays") + else + context.labeltext("moon") + end + context(":~") + context(moondata) + context.NC() + --context.labeltext("sunrise") + context("\\SunA[background=Sunrise]{}") + context("\\quad :~") + context(sunrise) + context.NC() + context("\\SunA[background=Sunset]{}") + context("\\quad :~") + context(sunset) + context.NC() + context("\\SunB[background=Light]{}") + context("~:~") + context(lighthours) + context.NC() + context.NR() + context.stoptabulate() + context.eTD() + context.eTR() + end + context.eTABLE() + context.page() +end + +\stopluacode + +%D Setup the table for the months + +\startsetups[table:monthblock] + \setupTABLE[split=yes] + \setupTABLE[each][each][frame=on] + \setupTABLE[r][each][offset=0pt,loffset=3pt,roffset=3pt,align=lohi] + \setupTABLE[c][1][width=0.35\textwidth,align=lohi] + \setupTABLE[c][2][style={\switchtobodyfont[6pt]},width=0.65\textwidth] \stopsetups + +%D Define the macro to call lua + +\define[5]\Yearofmonthtables{\ctxlua{thirddata.diary.year_of_monthtables(#1,#2,#3,#4,#5)}} + +%D Create a buffer containing all required variables for the calculations + +\startbuffer[Yearofmonthtables] + \Yearofmonthtables %Year,lat,lon,timeoffset,dst_start,dst_stop + {\getvariable{PocketDiary}{Year}} + {\getvariable{PocketDiaryGeoPosition}{lat}} + {\getvariable{PocketDiaryGeoPosition}{lon}} + {\getvariable{PocketDiaryGeoPosition}{timeoffset}} + {"\getvariable{PocketDiaryGeoPosition}{continent}"} +\stopbuffer + +%D Setup label texts for the different interfaces + +\setuplabeltext[en][week=Wk.~] +\setuplabeltext[de][week=Wo.~] + +\setuplabeltext[en][title=Title] +\setuplabeltext[nl][title=Titel] +\setuplabeltext[de][title=Titel] +\setuplabeltext[fr][title=Titre] +\setuplabeltext[it][title=Titolo] +\setuplabeltext[es][title=Título] + +\setuplabeltext[en][author=Author] +\setuplabeltext[nl][author=Auteur] +\setuplabeltext[de][author=Autor] +\setuplabeltext[fr][author=Auteur] +\setuplabeltext[it][author=autore] +\setuplabeltext[es][author=Autor] + +\setuplabeltext[en][typography=Typography] +\setuplabeltext[nl][typography=Typografie] +\setuplabeltext[de][typography=Typographie] +\setuplabeltext[fr][typography=Typographie] +\setuplabeltext[it][typography=Tipografia] +\setuplabeltext[es][typography=Tipografía] + +\setuplabeltext[en][compilation=Compilation date] +\setuplabeltext[nl][compilation=Compilatie datum] +\setuplabeltext[de][compilation=Kompilationsdatum] +\setuplabeltext[fr][compilation=Date de compilation] +\setuplabeltext[it][compilation=Dato di compilazione] +\setuplabeltext[es][compilation=Fecha de compilación] + +%D Setup the document at the \TEX\ side +\starttext + +%D Add a title page + + \startstandardmakeup[page=yes,doublesided=no] + \strut + \startalignment [middle] + \godown[.3\textheight] + \startmode[**en] + {\bfc \labeltext{sunstar}- and \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[**nl] + {\bfc \labeltext{sunstar}- en \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[**de] + {\bfc \labeltext{sunstar}n- und \labeltext{moon}-\labeltext{calendar} } + \stopmode + \startmode[**fr] + {\bfc \labeltext{calendar} du \labeltext{sunstar} et de la \labeltext{moon}} + \stopmode + \startmode[**it] + {\bfc \labeltext{calendar} di \labeltext{sunstar} e della \labeltext{moon}} + \stopmode + \startmode[**es] + {\labeltext{calendar} del \labeltext{sunstar} y la + \labeltext{moon}} + \stopmode + \blank + {\bfb \getvariable{PocketDiary}{Place}} + \vfill + {\tfa \getvariable{PocketDiary}{Year}} + \stopalignment + \vfil + \stopstandardmakeup + +%D Add an editorial and info page + + \startstandardmakeup[page=yes,doublesided=no] + \starttabulate[|l|p|] + \NC \labeltext{title} + \EQ + \startmode[**en] + {\labeltext{sunstar}- and \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[**nl] + {\labeltext{sunstar}- en \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[**de] + {\labeltext{sunstar}n- und \labeltext{moon}-\labeltext{calendar} } + \stopmode + \startmode[**fr] + {\labeltext{calendar} du \labeltext{sunstar} et de la + \labeltext{moon}} + \stopmode + \startmode[**it]] + {\labeltext{calendar} di \labeltext{sunstar} e della + \labeltext{moon}} + \stopmode + \startmode[**es] + {\labeltext{calendar} del \labeltext{sunstar} y la + \labeltext{moon}} + \stopmode + \NC\NR + \NC \labeltext{author} + \EQ \getvariable{PocketDiaryAddress}{Forename}~ + \getvariable{PocketDiaryAddress}{Familyname} \NC\NR + \NC \labeltext{typography} \EQ \CONTEXT\ with \LUAMETATEX \NC\NR + \NC \labeltext[compilation] \EQ \currentdate \NC\NR + \stoptabulate + \vfil + \startmode[**en] + This calendar is generated for \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[**de] + Dieser Kalender ist berechnet für \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[**nl] + Deze kalender is opgemaakt voor \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[**fr] + Ce calendrier est fait pour \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[**it] + Questo calendario è prodotto per \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[**es] + Este calendario está calculado para \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \starttabulate[|l|r|] + \NC Longitude \EQ \getvariable{PocketDiaryGeoPosition}{lon} \NC\NR + \NC Latitude \EQ \getvariable{PocketDiaryGeoPosition}{lat} \NC\NR + \stoptabulate + \stopstandardmakeup + +%D Call the buffer for creating the contents of the calendar + + \getbuffer[Yearofmonthtables] + +\stoptext
\ No newline at end of file |