Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only add a name section if one doesn't already exist #115

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adminspotter
Copy link
Contributor

@adminspotter adminspotter commented Jan 6, 2024

ronn would add a second ## NAME section even If an input document already has one.

A couple of interconnected changes here:

  1. Instead of only looking for document metadata in the single-hash header, we'll also see if there's a ## NAME header, and dig inside it for metadata. This allows users to not have to provide the --name command-line flag.
  2. When we get ready to emit the processed document, we'll check to see if there's already a <h2>NAME</h2>, and if so, we won't add anything.

I added unit tests for everything.

This should fix up #33

We may want to add more methods to sniff out various parts of the
document.  Stuffing them all inline is going to make the `sniff`
method into a pretty big mess, so we'll split out the existing stuff
into its own method.  We can add more methods to do other kinds of
content sniffing as needed.
Documents may already have NAME sections which already have name and
tagline, so we should try that before looking at the H1 header.

The sections may use the hyphenated form, which we can split up as
name and tagline, or they may just have the name of the page.  We can
handle both.
Some documents may include a NAME section in the original text.  We'll
make sure to check before we add one of our own; if there's already
one, we can skip adding a new one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant