fronde 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/tasks/org.rake CHANGED
@@ -11,6 +11,9 @@ CLOBBER.push(
11
11
  'var/lib/org-config.el', 'lib/htmlize.el'
12
12
  )
13
13
 
14
+ HTMLIZE_TAG = 'release/1.58'
15
+ OX_GMI_TAG = 'v0.2'
16
+
14
17
  namespace :org do
15
18
  directory 'var/tmp'
16
19
 
@@ -19,37 +22,34 @@ namespace :org do
19
22
  # Weird Rake issue, still executing the task even if the file exists
20
23
  next if File.exist? 'var/tmp/org.tar.gz'
21
24
 
22
- download = Thread.new { Fronde::Org.download }
23
- if verbose
24
- warn R18n.t.fronde.tasks.org.downloaded(version: download.value)
25
- else
26
- Fronde::CLI::Throbber.run(download, R18n.t.fronde.tasks.org.downloading)
25
+ download = Thread.new do
26
+ version = Fronde::Org.download
27
+ puts I18n.t('fronde.tasks.org.downloaded', version:) if verbose
27
28
  end
29
+ Fronde::CLI::Throbber.run(
30
+ download, I18n.t('fronde.tasks.org.downloading'), verbose
31
+ )
28
32
  rescue RuntimeError, Interrupt
29
- warn R18n.t.fronde.tasks.org.no_download if verbose
33
+ warn I18n.t('fronde.tasks.org.no_download') if verbose
30
34
  end
31
35
 
32
36
  desc 'Compile Org'
33
37
  multitask compile: ['var/tmp/org.tar.gz', 'lib'] do |task|
34
38
  # No need to force fetch last version as it is only interesting as
35
39
  # part of the upgrade task
36
- org_version = Fronde::Org.last_version
40
+ version = Fronde::Org.last_version
37
41
 
38
- org_dir = "lib/org-#{org_version}"
42
+ org_dir = "lib/org-#{version}"
39
43
  next if Dir.exist?("#{org_dir}/lisp")
40
44
 
41
45
  build = Thread.new do
42
- Fronde::Org.compile(
43
- task.prerequisites[0], org_version, org_dir, verbose: verbose
44
- )
46
+ Fronde::Org.compile(task.prerequisites[0], version, org_dir, verbose:)
45
47
  Dir.glob('lib/org-[0-9.]*').each { rm_r _1 unless _1 == org_dir }
48
+ puts I18n.t('fronde.tasks.org.installed', version:) if verbose
46
49
  end
47
- if verbose
48
- build.join
49
- warn R18n.t.fronde.tasks.org.installed(version: org_version)
50
- else
51
- Fronde::CLI::Throbber.run(build, R18n.t.fronde.tasks.org.installing)
52
- end
50
+ Fronde::CLI::Throbber.run(
51
+ build, I18n.t('fronde.tasks.org.installing'), verbose
52
+ )
53
53
  rescue RuntimeError, Interrupt
54
54
  next
55
55
  end
@@ -58,14 +58,14 @@ namespace :org do
58
58
 
59
59
  file 'lib/htmlize.el' => 'lib' do
60
60
  htmlize = URI(
61
- 'https://raw.githubusercontent.com/hniksic/emacs-htmlize/master/htmlize.el'
61
+ "https://raw.githubusercontent.com/hniksic/emacs-htmlize/refs/tags/#{HTMLIZE_TAG}/htmlize.el"
62
62
  ).open.read
63
63
  File.write 'lib/htmlize.el', htmlize
64
64
  end
65
65
 
66
66
  file 'lib/ox-gmi.el' => 'lib' do
67
67
  ox_gmi = URI(
68
- 'https://git.umaneti.net/ox-gmi/plain/ox-gmi.el'
68
+ "https://git.umaneti.net/ox-gmi/plain/ox-gmi.el?h=#{OX_GMI_TAG}"
69
69
  ).open.read
70
70
  File.write 'lib/ox-gmi.el', ox_gmi
71
71
  end
data/lib/tasks/site.rake CHANGED
@@ -5,79 +5,104 @@ require_relative '../fronde/index'
5
5
  require_relative '../fronde/templater'
6
6
  require_relative '../fronde/cli/throbber'
7
7
 
8
+ def remove_orphan_file_maybe(file_path)
9
+ print I18n.t('fronde.tasks.site.remove_orphan_file')
10
+ action = $stdin.gets.strip.downcase
11
+ return unless action == 'y'
12
+
13
+ FileUtils.rm file_path
14
+ end
15
+
8
16
  namespace :site do
9
17
  desc 'Build all your projects'
10
18
  task :build, [:force?] => ['var/lib/org-config.el'] do |_, args|
11
19
  args.with_defaults(force?: false)
20
+
21
+ FileUtils.rm_f 'var/tmp/keywords'
12
22
  build_index = Thread.new do
13
23
  all_index = Fronde::Index.all_blog_index
24
+ offset = 0
14
25
  all_index.each do |index|
15
- index.write_all_org(verbose: verbose)
26
+ index.write_all_org(verbose:)
27
+ offset = File.write('var/tmp/keywords', index.emacs_keywords, offset)
16
28
  end
17
29
  Thread.current[:all_indexes] = all_index
18
30
  end
19
- if verbose
20
- build_index.join
21
- else
22
- Fronde::CLI::Throbber.run(
23
- build_index, R18n.t.fronde.tasks.site.generating_indexes
24
- )
25
- end
31
+ Fronde::CLI::Throbber.run(
32
+ build_index, I18n.t('fronde.tasks.site.generating_indexes'), verbose
33
+ )
26
34
  all_indexes = build_index[:all_indexes]
27
35
 
28
36
  build_html = Thread.new do
29
- rm_r 'var/tmp/timestamps', force: true if args[:force?]
30
- Fronde::Emacs.new(verbose: verbose).publish
37
+ Fronde::Emacs.new(verbose:).publish(force: args[:force?])
31
38
  end
32
- Fronde::CLI::Throbber.run(build_html, R18n.t.fronde.tasks.site.building)
33
-
39
+ Fronde::CLI::Throbber.run(
40
+ build_html, I18n.t('fronde.tasks.site.building'), verbose
41
+ )
34
42
  if all_indexes.any?
35
- if verbose
36
- all_indexes.each(&:write_all_feeds)
37
- else
38
- publish_feed = Thread.new do
39
- all_indexes.each do |index|
40
- index.write_all_feeds(verbose: false)
41
- end
43
+ publish_feed = Thread.new do
44
+ all_indexes.each do |index|
45
+ index.write_all_feeds(verbose: false)
42
46
  end
43
- Fronde::CLI::Throbber.run(
44
- publish_feed, R18n.t.fronde.tasks.site.publishing_feeds
45
- )
46
47
  end
48
+ Fronde::CLI::Throbber.run(
49
+ publish_feed, I18n.t('fronde.tasks.site.publishing_feeds'), verbose
50
+ )
47
51
  end
48
52
 
49
53
  next unless Fronde::CONFIG.sources.any? { |source| source.type == 'html' }
50
54
 
51
55
  customize_html = Thread.new do
52
56
  pubfolder = Fronde::CONFIG.get('html_public_folder')
53
- Dir["#{pubfolder}/**/*.html"].each do |f|
57
+ Dir.glob("#{pubfolder}/**/*.html").each do |f|
58
+ if verbose
59
+ short_file = f.sub(/^#{Dir.pwd}/, '.')
60
+ puts I18n.t('fronde.tasks.site.customizing_file', file: short_file)
61
+ end
54
62
  Fronde::Templater.customize_output(f)
55
63
  end
56
64
  end
57
65
  Fronde::CLI::Throbber.run(
58
- customize_html, R18n.t.fronde.tasks.site.customizing
66
+ customize_html, I18n.t('fronde.tasks.site.customizing'), verbose
59
67
  )
60
68
  # :nocov:
61
69
  rescue RuntimeError, Interrupt
62
- warn R18n.t.fronde.tasks.site.aborting
70
+ warn I18n.t('fronde.tasks.site.aborting')
63
71
  next
64
72
  # :nocov:
65
73
  end
66
74
 
75
+ desc 'Build a single file'
76
+ task :build_file, %i[path force?] do |_, args|
77
+ args.with_defaults(force?: false)
78
+ Fronde::Emacs.new(verbose: true).publish_file(
79
+ args[:path], force: args[:force?]
80
+ )
81
+ puts I18n.t('fronde.tasks.site.customizing_file', file: args[:path])
82
+ Fronde::Templater.customize_output(args[:path])
83
+ end
84
+
67
85
  desc 'Cleanup orphaned published files'
68
86
  task :clean do
87
+ Fronde::Index.all_blog_index do |index|
88
+ project = index.project
89
+ all_tags = %w[index] + index.all_tags
90
+ Dir.glob("#{project['path']}/tags/*").each do |file_name|
91
+ slug = File.basename file_name, '.org'
92
+ next if all_tags.include?(slug)
93
+
94
+ short_file = file_name.sub(/^#{Dir.pwd}/, '.')
95
+ puts I18n.t('fronde.tasks.site.orphan_tag', file: short_file)
96
+ remove_orphan_file_maybe file_name
97
+ end
98
+ end
69
99
  pubfolder = Fronde::CONFIG.get('html_public_folder')
70
- Dir["#{pubfolder}/**/*.html"].each do |file_name|
100
+ Dir.glob("#{pubfolder}/**/*.html").each do |file_name|
71
101
  source = Fronde::Org::File.new(file_name)
72
-
73
102
  # Return if an org file has been found for this published file
74
103
  next unless source.file == file_name
75
104
 
76
- print R18n.t.fronde.tasks.site.remove_orphan_file
77
- action = $stdin.gets.strip.downcase
78
- next unless action == 'y'
79
-
80
- rm file_name
105
+ remove_orphan_file_maybe file_name
81
106
  end
82
107
  end
83
108
 
data/lib/tasks/sync.rake CHANGED
@@ -15,13 +15,9 @@ namespace :sync do
15
15
  publish_thread = Fronde::Sync.pull_or_push(
16
16
  :push, type, test: args[:test?], verbose: verbose
17
17
  )
18
- if verbose
19
- publish_thread.join
20
- else
21
- Fronde::CLI::Throbber.run(
22
- publish_thread, format('Publishing %<fmt>s:', fmt: type)
23
- )
24
- end
18
+ Fronde::CLI::Throbber.run(
19
+ publish_thread, format('Publishing %<fmt>s:', fmt: type), verbose
20
+ )
25
21
  rescue Fronde::Sync::Error => e
26
22
  warn e
27
23
  next
@@ -36,13 +32,9 @@ namespace :sync do
36
32
  pull_thread = Fronde::Sync.pull_or_push(
37
33
  :pull, type, test: args[:test?], verbose: verbose
38
34
  )
39
- if verbose
40
- pull_thread.join
41
- else
42
- Fronde::CLI::Throbber.run(
43
- pull_thread, format('Pulling %<fmt>s:', fmt: type)
44
- )
45
- end
35
+ Fronde::CLI::Throbber.run(
36
+ pull_thread, format('Pulling %<fmt>s:', fmt: type), verbose
37
+ )
46
38
  rescue Fronde::Sync::Error => e
47
39
  warn e
48
40
  next
data/locales/en.yml CHANGED
@@ -1,86 +1,147 @@
1
1
  ---
2
- fronde:
3
- bin:
4
- usage: 'Usage: fronde %1 [options]'
5
- done: done
6
- interrupted: interrupted
7
- commands:
8
- cmd_title: Commands
9
- alias: Alias for ‘%1’.
10
- new: Initialize a new Fronde instance.
11
- update: >-
12
- Update Fronde configuration and dependency (to be run after each
13
- modification of the config.yml file and once in a while to stay
14
- up-to-date with Org).
15
- preview: Start a test web server to preview the generated website.
16
- open: Open or create an org file.
17
- build: Compile all org files to HTML or gemtext.
18
- publish: Push local changes to the public web server.
19
- help: Alias for the -h switch.
20
- options:
21
- cmd_title: Options
22
- help: Display help for a command and exit.
23
- version: Display Fronde version and exit.
24
- default_title: New article
25
- error:
2
+ en:
3
+ fronde:
26
4
  bin:
27
- label: An error occurred.
28
- explanation: >-
29
- To see the error, run the same command again with more
30
- verbosity, for example, fronde build -v
31
- no_command: 'ERROR: no command or unknown command given.'
32
- no_file: >-
33
- Warning: No file path given. Default file will be used.
34
- config:
35
- deprecated_public_folder: >-
36
- ‘public_folder’ setting is deprecated. Please use either
37
- ‘html_public_folder’ or ‘gemini_public_folder’.
38
- source:
39
- no_path: Skipping %{source} as its ‘path’ key is missing.
40
- duplicate: >-
41
- Skipping %{source} as it appears at least twice in the sources
42
- of type %{type}.
43
- inclusion: >-
44
- Skipping %{source} as it might be already embedded into the
45
- other source %{other_source} of type %{type}.
46
- org_file:
47
- no_file_or_title: No file or title given.
48
- no_project: No project found for %{file}. Publication will fail.
5
+ usage: 'Usage: fronde %{label} [options]'
6
+ done: done
7
+ interrupted: interrupted
8
+ commands:
9
+ cmd_title: Commands
10
+ alias: Alias for ‘%{alias}’.
11
+ new: Initialize a new Fronde instance.
12
+ update: >-
13
+ Update Fronde configuration and dependency (to be run after each
14
+ modification of the config.yml file and once in a while to stay
15
+ up-to-date with Org).
16
+ preview: Start a test web server to preview the generated website.
17
+ open: Open or create an org file.
18
+ build: Compile all org files to HTML or gemtext.
19
+ publish: Push local changes to the public web server.
20
+ help: Alias for the -h switch.
21
+ options:
22
+ cmd_title: Options
23
+ help: Display help for a command and exit.
24
+ version: Display Fronde version and exit.
25
+ default_title: New article
26
+ error:
27
+ bin:
28
+ label: An error occurred.
29
+ explanation: >-
30
+ To see the error, run the same command again with more
31
+ verbosity, for example, fronde build -v
32
+ no_command: 'ERROR: no command or unknown command given.'
33
+ no_file: >-
34
+ Warning: No file path given. Default file will be used.
35
+ config:
36
+ deprecated_public_folder: >-
37
+ ‘public_folder’ setting is deprecated. Please use either
38
+ ‘html_public_folder’ or ‘gemini_public_folder’.
39
+ source:
40
+ no_path: Skipping %{source} as its ‘path’ key is missing.
41
+ duplicate: >-
42
+ Skipping %{source} as it appears at least twice in the sources
43
+ of type %{type}.
44
+ inclusion: >-
45
+ Skipping %{source} as it might be already embedded into the
46
+ other source %{other_source} of type %{type}.
47
+ org_file:
48
+ no_file_or_title: No file or title given.
49
+ no_project: No project found for %{file}. Publication will fail.
50
+ dangerous_code_block: >-
51
+ The file %{file} contains at least one code block to eval, which will
52
+ be ignored for security reasons. You can still evaluate it manually
53
+ from inside Org in order to have its result exported.
54
+ index:
55
+ wrong_sort_kind: '%{kind} not in %{accepted_values}'
56
+ templater:
57
+ no_element_found: >-
58
+ No element found with the selector %{source} in %{file}.
49
59
  index:
50
- wrong_sort_kind: '%{kind} not in %{accepted_values}'
51
- templater:
52
- no_element_found: >-
53
- No element found with the selector %{source} in %{file}.
54
- no_head_element: No head tag found in file %{file}.
55
- index:
56
- unsorted: Unsorted
57
- published_on: Published on %1
58
- all_tags: All tags
59
- by_name: By alphabetical order
60
- by_weight: By publication number
61
- full_date_format: '%A %{date}'
62
- full_date_with_time_format: '%{date} at %{time}'
63
- index_generated: Generated index file for %{tag}.
64
- atom_generated: Generated Atom feed for %{tag}.
65
- org:
66
- generate_blog_index: Generating blog home page for %{name}
67
- postamble:
68
- written_by: Written by %a
69
- last_modification: Last modification on %C
70
- with_emacs: with %c, and published with %n
71
- with_emacs_html: with %c, and published with %N
72
- tasks:
73
- site:
74
- aborting: Aborting
75
- generating_indexes: 'Generating index files:'
76
- building_indexes: 'Building index files:'
77
- publishing_feeds: 'Publishing Atom feeds:'
78
- building: 'Building:'
79
- customizing: 'Customizing:'
80
- remove_orphan_file: 'Remove it? [y/N]: '
60
+ unsorted: Unsorted
61
+ published_on: Published on %{date}
62
+ all_tags: All tags
63
+ by_name: By alphabetical order
64
+ by_weight: By publication number
65
+ index_generated: Generated index file for %{tag}.
66
+ atom_generated: Generated Atom feed for %{tag}.
81
67
  org:
82
- downloaded: Org version %{version} has been downloaded.
83
- downloading: 'Downloading Org:'
84
- no_download: Impossible to download Org now. Please try again later.
85
- installed: Org version %{version} has been locally installed.
86
- installing: 'Installing Org:'
68
+ generate_blog_index: Generating blog home page for %{name}
69
+ postamble:
70
+ written_by: Written by %a
71
+ last_modification: Last modification on %C
72
+ with_emacs: with %c, and published with %n
73
+ with_emacs_html: with %c, and published with %N
74
+ neocities:
75
+ deleting: deleting %{path}
76
+ sha1_differ: SHA1 hash differ for %{uri}
77
+ tasks:
78
+ site:
79
+ aborting: Aborting
80
+ generating_indexes: 'Generating index files:'
81
+ building_indexes: 'Building index files:'
82
+ publishing_feeds: 'Publishing Atom feeds:'
83
+ building: 'Building:'
84
+ customizing: 'Customizing:'
85
+ customizing_file: 'Customizing file %{file}'
86
+ orphan_tag: The file %{file} refers to a tag, which is no more in use.
87
+ remove_orphan_file: 'Remove it? [y/N]: '
88
+ org:
89
+ downloaded: Org version %{version} has been downloaded.
90
+ downloading: 'Downloading Org:'
91
+ no_download: Impossible to download Org now. Please try again later.
92
+ installed: Org version %{version} has been locally installed.
93
+ installing: 'Installing Org:'
94
+ time:
95
+ formats:
96
+ default: '%a, %b %-d, %Y %H:%M:%S %z'
97
+ long: '%A, %B %-d, %Y at %R'
98
+ long_no_year: '%A, %B %-d at %R'
99
+ long_no_time: '%A, %B %-d, %Y'
100
+ long_no_time_no_year: '%A, %B %-d'
101
+ date:
102
+ abbr_day_names:
103
+ - Sun
104
+ - Mon
105
+ - Tue
106
+ - Wed
107
+ - Thu
108
+ - Fri
109
+ - Sat
110
+ abbr_month_names:
111
+ -
112
+ - Jan
113
+ - Feb
114
+ - Mar
115
+ - Apr
116
+ - May
117
+ - Jun
118
+ - Jul
119
+ - Aug
120
+ - Sep
121
+ - Oct
122
+ - Nov
123
+ - Dec
124
+ day_names:
125
+ - Sunday
126
+ - Monday
127
+ - Tuesday
128
+ - Wednesday
129
+ - Thursday
130
+ - Friday
131
+ - Saturday
132
+ formats:
133
+ default: '%Y-%m-%d'
134
+ month_names:
135
+ -
136
+ - January
137
+ - February
138
+ - March
139
+ - April
140
+ - May
141
+ - June
142
+ - July
143
+ - August
144
+ - September
145
+ - October
146
+ - November
147
+ - December