Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.6k
Change treatment ofnumber-lines
directives.#5207
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
c36dd4e
todf873ce
CompareHmm, I'm not sure why the CI can't load my file. I'm following the example of |
You probably need to add it expliclitly to extra-source-files in pandoc.cabal. |
src/Text/Pandoc/Readers/RST.hs Outdated
@@ -505,7 +505,11 @@ includeDirective top fields body = do | |||
let numberLines = lookup "number-lines" fields | |||
let classes = trimr lang : ["numberLines" | isJust numberLines] ++ | |||
maybe [] words (lookup "class" fields) | |||
let kvs = maybe [] (\n -> [("startFrom", trimr n)]) numberLines | |||
let kvs = maybe [] (\n -> let tn = trimr n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
null tn
would be better thantn == ""
. But as a matter of style, I think this is cleaner:
case trimr nof[]->[] xs-> [("startFrom", xs)]
Indeed, you could use a list comprehension:
let kvs= [("startFrom", xs)| x<- maybeToList (trimr<$> tn)]
but this probably isn't as clear to the reader.
src/Text/Pandoc/Readers/RST.hs Outdated
Nothing -> [] | ||
Just n -> [("startFrom",trim n)] | ||
Just n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Similar remarks to the above.
Directives of this type without numeric inputs should not have a`startFrom` attribute; with a blank value, the writers can produceextra whitespace.
Done. I also tried to dedupe the code a bit. |
Looks good, thanks! |
Directives of this type without numeric inputs should not have a
startFrom
attribute; with a blank value, the writers can produceextra whitespace.
Also, the stuff around line 1000 is modified because previously, it failed to catch newlines.
Closes#5182.