Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ DEPENDENCIES
mdl (~> 0.18)

CHECKSUMS
bundler (4.0.16) sha256=d6ca5dd440c24f9abce9844cf44cc8e18c6a553de65a47efb4544137af92c47d
chef-utils (19.3.15) sha256=1c537a9c85b55b6d897de8e8af6b66b017a6dfae2b5e7b25e0bf320637e0b86a
concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
kramdown (2.5.2) sha256=1ba542204c66b6f9111ff00dcc26075b95b220b07f2905d8261740c82f7f02fa
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ de produção igual ao do CI, pra pegar erro de template que só aparece com
hugo --gc --minify
```

## Criando um post novo

```bash
ruby scripts/new_post.rb "Título do post" "tag1, tag2"
```

Gera `content/docs/<ano>/<mês em português>/<slug>.md` (criando as pastas de
ano/mês se ainda não existirem) com o front matter já preenchido — `title`,
`date` (data de hoje), `slug` (gerado a partir do título) e `tags` — e
`draft: true`. Título e tags também podem ser omitidos na chamada: o script
pergunta interativamente. Quando o post estiver pronto pra publicar, troque
`draft: true` para `draft: false` manualmente.

## Lint de Markdown

Os posts são checados com o [`mdl`](https://github.com/markdownlint/markdownlint) (regras em
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions content/docs/2026/setembro/Editor de PDFs Stirling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "Editor de PDFs Stirling - Como executar localmente"
date: 2026-03-16
slug: servidor-nas-truenas-pessoal
tags: [nas, truenas, self-hosted, redes]
draft: true
---

Como funciona essa esse programa?

![01-layout-editor-de-pdfs](/home/kellen/Projects/ladydebug.github.io/content/docs/2026/setembro/01-layout-editor-de-pdfs.png)

Configuração como configurar?

Stirling-PDF está rodando em [http://192.168.0.209:8080](#link)
84 changes: 84 additions & 0 deletions scripts/new_post.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Cria um novo post em content/docs/<ano>/<mes-pt>/<slug>.md já com o front
# matter no formato usado pelo resto do blog (ver qualquer post existente em
# content/docs/), criando a pasta do ano/mês automaticamente se ainda não
# existir.
#
# Uso:
# bundle exec ruby scripts/new_post.rb "Título do post" [tag1,tag2,...]
#
# Se o título não for passado como argumento, o script pergunta
# interativamente. Tags são opcionais (separadas por vírgula).
#
# draft sempre nasce como `true` — o fluxo é escrever o post, revisar, e só
# então trocar manualmente para `false` quando estiver pronto pra publicar
# (é isso que tira o post da lista "draft" e faz ele entrar no blog/RSS/sitemap).

require 'date'
require 'fileutils'

MESES_PT = %w[
janeiro fevereiro marco abril maio junho
julho agosto setembro outubro novembro dezembro
].freeze

ACCENTS = {
'á' => 'a', 'à' => 'a', 'ã' => 'a', 'â' => 'a', 'ä' => 'a',
'é' => 'e', 'è' => 'e', 'ê' => 'e', 'ë' => 'e',
'í' => 'i', 'ì' => 'i', 'î' => 'i', 'ï' => 'i',
'ó' => 'o', 'ò' => 'o', 'õ' => 'o', 'ô' => 'o', 'ö' => 'o',
'ú' => 'u', 'ù' => 'u', 'û' => 'u', 'ü' => 'u',
'ç' => 'c', 'ñ' => 'n'
}.freeze

def slugify(text)
slug = text.downcase
ACCENTS.each { |accented, plain| slug = slug.gsub(accented, plain) }
slug = slug.gsub(/[^a-z0-9]+/, '-')
slug.gsub(/^-+|-+$/, '')
end

def prompt(label)
print("#{label}: ")
$stdin.gets&.strip
end

title = ARGV[0] || prompt('Título do post')
abort('Título não pode ser vazio.') if title.nil? || title.strip.empty?

tags_arg = ARGV[1] || prompt('Tags (separadas por vírgula, pode deixar em branco)')
tags = (tags_arg || '').split(',').map(&:strip).reject(&:empty?)

today = Date.today
slug = slugify(title)
abort("Não foi possível gerar um slug a partir de \"#{title}\".") if slug.empty?

mes = MESES_PT[today.month - 1]
dir = File.join(__dir__, '..', 'content', 'docs', today.year.to_s, mes)
path = File.join(dir, "#{slug}.md")

if File.exist?(path)
abort("Já existe um post em #{File.expand_path(path)} — escolha outro título ou apague o arquivo antigo.")
end

FileUtils.mkdir_p(dir)

tags_yaml = tags.empty? ? '[]' : "[#{tags.join(', ')}]"

front_matter = <<~MD
---
title: "#{title}"
date: #{today.strftime('%Y-%m-%d')}
slug: #{slug}
tags: #{tags_yaml}
draft: true
---

MD

File.write(path, front_matter)

puts "Post criado em #{File.expand_path(path)}"
puts 'draft: true — troque para false quando terminar de escrever.'
Loading