Hi,

I am trying to use the Pocket Diary
<https://ctan.org/pkg/context-pocketdiary> module to create a photo
calendar as described in the Calendar Examples
<https://ctan.org/pkg/context-calendar-examples>. The examples work fine.
By default weeks begin on Monday. Does anyone know how to specify that
weeks begin on Sunday? I have searched through all the setvariable
assignments, but nothing seems applicable.

I have attached an example file so you needn't retrieve all the examples.
Any help would be appreciated.

-- 
With kind regards,

Michael


<http://literatesolutions.com>
\usemodule[pocketdiary]

%D Choose and setup the font to be used
\setupbodyfont[ibmplex,ss,12pt]

% Supported languages: EN,DE,NL,FR,IT,ES
\mainlanguage[nl]

% Switch off the page numbering
\setuppagenumbering[location=]

% Setup the paper size
\setuppapersize[A4,portrait][A4,portrait]

% Adjust the layout of the page
\setuplayout
  [topspace=20mm,
  backspace=8.6mm,
  header=0pt,
  footer=0pt,
  height=middle,
  width=middle]

% Setup the path where to find the calendar pictures
\setupexternalfigures [directory={., ./graphics, ../graphics, ./MyPhotoDirectory}]
\setupexternalfigures [location={local,global,default}]

\def\testimage {cow} % dolly.png
% Give pictures symbolic names for using in a loop
\useexternalfigure [1] [\testimage]
\useexternalfigure [2] [\testimage]
\useexternalfigure [3] [\testimage]
\useexternalfigure [4] [\testimage]
\useexternalfigure [5] [\testimage]
\useexternalfigure [6] [\testimage]
\useexternalfigure [7] [\testimage]
\useexternalfigure [8] [\testimage]
\useexternalfigure [9] [\testimage]
\useexternalfigure [10] [\testimage]
\useexternalfigure [11] [\testimage]
\useexternalfigure [12] [\testimage]
\useexternalfigure [13] [\testimage]

% Setup the variables for the Pocket diary, only year is used for the calculations.
\setvariables
  [PocketDiary]
  [Year=2025]

% Let the header and the footer be empty:
\setupheadertexts[][]
\setupfootertexts[][]

% 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

% Define the macro for calling lua
\define[1]\Photocalendarpages
  {\ctxlua{thirddata.calendar.Photo_calendar_page(#1)}}

% Setup the \TEX\ side of the document
\starttext

  % 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

  % Call the defined macro
  \Photocalendarpages{\getvariable{PocketDiary}{Year}}

\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to