Skip to content

Support to respect the layout of the original pdf file #68

@Nan-Do

Description

@Nan-Do

I'm trying to convert some files that contain python code but the tool doesn't respect the original formatting and prints the files without any spacing. For example, a pdf containing the following text:

# Time: O(n)
# Space: O(n)

# freq table

Next there is the solution to the proposed problem using Python2:

class Solution(object):
    def isGood(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        cnt = [0]*len(nums)
        for x in nums:
             if x < len(cnt):
                 cnt[x] += 1
             else:
                 return False
        return all(cnt[x] == 1 for x in xrange(1, len(nums)-1))

Is translated into:

# Time: O(n) # Space: O(n)

# freq table

Next there is the solution to the proposed problem using Python2:

class Solution(object): def isGood(self, nums): """ :type nums: List[int] :rtype: bool """ cnt = [0]*len(nums) for x in nums: if x < len(cnt): cnt[x] += 1 else: return False return all(cnt[x] == 1 for x in xrange(1, len(nums)-1))

In this case, it doesn't detect it as a code block, in some other examples, the tool detects the code blocks correctly but still removes the initial spacing. One such example is this book

Is there a way to force the tool to respect the original formatting?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions