thomaspark / pubcss

Format academic publications in HTML & CSS
http://thomaspark.co/2015/01/pubcss-formatting-academic-publications-in-html-css/
MIT License
794 stars 80 forks source link

Errors when trying to compile custom version. #21

Closed Greenscreener closed 5 years ago

Greenscreener commented 5 years ago

Hello,

I need to create my own css, because I need to use a different (and quite obscure) standard than what you have. It is not a problem for me to setup the styles accordingly, but I can't get even your unmodified code to compile. When I first tried to run sass, it returned:

Error: Invalid CSS after "escape": expected selector, was "("@")footnotes"
        on line 2 of pubcss/src/objects/_footnotes.scss, in `footnotes'
        from line 11 of pubcss/src/objects/_page.scss
        from line 25 of pubcss/src/_manifest.scss
        from line 5 of styles/pubcss-gjsm.scss
  Use --trace for backtrace.

I looked into the source and tried to replace the escape function with the unquote function, which throws this error:

Error: Invalid CSS after "": expected selector, was "@footnotes"
        on line 2 of pubcss/src/objects/_footnotes.scss, in `footnotes'
        from line 11 of pubcss/src/objects/_page.scss
        from line 25 of pubcss/src/_manifest.scss
        from line 5 of styles/pubcss-gjsm.scss
  Use --trace for backtrace.

I suspect this might be because I don't use Gulp, which I would like to avoid, because from what I understand it is used just for automatic reloading of the css in a browser, which I have my own tools for and don't really need for this project.

Or does this have something to do with Price?

Is there a way I could quickly patch/fix this without too much pain?

Thank you very much, GS

thomaspark commented 5 years ago

Hey @Greenscreener, just pushed a fix for this. Can you confirm it works on your end?

Greenscreener commented 5 years ago

Now I'm getting this:

Error: Undefined variable: "$at".
        on line 3 of pubcss/src/objects/_page.scss, in `page-number'
        from line 12 of pubcss/src/objects/_page.scss
        from line 24 of pubcss/src/_manifest.scss
        from line 5 of styles/pubcss-gjsm.scss
  Use --trace for backtrace.
thomaspark commented 5 years ago

Just pushed another change, hopefully this does the trick.

Greenscreener commented 5 years ago
Error: List index is 4 but list is only 3 items long for `nth'
        on line 30 of pubcss/src/tools/_counter.scss, in `generate-counter-content'
        from line 38 of pubcss/src/tools/_counter.scss, in `generate-counter-content'
        from line 38 of pubcss/src/tools/_counter.scss, in `generate-counter-content'
        from line 38 of pubcss/src/tools/_counter.scss, in `generate-counter-content'
        from line 5 of pubcss/src/helper/_header-counter.scss, in `header-counter'
        from line 9 of pubcss/src/helper/_header-counter.scss
        from line 30 of pubcss/src/_manifest.scss
        from line 4 of style.scss
  Use --trace for backtrace.

Now it's this.

thomaspark commented 5 years ago

I'm not able to replicate that error. Can you give more details about your setup? What you're using to compile sass, version, which acm/ieee file, etc?

Greenscreener commented 5 years ago

The first error is produced by Ruby Sass 3.7.4 A very similar error is also returned when using sassc:

Error: index out of bounds for `nth($list, $n)`
        on line 30:29 of pubcss/src/tools/_counter.scss, in function `nth`
        from line 30:29 of pubcss/src/tools/_counter.scss, in mixin `generate-counter-content`
        from line 38:14 of pubcss/src/tools/_counter.scss, in mixin `generate-counter-content`
        from line 38:14 of pubcss/src/tools/_counter.scss, in mixin `generate-counter-content`
        from line 38:14 of pubcss/src/tools/_counter.scss, in mixin `generate-counter-content`
        from line 5:14 of pubcss/src/helper/_header-counter.scss, in mixin `header-counter`
        from line 9:10 of pubcss/src/helper/_header-counter.scss
        from line 30:9 of pubcss/src/_manifest.scss
        from line 5:9 of styles/pubcss-gjsm.scss
>>     $counter-style: unquote(nth($counter-styles, $i));

   ----------------------------^

with sassc --version returning:

sassc: na
libsass: 3.6.1
sass2scss: 1.1.1
sass: 3.5

Before you could react to this issue, I actually implemented everything that I needed myself, so I have to checkout an old commit to try your fixes. The only two files, that contain my stuff are: pubcss-gjsm.scss:

// Import settings
@import "./settings/gjsm.scss";

// Import PubCSS
@import "../pubcss/src/_manifest.scss";

// Custom style overrides

and settings/gjsm.scss (mostly based on settings/ieee.scss):

// Layout

$page-width: 210mm;
$page-height: 297mm;
$page-margin: 1cm;

$page-column-count: 1;
$page-column-fill: balance;
$page-column-gap: 0.33in;

$footnote-column-count: $page-column-count;
$footnote-float: prince-column-footnote;

$footnotes-margin-top: 1em;
$footnotes-padding: 3pt;
$footnotes-border: 0.5px solid #000;

$table-margin: 1.667em 0 1em;
$table-cell-padding: 0.333em;
$table-border: 0.5px solid #000;

$figure-margin: 1.333em 0 2.333em;
$caption-margin: 0 0 4pt;
$caption-side: top;

// Typography

$font-family-serif: "Times New Roman", serif;
$font-family-monospace: "Fira Code",  monospace;
$font-family-base: $font-family-serif;

$font-size-base: 12pt;
$font-size-small: 10pt;
$font-size-code: 10pt;

$font-size-page-number: $font-size-base;

$line-height-base: 1.5;
$hyphens-base: none;
$text-align-base: justify;
$paragraph-margin: 0 0 6pt;
$paragraph-indent: 1.5em;

$headings-font-family: $font-family-serif;
$headings-font-weight: bold;
$headings-hyphens: none;

$caption-weight: bold;
$figcaption-weight: $caption-weight;

// Counters

$page-number-enabled: true;
$page-number-position: bottom;
$page-number-style: decimal;
$page-number-start: 1;

$header-counter-enabled: true;
$counter-ids:
        'section',
        'subsection',
        'subsubsection',
        'subsubsection',
        'subsubsubsection',
        'subsubsubsubsection';

$counter-styles:
        'decimal',//h1
        'decimal',//h2
        'decimal';//h3

$counter-header-prefix: "";
$counter-header-suffix: "";
$counter-header-separator: ".";

$table-prefix: "Tabulka ";
$table-suffix: ". ";

$figure-prefix: "Obr. ";
$figure-suffix: ". ";

$cite-prefix: "[";
$cite-suffix: "]";
$cites-separator: ", ";

$ref-prefix: $cite-prefix;
$ref-suffix: $cite-suffix;

I didn't have any time to actually finish the full stylesheet.

While writing this I noticed the cause of the issue. I knew I wasn't going to use smaller then h3 headings, so I removed the latter three, which is what broke.

After fixing that, it works. Thank you very much.