Comments (10)
If every author came to a standard, we could have a simple input on the properties tab, and use that to know where to insert the auto page number snippet.
Ideally, we could have that, and people could still opt to use the manual snippet.
from homebrewery.
Possible solutions:
- Use
.page:before
to create an automatic page number element. I would expect this approach to be CSS only, if so, it could be a Style Editor snippet. - Modify the footer bar in
.page:after
to include the page number (although usingtransform: scaleX(-1);
to flip the footer would then require that the text content be flipped again to return it to the correct orientation).
from homebrewery.
CSS for auto page numbers without having to {{pageNumber,auto}}
every page using .page:before
:
.page:before {
content: counter(phb-page-numbers);
position: absolute;
right: 2px;
bottom: 22px;
width: 50px;
font-size: .9em;
color: var(--HB_Color_Footnotes);
text-align: center;
text-indent: 0;
}
.page:nth-child(even):before {
left: 2px;
}
EDIT: Putting this in as a Style Editor snippet would have the widest possible compatibility.
from homebrewery.
Now that :has()
is functional in Chrome, we could theoretically do things like this:
.pages:has(.autoNumberOn) .page:before {
content: counter(phb-page-numbers);
position: absolute;
right: 2px;
bottom: 22px;
width: 50px;
font-size: .9em;
color: var(--HB_Color_Footnotes);
text-align: center;
text-indent: 0;
}
.pages:has(.autoNumberOn) .page:nth-child(even):before {
left: 2px;
}
As long as there is an element within the .pages
element somewhere that has the class autoNumberOn
, then the automatic page numbering is applied.
Throwing CSS nesting into the mix:
.pages:has(.autoNumberOn) {
.page {
&:before {
content: counter(phb-page-numbers);
position: absolute;
right: 2px;
bottom: 22px;
width: 50px;
font-size: .9em;
color: var(--HB_Color_Footnotes);
text-align: center;
text-indent: 0;
}
&:nth-child(even):before {
left: 2px;
}
}
}
EDIT: These solutions have much narrower compatibility profiles.
from homebrewery.
Almost didn't notice you wrote .pages
and not .page
.
You'd still need a mechanism to turn off the page number for specific pages, such as any cover pages or section breaks, or any page set aside for full bleed images, etc.
So, maybe this?
.pages:has(.autoNumberOn) {
.page:has(not.autoNumberOff) {
...
from homebrewery.
.page:has(.autoNumberOff):before {
display: none;
}
from homebrewery.
Almost didn't notice you wrote
.pages
and not.page
.
The nested CSS makes that kind of change a lot more obvious.
from homebrewery.
In my opinion, the better solution is likely to create some sort of generator/js function to add the page numbers at a point-of-time when the user decides. Rather than rely on browser-limited CSS rules.
Some indicator on each page that you want a page number on them (or don't wnat a page number) which is then organized by a function and replaced with the correct markdown at the bottom of each page in the editor when the user clicks "create page numbers".
When we were setting up v3 we reserved the space on the \page
lines so nothing could be on those lines. Now, we could we add new syntax for that line, like
\page #
Which would indicate a desired page number. The syntax could even be more robust. For example, the below syntax would indicate that the page should be numbered as page "1", and the numbering should continue from 1 on subsequent pages.
\page #1
As always, you can get more complicated. More syntax options:
\page # "Introduction | Setting"
// adds a page number and fills the Fancy Footer section with the quoted text.
\page # "$PART | $H2"
// adds a page number and fills the Fancy Footer with the text of the most recent Part snippet, followed by the most recent h2 element to the end of the page.
When a user wants to clear their page numbers to re-run the generation (or some other reason), another button can run a function that just clears everything on the new page lines after the \page
.
from homebrewery.
For things that occur on multiple pages, repetitively, it might be prudent to consider using variables.
from homebrewery.
If i understand this correctly:
\page #
would insert a page with auto numbering,
\page # "Creating a character"
would insert a page with auto numbering and that text as footer,
\page #X
would insert a page with manual number set of X,
\page #X "Creating a character"
would insert a page with manual number set of X and that text as footer.
Would that be correct?
Assuming i got that right, we might want to consider using #auto
instead of #, to make it easier for users
otherwise, this looks like a great idea, with no unnecesary syntax.
from homebrewery.
Related Issues (20)
- Store edits in local storage until written to disk HOT 2
- New Shortcuts: Note and Descriptive HOT 3
- Make the Homebrewery meet Web Content Accessibility Guidelines(WCAG) HOT 1
- Add Darkbrewery editor theme HOT 6
- Correct permissions on co-author's userpage HOT 6
- Authors view should not count for view-count
- Renaming brews in user page HOT 3
- "Looks like there was a problem saving."
- Issue saving HOT 1
- Local backups of brews
- lockout on homebrewery HOT 1
- links to other homebrewery files precent saving HOT 1
- Custom Brew Themes HOT 1
- Add Share link to "Not an Author" error page HOT 3
- Basic account features
- PHB footers should default to all caps? HOT 5
- `docker-compose up -d` fails to build because of download error HOT 3
- cursive dropcap gets clipped HOT 8
- [Firefox] Brew prints alternate blank pages
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebrewery.